:root {
  --font-sans: system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font: 14px/1.55 var(--font-sans);
  color: #162a22;
  background-color: #f3f6f4;
  
  /* Paleta Patagonia B2B */
  --green: #115e46;
  --green-hover: #0d4a37;
  --green-light: #e6f4ed;
  --green-glow: rgba(17, 94, 70, 0.22);
  --cyan: #0284c7;
  --cyan-light: #e0f2fe;
  --muted: #4e6357;
  --muted-light: #7b9185;
  --line: rgba(22, 60, 48, 0.12);
  --line-strong: rgba(22, 60, 48, 0.22);
  --red: #b91c1c;
  --red-light: #fee2e2;
  --amber: #b45309;
  --amber-light: #fef3c7;
  --orange: #c2410c;
  --orange-light: #ffedd5;
  
  /* Glassmorphism & Superficies */
  --surface-glass: rgba(255, 255, 255, 0.82);
  --surface-glass-card: rgba(255, 255, 255, 0.88);
  --surface-glass-modal: rgba(255, 255, 255, 0.96);
  --blur-base: 18px;
  --blur-deep: 24px;
  --border-glass: rgba(255, 255, 255, 0.85);
  
  /* Elevación y sombras */
  --shadow-sm: 0 1px 3px rgba(18, 48, 38, 0.05);
  --shadow-md: 0 4px 16px -2px rgba(18, 48, 38, 0.08), 0 2px 6px -1px rgba(18, 48, 38, 0.04);
  --shadow-lg: 0 12px 32px -4px rgba(18, 48, 38, 0.12), 0 4px 12px -2px rgba(18, 48, 38, 0.06);
  --shadow-glow: 0 0 20px rgba(17, 94, 70, 0.25);
  
  /* Curvas de animación elásticas y fluidas */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: #162a22;
  background: 
    radial-gradient(at 0% 0%, rgba(195, 230, 215, 0.5) 0px, transparent 55%),
    radial-gradient(at 100% 0%, rgba(205, 233, 246, 0.45) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(226, 240, 232, 0.6) 0px, transparent 60%),
    #f3f6f4;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Control base y tipografía */
button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--green);
  text-decoration: none;
  transition: color 150ms var(--ease-smooth);
}

a:hover {
  color: var(--green-hover);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

:is(button, a, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid #0284c7;
  outline-offset: 2px;
}

button, a {
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 140ms var(--ease), box-shadow 160ms var(--ease);
}

button:active {
  transform: scale(0.975);
}

svg {
  width: 18px;
  height: 18px;
  flex: none;
  vertical-align: middle;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  font-size: 27px;
  line-height: 1.25;
  letter-spacing: -0.035em;
  font-weight: 750;
  margin-bottom: 6px;
  color: #0f231b;
}

h2 {
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin-bottom: 14px;
  color: #132d23;
}

h3 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: #16362a;
}

small, .muted {
  font-size: 12px;
  color: var(--muted);
}

small {
  display: block;
}

strong {
  font-weight: 650;
}

.skip {
  position: fixed;
  top: 10px;
  left: 10px;
  transform: translateY(-200%);
  z-index: 100;
  background: #ffffff;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
}

.skip:focus {
  transform: none;
}

/* Sidebar moderna con efecto Glassmorphism */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: var(--surface-glass);
  backdrop-filter: blur(var(--blur-deep)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-deep)) saturate(180%);
  border-right: 1px solid var(--line);
  box-shadow: 2px 0 24px -4px rgba(18, 48, 38, 0.04);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 750;
  color: #0f231b;
  letter-spacing: -0.02em;
}

.brand small {
  font-weight: 450;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #10b981 0%, #0d5c46 55%, #064232 100%);
  color: white;
  border-radius: 11px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 4px 12px rgba(13, 92, 70, 0.28);
  font-weight: 800;
  font-size: 18px;
}

.sidebar nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #3b5347;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 160ms var(--ease);
}

.nav-item:hover {
  background: rgba(17, 94, 70, 0.06);
  color: #0d4a37;
  transform: translateX(3px);
}

.nav-item[aria-current=page] {
  background: linear-gradient(90deg, rgba(17, 94, 70, 0.12) 0%, rgba(2, 132, 199, 0.06) 100%);
  color: #0a4433;
  font-weight: 700;
  border-left: 3px solid #115e46;
  border-color: rgba(17, 94, 70, 0.12) rgba(17, 94, 70, 0.12) rgba(17, 94, 70, 0.12) #115e46;
  box-shadow: 0 2px 8px rgba(17, 94, 70, 0.06);
  transform: none;
}

.nav-caption {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-light);
  margin: 18px 12px 6px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.storage-note {
  font-size: 11.5px;
  margin: auto 8px 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(22, 60, 48, 0.04);
  border: 1px solid rgba(22, 60, 48, 0.06);
  color: var(--muted);
  line-height: 1.4;
}

.storage-note small {
  font-size: 11px;
  margin-top: 2px;
  color: var(--muted-light);
}

/* Área de trabajo y cabecera superior */
.workspace {
  margin-left: 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 64px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface-glass);
  backdrop-filter: blur(var(--blur-deep)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-deep)) saturate(180%);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12.5px;
}

.topbar nav a {
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 550;
  transition: all 140ms ease;
}

.topbar nav a:hover {
  background: rgba(17, 94, 70, 0.08);
  color: var(--green);
}

.topbar nav [aria-current=page] {
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(17, 94, 70, 0.1);
  color: var(--green);
  font-weight: 650;
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  padding: 5px 12px;
  border-radius: 9999px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  align-self: center;
}

.local-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

main {
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 32px 84px;
  min-width: 0;
  animation: pageIn 240ms var(--ease) forwards;
}

main:focus, main:focus-visible {
  outline: none;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-head p {
  color: var(--muted);
  margin: 0;
  font-size: 13.5px;
}

.eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 750;
  color: var(--green);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--green-light);
  padding: 3px 8px;
  border-radius: 5px;
}

/* Botones refinados */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  color: #1d362b;
  font-size: 13px;
  font-weight: 650;
  box-shadow: var(--shadow-sm);
  transition: all 160ms var(--ease);
}

.button:hover {
  background: #ffffff;
  border-color: rgba(17, 94, 70, 0.35);
  box-shadow: 0 4px 12px rgba(18, 48, 38, 0.08);
  transform: translateY(-1.5px);
}

.button.primary {
  background: linear-gradient(135deg, #13694f 0%, #0d503b 100%);
  color: #ffffff;
  border-color: #0d503b;
  box-shadow: 0 2px 8px rgba(17, 94, 70, 0.28);
}

.button.primary:hover {
  background: linear-gradient(135deg, #177a5b 0%, #105c44 100%);
  box-shadow: 0 6px 18px rgba(17, 94, 70, 0.38);
  transform: translateY(-1.5px);
}

.button.danger {
  color: var(--red);
  background: rgba(254, 242, 242, 0.85);
  border-color: #fca5a5;
}

.button.danger:hover {
  background: #fef2f2;
  border-color: var(--red);
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.15);
}

.button.quiet {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}

.button.quiet:hover {
  background: rgba(17, 94, 70, 0.06);
  color: var(--green);
  transform: none;
}

.button.icon {
  padding: 10px;
  min-width: 44px;
}

/* Paneles de cristal (Glassmorphic Panels) */
.panel {
  background: var(--surface-glass-card);
  backdrop-filter: blur(var(--blur-base));
  -webkit-backdrop-filter: blur(var(--blur-base));
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  margin-bottom: 22px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: box-shadow 200ms var(--ease), border-color 200ms var(--ease);
}

.panel:hover {
  border-color: rgba(255, 255, 255, 1);
  box-shadow: var(--shadow-lg);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-heading h2 {
  margin: 0;
}

/* Métricas destacadas */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.metric {
  border: 1px solid var(--border-glass);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(246, 251, 248, 0.82));
  backdrop-filter: blur(12px);
  border-radius: 11px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), border-color 180ms var(--ease);
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(17, 94, 70, 0.2);
}

.metric span {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
  color: #0f2d22;
}

.metric.warning {
  border-left: 4px solid var(--amber);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(254, 252, 243, 0.85));
}

.metric.warning strong {
  color: var(--amber);
}

.metric.danger {
  border-left: 4px solid var(--red);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(254, 242, 242, 0.85));
}

.metric.danger strong {
  color: var(--red);
}

/* Tarjetas de Empresa y Categorías */
.company-grid, .category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.company-card {
  display: block;
  background: var(--surface-glass-card);
  backdrop-filter: blur(var(--blur-base));
  -webkit-backdrop-filter: blur(var(--blur-base));
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 22px;
  color: inherit;
  box-shadow: var(--shadow-md);
  transition: all 220ms var(--ease);
  position: relative;
  overflow: hidden;
}

.company-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #0284c7);
  opacity: 0;
  transition: opacity 220ms ease;
}

.company-card:hover {
  transform: translateY(-4px);
  border-color: rgba(17, 94, 70, 0.35);
  box-shadow: 0 16px 36px -6px rgba(18, 48, 38, 0.14), 0 0 0 1px rgba(17, 94, 70, 0.2);
}

.company-card:hover::after {
  opacity: 1;
}

.company-card h2 {
  margin: 16px 0 4px;
  font-size: 19px;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 14px;
}

.meta b {
  display: block;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: #0f2d22;
}

.meta span {
  font-size: 11.5px;
  color: var(--muted);
}

.company-indicators {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.company-indicators strong {
  font-size: 12.5px;
  color: #1a382b;
}

.company-indicators small {
  margin-top: 3px;
  font-size: 11.5px;
}

.category-card {
  border: 1px solid var(--border-glass);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(246, 251, 248, 0.75));
  backdrop-filter: blur(12px);
  border-radius: 11px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease);
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.category-card h3 {
  margin: 0;
  font-size: 15px;
}

.category-card p {
  font-size: 13px;
  margin: 0;
  color: var(--muted);
}

.category-card .button {
  align-self: flex-start;
  margin-top: auto;
}

/* Alertas de áreas */
.area-alerts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 12px;
}

.area-alert {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(244, 248, 245, 0.8));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: all 180ms var(--ease);
  color: inherit;
  display: block;
}

.area-alert:hover {
  transform: translateY(-2px);
  border-color: rgba(17, 94, 70, 0.3);
  box-shadow: var(--shadow-md);
}

.area-alert strong {
  color: #123326;
  font-size: 13.5px;
}

.area-alert p {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* Tarjeta de Información Consolidada Ultra-Compacta */
.panel-consolidated {
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-consolidated .consolidated-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-consolidated .consolidated-top h2 {
  font-size: 12.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0;
}

.panel-consolidated .metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.panel-consolidated .metric {
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.panel-consolidated .metric span {
  font-size: 11px;
  font-weight: 600;
  margin: 0;
}

.panel-consolidated .metric strong {
  font-size: 20px;
  margin: 0;
  line-height: 1;
}

.panel-consolidated .consolidated-details {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 10px;
  align-items: stretch;
}

.panel-consolidated .area-alerts,
.panel-consolidated .category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 8px;
  margin: 0;
}

.panel-consolidated .area-alert {
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: auto;
}

.panel-consolidated .area-alert strong {
  font-size: 12px;
  line-height: 1.25;
}

.panel-consolidated .area-alert p {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
}

.panel-consolidated .category-card {
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: auto;
}

.panel-consolidated .category-card h3 {
  font-size: 12px;
  margin: 0;
}

.panel-consolidated .category-card p {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--green);
  margin: 0;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .panel-consolidated .consolidated-details {
    grid-template-columns: 1fr;
  }
}

/* Pestañas de categorías (Tabs de navegación modernas) */
.company-areas {
  min-width: 0;
}

.company-tabs {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  background: rgba(22, 60, 48, 0.05);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 22px;
  scrollbar-width: thin;
}

.company-tabs [role=tab] {
  flex: none;
  max-width: 340px;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 13px;
  font-weight: 650;
  transition: all 180ms var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.company-tabs [role=tab]:hover {
  color: var(--green);
  background: rgba(255, 255, 255, 0.6);
}

.company-tabs [aria-selected=true] {
  color: #0b4c37;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(18, 48, 38, 0.08);
  font-weight: 750;
}

.category-content {
  min-width: 0;
  animation: pageIn 200ms var(--ease) forwards;
}

.category-content > .page-head h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.category-functions {
  white-space: pre-wrap;
  line-height: 1.6;
}

.category-content > .page-head .eyebrow {
  display: none;
}

/* Barra de herramientas y filtros */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.toolbar .field {
  flex: 1;
  min-width: 180px;
}

/* Campos de Formulario */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field label {
  font-size: 13px;
  font-weight: 650;
  color: #19382b;
}

.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #94a89c;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.95);
  color: #12281f;
  padding: 10px 14px;
  font-size: 13.5px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
  outline: none;
  background: #ffffff;
}

.field textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

.field [aria-invalid=true] {
  border-color: var(--red);
  background-color: #fff8f8;
}

.error-text {
  font-size: 12px;
  color: var(--red);
  font-weight: 550;
}

.error-summary {
  padding: 14px 18px;
  background: rgba(254, 242, 242, 0.95);
  color: #7f1d1d;
  border: 1px solid #fecaca;
  border-left: 4px solid var(--red);
  border-radius: 10px;
  margin-bottom: 18px;
}

.error-summary a {
  color: #991b1b;
  text-decoration: underline;
  font-weight: 600;
}

.error-summary:empty {
  display: none;
}

.empty {
  padding: 44px 24px;
  text-align: center;
  background: rgba(250, 252, 250, 0.7);
  border: 2px dashed #b8c9bf;
  border-radius: 12px;
}

.empty h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

/* Tablas con acabado de cristal y filas suaves */
.table-wrap {
  max-height: 65vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  table-layout: fixed;
}

th {
  position: sticky;
  top: 0;
  background: rgba(239, 246, 242, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 2;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #274b3a;
  border-bottom: 1px solid var(--line-strong);
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}

tbody tr {
  transition: background-color 140ms ease;
}

tbody tr:hover {
  background-color: rgba(17, 94, 70, 0.04);
}

tr:last-child td {
  border-bottom: 0;
}

td strong {
  color: #123326;
  font-size: 13.5px;
}

td small {
  margin-top: 4px;
  line-height: 1.4;
}

td details {
  margin-top: 10px;
}

summary {
  cursor: pointer;
  color: var(--green);
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 650;
  user-select: none;
}

summary::before {
  content: '›';
  font-size: 18px;
  line-height: 1;
  margin-right: 8px;
  font-weight: bold;
  transition: transform 180ms ease;
  display: inline-block;
}

details[open] > summary::before {
  content: '›';
  transform: rotate(90deg);
}

dl {
  margin: 12px 0 16px;
  display: grid;
  gap: 10px;
  background: rgba(22, 60, 48, 0.03);
  padding: 14px;
  border-radius: 9px;
  border: 1px solid rgba(22, 60, 48, 0.06);
}

dt {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--muted);
}

dd {
  margin: 2px 0 0;
  white-space: pre-wrap;
  font-size: 13px;
  color: #19382b;
}

/* Badges y Pills */
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--green-light);
  color: #0d503b;
  border: 1px solid rgba(17, 94, 70, 0.18);
  letter-spacing: 0.02em;
}

.pill.amber {
  background: var(--amber-light);
  color: #78350f;
  border-color: rgba(180, 83, 9, 0.25);
}

.pill.orange {
  background: var(--orange-light);
  color: #9a3412;
  border-color: rgba(194, 65, 12, 0.25);
}

.pill.red {
  background: var(--red-light);
  color: #991b1b;
  border-color: rgba(185, 28, 28, 0.25);
}

.pill.neutral {
  background: #edf2f0;
  color: #4b6357;
  border-color: rgba(75, 99, 87, 0.2);
}

/* Estado de Guardado (Save Status) flotante y translúcido */
.save-status {
  position: fixed;
  bottom: 0;
  left: 240px;
  right: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 10px 32px;
  min-height: 40px;
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
  z-index: 15;
  display: flex;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.save-status.error {
  background: rgba(254, 242, 242, 0.95);
  color: var(--red);
}

/* Toast flotante moderno */
.toast {
  position: fixed;
  bottom: 56px;
  left: 50%;
  max-width: 90vw;
  background: rgba(13, 38, 29, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  padding: 12px 22px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 32px rgba(9, 26, 20, 0.35);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
  z-index: 50;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Diálogos y Modales */
dialog {
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 0;
  max-height: 90dvh;
  width: min(780px, calc(100% - 32px));
  color: inherit;
  background: var(--surface-glass-modal);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 25px 70px -10px rgba(10, 35, 25, 0.35), 0 10px 20px -5px rgba(10, 35, 25, 0.1);
}

dialog::backdrop {
  background: rgba(10, 26, 20, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

dialog[open] {
  animation: dialog-in 220ms var(--ease);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dialog-header {
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 255, 255, 0.5);
}

.dialog-header h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-header p {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.dialog-body {
  padding: 24px 26px;
}

.steps {
  display: flex;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

.steps li {
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 7px;
  background: rgba(22, 60, 48, 0.05);
  color: var(--muted);
  font-weight: 600;
  transition: all 160ms ease;
}

.steps [aria-current=step] {
  background: var(--green-light);
  color: #0b4c37;
  font-weight: 750;
  box-shadow: 0 1px 4px rgba(17, 94, 70, 0.12);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field.wide {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
}

.step-section {
  border: 0;
  padding: 0;
  margin: 0;
}

.step-section legend {
  font-size: 16px;
  font-weight: 750;
  margin-bottom: 16px;
  color: #123326;
}

/* Calendario y Trabajo Diario */
.cal-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.cal-controls h2 {
  margin: 0;
  text-transform: capitalize;
  font-size: 20px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-strong);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
}

.dow {
  background: rgba(239, 246, 242, 0.95);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 0;
  color: #274b3a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day {
  border: 0;
  background: #ffffff;
  min-width: 0;
  min-height: 72px;
  text-align: left;
  padding: 10px;
  color: inherit;
  transition: background-color 140ms ease, box-shadow 140ms ease;
  font-size: 13px;
  font-weight: 600;
}

.day:hover:not(:disabled) {
  background: rgba(17, 94, 70, 0.05);
}

.day[aria-pressed=true] {
  box-shadow: inset 0 0 0 2px var(--green), 0 2px 10px rgba(17, 94, 70, 0.15);
  background: #eaf4ef;
  font-weight: 750;
}

.day:disabled {
  background: #f7f9f7;
  opacity: 1;
  cursor: default;
  color: #8c9e94;
}

.day small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-top: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--green-light);
  color: var(--green);
  font-weight: 650;
}

.agenda-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  transition: background-color 140ms ease;
}

.agenda-row:last-child {
  border-bottom: 0;
}

.agenda-row p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  display: flex;
  gap: 4px;
  background: rgba(22, 60, 48, 0.06);
  padding: 4px;
  border-radius: 10px;
}

.segmented .button {
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  box-shadow: none;
  border-radius: 8px;
}

.segmented [aria-pressed=true] {
  background: #ffffff;
  color: var(--green);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

#confirm {
  padding: 26px;
  width: min(480px, calc(100% - 32px));
}

#confirm .actions {
  border-top: 0;
  margin-top: 10px;
  padding-top: 10px;
}

[hidden] {
  display: none !important;
}

.risk-preview {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(17, 94, 70, 0.06);
  border: 1px solid rgba(17, 94, 70, 0.15);
  border-radius: 9px;
  font-size: 13.5px;
}

/* Accesibilidad y Teclado */
body.keyboard *, body.keyboard dialog[open] {
  animation: none !important;
  transition: none !important;
}

body.keyboard button:active {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-property: opacity, background-color, color !important;
    transition-duration: 80ms !important;
    scroll-behavior: auto !important;
  }
  button:active {
    transform: none;
  }
  .toast, .toast.show {
    transform: translateX(-50%);
  }
}

/* Responsive Breakpoints */
@media (max-width: 1100px) {
  .sidebar {
    width: 210px;
  }
  .workspace {
    margin-left: 210px;
  }
  .save-status {
    left: 210px;
  }
  main {
    padding: 24px 20px 80px;
  }
  .topbar {
    padding: 12px 20px;
  }
  .secondary-column {
    display: none;
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
    gap: 12px;
  }
  .sidebar nav {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding: 3px;
    scrollbar-width: none;
  }
  .sidebar nav::-webkit-scrollbar {
    display: none;
  }
  .nav-item {
    white-space: nowrap;
    flex: none;
  }
  .nav-caption, .storage-note {
    display: none;
  }
  .brand {
    font-size: 16px;
  }
  .brand small {
    display: none;
  }
  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }
  .workspace {
    margin-left: 0;
  }
  .topbar {
    min-height: 48px;
    padding: 10px 16px;
  }
  .local-badge {
    display: none;
  }
  main {
    padding: 20px 16px 72px;
  }
  .save-status {
    left: 0;
    padding: 10px 16px;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }
  h1 {
    font-size: 24px;
  }
  .panel {
    padding: 18px 16px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .metric {
    padding: 12px;
  }
  .metric strong {
    font-size: 24px;
  }
  .panel-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  table, tbody, tr, td {
    display: block;
    width: 100%;
  }
  thead {
    display: none;
  }
  tr {
    border: 1px solid var(--line);
    background: var(--surface-glass-card);
    border-radius: 10px;
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }
  td {
    border: 0;
    padding: 10px 14px;
  }
  td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 4px;
  }
  .secondary-column {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .dialog-header, .dialog-body {
    padding: 18px 16px;
  }
  .toolbar .field {
    min-width: 100%;
  }
  .day {
    min-height: 48px;
    padding: 6px;
    text-align: center;
  }
  .day .event-name {
    display: none;
  }
  .agenda-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .topbar nav {
    overflow-wrap: anywhere;
  }
  input, select, textarea {
    font-size: 16px !important;
  }
}
