/* ============================================================
   ORDEN DE SERVICIO — STK Theme
   Paleta: Negro #1a1a1a · Amarillo/Dorado #f5c518 · Blanco #fff
   Tipografia: system sans-serif
   ============================================================ */

/* ---------- CSS Variables ---------- */
#orden-servicio-app {
  --os-black: #1a1a1a;
  --os-yellow: #f5c518;
  --os-yellow-light: #fef9e7;
  --os-yellow-hover: #e0b200;
  --os-white: #ffffff;
  --os-bg: #f7f7f7;
  --os-card: #ffffff;
  --os-foreground: #1a1a1a;
  --os-muted-foreground: #71717a;
  --os-border: #e4e4e7;
  --os-border-strong: #d4d4d8;
  --os-radius: 6px;
  --os-radius-lg: 10px;
  --os-shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --os-shadow: 0 4px 16px rgba(0,0,0,.08);
  --os-shadow-lg: 0 12px 30px rgba(15,23,42,.12);
  --os-icon-blue: #2563eb;
  --os-icon-green: #16a34a;
  --os-icon-red: #dc2626;
  --os-warranty-color: #d97706;

  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--os-foreground);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ---------- Intro / Buscador ---------- */
.os-intro-card {
  background: var(--os-card) !important;
  box-shadow: var(--os-shadow-lg) !important;
  border-radius: var(--os-radius-lg) !important;
  border: 1px solid var(--os-border);
}

.os-intro-card h2 {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: var(--os-foreground);
  letter-spacing: -0.01em;
}

.os-intro-card p {
  color: var(--os-muted-foreground) !important;
  font-size: 13px !important;
}

#os-search-input {
  border: 1px solid var(--os-border) !important;
  border-radius: var(--os-radius) !important;
  padding: 9px 12px !important;
  font-size: 13px !important;
  color: var(--os-foreground);
  background: var(--os-white);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

#os-search-input:focus {
  border-color: var(--os-yellow) !important;
  box-shadow: 0 0 0 3px rgba(245, 197, 24, .2) !important;
}

#os-search-input::placeholder {
  color: var(--os-muted-foreground);
}

/* ---------- Buttons ---------- */
.os-btn-sm,
.os-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: none;
  border-radius: var(--os-radius);
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
  background: var(--os-yellow);
  color: var(--os-black);
}

.os-btn-sm:hover,
.os-btn:hover {
  background: var(--os-yellow-hover);
  box-shadow: 0 2px 8px rgba(245, 197, 24, .35);
}

.os-btn-sm:active,
.os-btn:active {
  transform: scale(0.97);
}

/* ---------- Shell ---------- */
.os-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.os-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
  background: var(--os-black);
  color: var(--os-white);
  padding: 14px 20px;
  border-radius: var(--os-radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--os-shadow);
}

.os-header h1 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: var(--os-white);
  letter-spacing: -0.01em;
}


.os-header h1 .muted {
  font-weight: 400;
  opacity: .85;
  font-size: 18px;
  color: #e5e7eb;
  margin-left: 8px;
}

.os-header-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255,255,255,.7);
}
.os-header-meta-estado {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255,255,255,.7);
  margin-left: 64px;
}
.os-header-meta > span:first-child {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 10px;
  opacity: .6;
}

/* ---------- Badge ---------- */
.os-badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  background: var(--os-yellow);
  color: var(--os-black);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.4;
}

.os-badge.min-w-100 {
  min-width: 100px;
  text-align: center;
}

/* ---------- Main Layout ---------- */
.os-main {
  display: flex;
  gap: 0;
  flex: 1;
  min-height: 0;  
}

/* ---------- Tab Panels ---------- */
.os-tab-panels {
  flex: 1;
  min-width: 0;
  background: var(--os-card);
  border-radius: var(--os-radius-lg);
  border: 1px solid var(--os-border);
  overflow: hidden;
}

.os-tab-panel {
  padding: 32px;
  animation: osFadeIn .25s ease;
}

.os-tab-panel[hidden] {
  display: none;
}

@keyframes osFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- General Tab Layout ---------- */
.os-tab-general {
  display: flex;
  gap: 20px;
}

.os-sidebar-left {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.os-content-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Fieldset ---------- */
.os-fieldset {
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius);
  padding: 0;
  margin: 0;
  background: var(--os-card);
}

.os-fieldset-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  margin-left: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--os-black);
}

.os-fieldset-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--os-yellow);
  flex-shrink: 0;
}

.os-fieldset-legend.warranty {
  color: var(--os-warranty-color);
}

.os-fieldset-legend.warranty .dot {
  background: var(--os-warranty-color);
}

.os-fieldset-body {
  padding: 10px 14px;
}

/* ---------- Field Rows ---------- */
.os-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.os-field-row.start {
  align-items: flex-start;
}

.os-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--os-muted-foreground);
  flex-shrink: 0;
}

.os-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--os-foreground);
  padding: 4px 8px;
  background: var(--os-bg);
  border: 1px solid var(--os-border);
  border-radius: 4px;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  line-height: 1.4;
}

.os-value.flex-1 {
  flex: 1;
  display: flex;
}

/* ---------- Ajustes de proporciones en panel central (desktop) ---------- */
@media (min-width: 901px) {
  /* Alturas mínimas de las tarjetas laterales para acercar la distribución a la maqueta */
  .os-fieldset-cliente {
    min-height: 110px;
  }

  .os-fieldset-equipo-side {
    min-height: 100px;
  }

  .os-fieldset-garantia {
    min-height: 80px;
  }

  /* Alturas mínimas de los fieldsets principales */
  .os-fieldset-equipo-main {
    min-height: 110px;
  }

  .os-fieldset-orden-main {
    min-height: 170px;
  }
}

/* ---------- Tables ---------- */
.os-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--os-border) !important;
  border-radius: var(--os-radius) !important;
}

.os-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.os-table thead {
  background: var(--os-black);
  color: var(--os-white);
}

.os-table thead.sticky {
  position: sticky;
  top: 0;
  z-index: 2;
}

.os-table th {
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  border-bottom: 2px solid var(--os-yellow);
  white-space: nowrap;
}

.os-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--os-border);
  color: var(--os-foreground);
  vertical-align: middle;
}

.os-table tbody tr:hover {
  background: var(--os-yellow-light);
}

.os-table tbody tr:last-child td {
  border-bottom: none;
}

.os-table .text-right {
  text-align: right;
}

.os-table .text-center {
  text-align: center;
}

.os-table .row-highlight {
  background: var(--os-yellow-light);
  font-weight: 500;
}

.os-table .row-totals td {
  font-weight: 700;
  border-top: 2px solid var(--os-border-strong);
  background: var(--os-bg);
}

/* ---------- Totales ---------- */
.os-totales {
  background: var(--os-black);
  color: var(--os-white);
  border-radius: var(--os-radius-lg);
  padding: 14px 20px;
  margin-top: 16px;
  box-shadow: var(--os-shadow);
}

.os-totales-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--os-yellow);
  margin-bottom: 8px;
}

.os-totales-title span:first-child {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--os-yellow);
}

.os-totales-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 12px;
}

.os-totales-grid .muted {
  color: rgba(255,255,255,.55);
  font-weight: 400;
}

.os-totales-grid .font-medium {
  font-weight: 500;
  color: var(--os-white);
}

.os-totales-grid .bold {
  font-weight: 700;
  color: var(--os-yellow);
  font-size: 13px;
}

/* ---------- Footer Legend ---------- */
.os-footer-legend {
  margin-top: 8px;
  font-size: 11px;
  color: var(--os-muted-foreground);
  text-align: center;
}

/* Contenedor para totales + botón descargar en la misma fila */
.os-totales-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- Action Bar ---------- */
.os-actionbar {
  display: flex;
  justify-content: flex-end;
  padding: 0;
  gap: 8px;
}

.os-actionbar .os-btn {
  background: var(--os-yellow);
  color: var(--os-black);
  padding: 9px 20px;
  font-size: 12px;
  border-radius: var(--os-radius);
  box-shadow: var(--os-shadow-sm);
}

.os-actionbar .os-btn:hover {
  background: var(--os-yellow-hover);
  box-shadow: 0 4px 12px rgba(245, 197, 24, .4);
}

.os-actionbar .icon-blue {
  color: var(--os-black);
}

/* ---------- Utility ---------- */
.muted {
  color: var(--os-muted-foreground);
}

.bold {
  font-weight: 700;
}

.font-medium {
  font-weight: 500;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.flex-1 {
  flex: 1;
}

.min-w-100 {
  min-width: 100px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .os-tab-general {
    flex-direction: column;
  }
  .os-sidebar-left {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .os-sidebar-left .os-fieldset {
    flex: 1;
    min-width: 180px;
  }
  .os-header {
    flex-direction: column;
    align-items: flex-start;
    border-radius: var(--os-radius);
  }
  .os-totales {
    border-radius: var(--os-radius);
  }
  .os-field-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .os-value {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .os-shell {
    padding: 0 8px 12px;
  }
  .os-totales-grid {
    flex-direction: column;
    gap: 4px;
  }
}