/* =============================================================================
   MSOFT SERVICE 360 — sistema de diseño
   Marca MSOFT: verde #8DC63F para acción y estado activo; neutros para estructura.
   Tema claro por defecto; oscuro opcional con :root[data-theme="dark"].
   Regla: ningún color suelto fuera de los tokens de :root.
   Espaciado compacto: separación base de 4px.
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800&display=swap');
@import url('../assets/fonts.css');

:root {
  /* Marca MSOFT */
  --green: #8DC63F;
  --green-2: #9ed654;
  --green-3: #a8d86a;
  --green-dark: #72a832;
  --green-darker: #5a8520;
  --green-ink: #0f1a05;
  --green-light: #eef8e0;
  --green-soft: rgba(141, 198, 63, .14);
  --green-ring: rgba(141, 198, 63, .22);
  --grad-btn: linear-gradient(135deg, #72a832, #8DC63F 55%, #9ed654);
  --grad-bar: linear-gradient(90deg, #8DC63F, #a8d86a, #72a832);

  /* Menú lateral (siempre oscuro, grafito con tinte verde) */
  --side-1: #1a2412;
  --side-2: #121a0d;
  --side-3: #0b1008;
  --side-text: #dfe8d6;
  --side-muted: #8f9c86;
  --side-line: rgba(255, 255, 255, .07);
  --side-hover: rgba(255, 255, 255, .06);

  /* Área de trabajo — claro */
  --bg: #f3f6f0;
  --bg-wash: radial-gradient(1200px 260px at 70% -120px, rgba(141, 198, 63, .22), transparent 70%);
  --card: #ffffff;
  --paper: #ffffff;  /* papel de la firma: blanco también en tema oscuro */
  --card-2: #f8faf6;
  --line: #e5eadf;
  --line-strong: #d3dbcb;
  --text: #17201a;
  --muted: #5d6960;
  --faint: #98a29a;
  --hover: #f0f4ec;
  --overlay: rgba(12, 18, 10, .42);

  /* Semánticos */
  --ok-bg: #edf7df;    --ok-ink: #3f6a12;
  --warn-bg: #fff4e0;  --warn-ink: #9a5b00;  --warn: #f59e0b;
  --bad-bg: #fdecec;   --bad-ink: #b42318;   --bad: #ef4444;
  --info-bg: #e8f1fd;  --info-ink: #1d5fb8;  --info: #3b82f6;
  --off-bg: #eff2ec;   --off-ink: #626d64;
  --lila-bg: #f1edfb;  --lila-ink: #5b43a8;

  /* Etapas del flujo (columnas Kanban) */
  --st-1: #e9f1fb; --st-1-ink: #2a5a9b;
  --st-2: #f1edfb; --st-2-ink: #5b43a8;
  --st-3: #fdf2dc; --st-3-ink: #9a5b00;
  --st-4: #e6f0fb; --st-4-ink: #1d5fb8;
  --st-5: #e9f6dc; --st-5-ink: #3f6a12;

  --shadow-sm: 0 1px 2px rgba(20, 30, 15, .05);
  --shadow: 0 1px 2px rgba(20, 30, 15, .04), 0 8px 24px rgba(20, 30, 15, .06);
  --shadow-lg: 0 24px 60px rgba(10, 20, 5, .22);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --gap: 4px;

  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-brand: 'Montserrat', 'Inter', sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0f09;
  --bg-wash: radial-gradient(1200px 260px at 70% -120px, rgba(141, 198, 63, .10), transparent 70%);
  --card: #141a11;
  --card-2: #182014;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .14);
  --text: #eef3ea;
  --muted: #a9b5a3;
  --faint: #76836f;
  --hover: rgba(255, 255, 255, .04);
  --overlay: rgba(0, 0, 0, .6);
  --green-light: rgba(141, 198, 63, .12);

  --ok-bg: rgba(141, 198, 63, .14);   --ok-ink: #b5e07c;
  --warn-bg: rgba(245, 158, 11, .14); --warn-ink: #fbbf5a;
  --bad-bg: rgba(239, 68, 68, .14);   --bad-ink: #fca5a5;
  --info-bg: rgba(59, 130, 246, .16); --info-ink: #93c5fd;
  --off-bg: rgba(255, 255, 255, .06); --off-ink: #a9b5a3;
  --lila-bg: rgba(139, 110, 230, .16); --lila-ink: #c4b5fd;

  --st-1: rgba(59, 130, 246, .12);  --st-1-ink: #93c5fd;
  --st-2: rgba(139, 110, 230, .14); --st-2-ink: #c4b5fd;
  --st-3: rgba(245, 158, 11, .13);  --st-3-ink: #fbbf5a;
  --st-4: rgba(59, 130, 246, .10);  --st-4-ink: #93c5fd;
  --st-5: rgba(141, 198, 63, .13);  --st-5-ink: #b5e07c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  background: var(--bg-wash), var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.link { color: var(--green-darker); font-weight: 600; cursor: pointer; background: none; border: 0; padding: 0; }
:root[data-theme="dark"] .link { color: var(--green-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
svg { flex: none; }

/* ---------- Marco: menú + área principal ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
/* Mientras arranca, antes de dibujar el menú, se reserva su columna: el contenido no se aprieta ni salta */
.app:not([data-shell])::before { content: ""; position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, var(--side-1), var(--side-2) 55%, var(--side-3)); }
.main { display: flex; flex-direction: column; min-width: 0; }
.content { padding: 4px 12px 16px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.content > * { min-width: 0; }

.side {
  position: sticky; top: 0; height: 100vh; z-index: 30;
  display: flex; flex-direction: column;
  color: var(--side-text);
  background:
    radial-gradient(360px 260px at 0% 0%, rgba(141, 198, 63, .16), transparent 70%),
    linear-gradient(180deg, var(--side-1), var(--side-2) 55%, var(--side-3));
  border-right: 1px solid var(--side-line);
}
.side-brand { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.side-brand .logo { font-family: var(--font-brand); font-weight: 800; font-size: 21px; letter-spacing: -.02em; color: #fff; line-height: 1; }
.side-brand .logo b { color: var(--green); font-weight: 800; }
/* Nombre de la empresa bajo el logo: bien visible */
.side-brand small { display: block; color: #fff; font-size: 19px; line-height: 1.15; margin-top: 2px; font-weight: 500; }
.side-toggle { margin-left: auto; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
/* Grupos del menú: el encabezado pliega y despliega sus pantallas */
.nav-group {
  display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; cursor: pointer; text-align: left;
  font: inherit; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted);
  padding: 12px 8px 4px; border-radius: 7px;
}
.nav-group:hover { color: var(--side-text); }
.nav-group svg { margin-left: auto; transition: transform .18s ease; opacity: .7; }
.nav-sec.shut .nav-group svg { transform: rotate(-90deg); }
.nav-sec.shut.current .nav-group { color: var(--green-3); }
.nav-items { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .2s ease; }
.nav-items > div { overflow: hidden; }
.nav-sec.shut .nav-items { grid-template-rows: 0fr; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 10px; margin-bottom: 1px;
  border-radius: 9px; color: var(--side-text); font-weight: 500; font-size: 13px;
  position: relative;
}
.nav a svg { color: var(--green-3); opacity: .9; }
.nav a > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a:hover { background: var(--side-hover); }
.nav a.active { background: var(--grad-btn); color: var(--green-ink); font-weight: 700; box-shadow: 0 6px 16px rgba(141, 198, 63, .28); }
.nav a.active svg { color: var(--green-ink); opacity: 1; }
.nav a.soon { opacity: .55; cursor: default; }
.nav a.soon:hover { background: none; }
.nav a .soon-tag { flex: none; font-style: normal; font-size: 8.5px; font-weight: 700; letter-spacing: .06em; color: var(--side-muted); border: 1px solid var(--side-line); border-radius: 5px; padding: 1px 4px; }
.side-foot { padding: 10px 14px 12px; border-top: 1px solid var(--side-line); font-size: 11px; color: var(--side-muted); display: flex; align-items: center; gap: 6px; }
.side-foot img { width: 18px; height: 18px; border-radius: 4px; }

@media (min-width: 981px) {
  .app { transition: grid-template-columns .18s ease; }
  .app.collapsed { grid-template-columns: 68px minmax(0, 1fr); }
  .app.collapsed .side-brand small, .app.collapsed .side-brand .logo, .app.collapsed .nav-group,
  .app.collapsed .nav a > span, .app.collapsed .soon-tag, .app.collapsed .side-foot span { display: none; }
  .app.collapsed .side-brand { justify-content: center; }
  .app.collapsed .side-brand .logo-mini { display: grid; }
  .app.collapsed .nav a { justify-content: center; padding: 0; }
  .app.collapsed .nav-sec.shut .nav-items { grid-template-rows: 1fr; }
}
.logo-mini { display: none; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: var(--green-soft); color: var(--green); font-family: var(--font-brand); font-weight: 800; font-size: 12px; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  /* Barra propia: se distingue del contenido (fondo de tarjeta, borde, sombra y línea de marca) */
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.topbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--grad-bar); }
.search {
  flex: 1; min-width: 0; max-width: 460px;
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  color: var(--faint); cursor: text; box-shadow: var(--shadow-sm);
}
.search > span:not(.kbd) { flex: 1; font-size: 12.5px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kbd { font-size: 10.5px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: var(--card-2); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  position: relative; width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--card); border-color: var(--line); color: var(--text); }
.icon-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border-radius: 12px; border: 1px solid transparent; background: none; cursor: pointer; text-align: left; }
.user-chip:hover { background: var(--card); border-color: var(--line); }
.user-chip b { display: block; font-size: 12.5px; }
.user-chip small { display: block; font-size: 11px; color: var(--muted); }

.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green-darker); font-weight: 700; font-size: 12px; flex: none; overflow: hidden; }
:root[data-theme="dark"] .avatar { color: var(--green-3); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.menu-pop {
  position: absolute; z-index: 60; min-width: 220px; padding: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.menu-pop button, .menu-pop a { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-size: 13px; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--hover); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-pop .head { padding: 8px 10px; }
.menu-pop .head small { display: block; color: var(--muted); }

/* ---------- Encabezado de página ---------- */
.page-head { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; padding: 4px 2px 2px; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.crumbs { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.crumbs a:hover { color: var(--text); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn-primary { background: var(--grad-btn); border-color: transparent; color: var(--green-ink); box-shadow: 0 6px 18px rgba(141, 198, 63, .32); }
.btn-primary:hover { background: var(--grad-btn); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(141, 198, 63, .42); }
.btn-soft { background: var(--green-light); border-color: transparent; color: var(--green-darker); }
:root[data-theme="dark"] .btn-soft { color: var(--green-3); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: var(--bad); border-color: transparent; color: #fff; }
.btn-danger:hover { background: var(--bad); filter: brightness(1.05); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14px; border-radius: 11px; }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.field > span small { font-weight: 400; color: var(--faint); }
.field > span .req { color: var(--bad); }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 10px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 9px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-ring); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input-ic { position: relative; }
.input-ic > svg, .input-ic > [data-ic] { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; display: grid; z-index: 1; }
.input-ic > .input, .input-ic > .select { padding-left: 34px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.span-2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--green); }
.form-error { display: none; padding: 8px 10px; border-radius: 9px; background: var(--bad-bg); color: var(--bad-ink); font-size: 12.5px; }
.form-error.show { display: block; }

/* Selector segmentado (Kanban / Lista / Calendario, Mañana / Tarde…) */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; white-space: nowrap; height: 28px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-weight: 600; font-size: 12px; cursor: pointer; }
.seg button.on { background: var(--grad-btn); color: var(--green-ink); box-shadow: 0 3px 10px rgba(141, 198, 63, .3); }

/* ---------- Tarjetas y paneles ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 10px; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; font-weight: 700; }
.panel-head h3 { font-size: 13px; font-weight: 700; }
.panel-head p { font-size: 11.5px; color: var(--muted); }
.panel-head .end { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.section-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--grad-btn); color: var(--green-ink); flex: none; }

/* KPI */
.kpi { display: flex; gap: 8px; align-items: center; padding: 10px; min-width: 0; }
.kpi-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; color: #fff; }
.kpi-ic.green { background: var(--grad-btn); color: var(--green-ink); }
.kpi-ic.amber { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.kpi-ic.red { background: linear-gradient(135deg, #dc2626, #ef4444); }
.kpi-ic.blue { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.kpi-ic.teal { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.kpi small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.kpi strong { display: block; font-size: clamp(15px, 1.25vw, 22px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; }
.kpi .kpi-sub { font-size: 11px; color: var(--muted); }
.trend { font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; }
.trend.up { color: var(--ok-ink); }
.trend.down { color: var(--bad-ink); }

/* Insignias */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; background: var(--off-bg); color: var(--off-ink); }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.bad { background: var(--bad-bg); color: var(--bad-ink); }
.badge.info { background: var(--info-bg); color: var(--info-ink); }
.badge.lila { background: var(--lila-bg); color: var(--lila-ink); }
.badge.soft { text-transform: none; letter-spacing: 0; font-weight: 600; }
.pill-demo { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--green-light); color: var(--green-darker); border: 1px solid var(--green-ring); }

/* Barra de progreso */
.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--grad-bar); }
.progress.amber > i { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress.blue > i { background: linear-gradient(90deg, #2563eb, #60a5fa); }

/* Pestañas */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--green-darker); border-bottom-color: var(--green); }
:root[data-theme="dark"] .tabs button.on { color: var(--green-3); }

/* Tablas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--card-2); white-space: nowrap; }
.table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--hover); }
.table .r { text-align: right; }
.kv { display: grid; grid-template-columns: minmax(90px, 40%) 1fr; font-size: 12.5px; }
.kv > * { padding: 5px 8px; border-bottom: 1px solid var(--line); }
.kv > dt { color: var(--muted); background: var(--card-2); margin: 0; }
.kv > dd { margin: 0; font-weight: 500; }

/* Pasos (stepper) */
.stepper { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 12px; font-weight: 600; }
.step i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; background: var(--line); color: var(--muted); }
.step.on { color: var(--text); }
.step.on i { background: var(--grad-btn); color: var(--green-ink); box-shadow: 0 4px 12px rgba(141, 198, 63, .35); }
.step.done i { background: var(--green-light); color: var(--green-darker); }
.step-sep { width: 28px; height: 1px; background: var(--line-strong); }

/* Línea de tiempo */
.timeline { display: grid; gap: 2px; }
.tl-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 4px 0; font-size: 12.5px; }
.tl-dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--muted); }
.tl-row.done .tl-dot { background: var(--green); color: var(--green-ink); }
.tl-row.current .tl-dot { background: var(--card); color: var(--green); box-shadow: 0 0 0 2px var(--green) inset; }
.tl-row b { font-weight: 600; }
.tl-row small { color: var(--muted); font-size: 11.5px; }

/* Vacío, error y carga */
.empty { display: grid; justify-items: center; gap: 6px; padding: 22px 12px; text-align: center; color: var(--muted); }
.empty .empty-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--green-light); color: var(--green-darker); }
.empty b { color: var(--text); font-size: 13.5px; }
.empty p { font-size: 12.5px; max-width: 360px; }
.skeleton { position: relative; overflow: hidden; background: var(--line); border-radius: 8px; min-height: 12px; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent); animation: s360-shimmer 1.2s infinite; }
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); }
@keyframes s360-shimmer { to { transform: translateX(100%); } }
/* Refresco silencioso: sin parpadeo de contenido mientras se vuelve a dibujar. */
.refresco-silencioso * { transition: none !important; animation: none !important; }

/* ---------- Modal lateral y confirmación centrada ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: flex-end; visibility: hidden; pointer-events: none; }
.modal.open { visibility: visible; pointer-events: auto; }
.modal-back { position: absolute; inset: 0; background: var(--overlay); opacity: 0; transition: opacity .2s ease; }
.modal.open .modal-back { opacity: 1; }
.modal-box {
  position: relative; display: flex; flex-direction: column;
  width: min(640px, 100%); height: 100%;
  background: var(--card); border-left: 1px solid var(--line);
  border-radius: 18px 0 0 18px; box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.modal.open .modal-box { transform: none; }
.modal-box::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--grad-bar); border-radius: 18px 0 0 0; }
.modal-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
.modal-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green-darker); }
:root[data-theme="dark"] .modal-kicker { color: var(--green-3); }
.modal-head h2 { font-size: 18px; font-weight: 800; margin-top: 2px; }
.modal-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.modal-body { flex: 1; overflow-y: auto; padding: 12px 16px; display: grid; gap: 8px; align-content: start; }
.modal-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--card-2); }
.modal-foot .spacer { flex: 1; }
.x-btn { margin-left: auto; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; flex: none; }
.x-btn:hover { color: var(--text); background: var(--hover); }
.form-group { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 8px; background: var(--card); }
.form-group > h4 { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 6px; }

.modal.centro { justify-content: center; align-items: center; }
.modal.centro .modal-box { width: min(440px, calc(100% - 24px)); height: auto; max-height: 90vh; border-radius: 18px; border: 1px solid var(--line); transform: scale(.96); opacity: 0; transition: transform .18s ease, opacity .18s ease; }
.modal.centro.open .modal-box { transform: none; opacity: 1; }
.modal.centro .modal-box::before { border-radius: 18px 18px 0 0; }
.modal.centro .modal-head { border-bottom: 0; padding-bottom: 0; }
.modal.centro .modal-foot { border-top: 0; background: none; }
.confirm-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin: 18px 16px 0; background: var(--green-light); color: var(--green-darker); }
.modal.peligro .confirm-ic { background: var(--bad-bg); color: var(--bad-ink); }
.modal.peligro .modal-box::before { background: var(--bad); }

/* ---------- Avisos (toast) ---------- */
.toast-stack { position: fixed; right: 14px; bottom: 14px; z-index: 120; display: grid; gap: 6px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; min-width: 240px; max-width: 380px; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 12.5px; animation: s360-in .2s ease; }
.toast .t-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok-ink); flex: none; }
.toast.error .t-ic { background: var(--bad-bg); color: var(--bad-ink); }
.toast.warn .t-ic { background: var(--warn-bg); color: var(--warn-ink); }
@keyframes s360-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Paleta de comandos (Ctrl + K) ---------- */
.cmdk { position: fixed; inset: 0; z-index: 110; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; background: var(--overlay); }
.cmdk.open { display: flex; }
.cmdk-box { width: min(620px, calc(100% - 24px)); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.cmdk-in { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--faint); }
.cmdk-in input { flex: 1; height: 50px; border: 0; outline: none; background: none; font-size: 15px; color: var(--text); }
.cmdk-list { max-height: 50vh; overflow-y: auto; padding: 4px; }
.cmdk-group { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 8px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; }
.cmdk-item .ci { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--green-light); color: var(--green-darker); flex: none; }
.cmdk-item b { display: block; font-size: 13px; font-weight: 600; }
.cmdk-item small { display: block; font-size: 11.5px; color: var(--muted); }
.cmdk-item.sel, .cmdk-item:hover { background: var(--hover); }
.cmdk-foot { display: flex; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }

/* ---------- Información emergente ---------- */
.tip { position: fixed; z-index: 130; max-width: 260px; padding: 6px 9px; border-radius: 8px; background: var(--text); color: var(--card); font-size: 11.5px; pointer-events: none; opacity: 0; transition: opacity .12s ease; }
.tip.show { opacity: 1; }

/* ---------- Adaptación ---------- */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .app:not([data-shell])::before { display: none; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .app.menu-open .side { transform: none; }
  .side-scrim { position: fixed; inset: 0; z-index: 25; background: var(--overlay); display: none; }
  .app.menu-open .side-scrim { display: block; }
  .search .kbd, .user-chip div { display: none; }
  .page-head h1 { font-size: 20px; }
}
@media (max-width: 640px) {
  .content { padding: 4px 8px 14px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .modal-box { border-radius: 16px 16px 0 0; height: 92%; margin-top: auto; transform: translateY(100%); }
  .modal { align-items: flex-end; }
  .top-actions .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .side, .topbar, .no-print { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}

/* ---------- Sin conexión: aviso a pantalla completa ---------- */
.app-offline { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.offline-card { width: min(520px, 100%); padding: 18px; }
.offline-card .empty p { max-width: 440px; line-height: 1.5; }

/* Clave temporal */
.pw-box { display: grid; gap: 8px; }
.pw-value { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--card-2); border: 1px dashed var(--line-strong); }
.pw-value code { font-size: 20px; font-weight: 800; letter-spacing: .08em; font-family: ui-monospace, Consolas, monospace; }
.pw-steps { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); padding-left: 18px; }

/* Tooltip del menú: tarjeta oscura a la derecha con el nombre y para qué sirve la opción */
.nav-tip { position: fixed; z-index: 140; max-width: 270px; padding: 10px 12px; border-radius: 12px; pointer-events: none;
  background: var(--side-2); color: var(--side-text); border: 1px solid var(--side-line); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateX(-6px); transition: opacity .14s ease, transform .14s ease, visibility .14s; }
.nav-tip.show { opacity: 1; visibility: visible; transform: none; }
.nav-tip::before { content: ""; position: absolute; left: -6px; top: var(--arrow, 14px); width: 10px; height: 10px; background: inherit;
  border-left: 1px solid var(--side-line); border-bottom: 1px solid var(--side-line); transform: rotate(45deg); }
.nav-tip::after { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--green); }
.nav-tip b { display: block; font-size: 13px; font-weight: 700; color: var(--green-3); }
.nav-tip > span { display: block; margin-top: 3px; font-size: 12px; line-height: 1.4; color: var(--side-muted); }
.nav-tip-soon { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; font-style: normal; font-size: 10.5px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; background: var(--green-soft); color: var(--green-3); }
@media (hover: none) { .nav-tip { display: none; } }
@media (prefers-reduced-motion: reduce) { .nav-tip { transition: none; } }

/* ---------- Campana de avisos ---------- */
.ntf-bell { position: relative; }
.ntf-dot { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; display: grid; place-items: center;
  background: var(--bad); color: var(--card); font-size: 10px; font-weight: 800; line-height: 1; border: 2px solid var(--card); }
.ntf-pop { position: fixed; z-index: 90; width: min(380px, calc(100vw - 16px)); max-height: min(520px, calc(100vh - 80px)); overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.ntf-pop-cab { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 12px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.ntf-pop-cab b { font-size: 14px; }
.ntf-pop-cab button, .ntf-pie button { border: 0; background: transparent; color: var(--green-darker); font-weight: 700; font-size: 12px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
:root[data-theme="dark"] .ntf-pop-cab button, :root[data-theme="dark"] .ntf-pie button { color: var(--green-3); }
.ntf-pop ul { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; }
.ntf-pop li a { display: flex; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text); }
.ntf-pop li a:hover { background: var(--hover); }
.ntf-pop li.nuevo a { background: var(--green-light); }
.ntf-pop li.nuevo .ntf-tx b::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--green); vertical-align: middle; }
.ntf-ic { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--card-2); border: 1px solid var(--line); color: var(--green-darker); }
:root[data-theme="dark"] .ntf-ic { color: var(--green-3); }
.ntf-tx { min-width: 0; display: grid; gap: 1px; }
.ntf-tx b { font-size: 12.5px; }
.ntf-tx span { font-size: 12px; color: var(--muted); }
.ntf-tx small { font-size: 11px; color: var(--faint); }
.ntf-vacio { display: grid; justify-items: center; gap: 6px; padding: 26px 10px; color: var(--muted); font-size: 12.5px; }
.ntf-pie { padding: 8px 14px; border-top: 1px solid var(--line); }
.ntf-reglas { display: grid; gap: 8px; }
.ntf-reglas .check { align-items: flex-start; }
.ntf-reglas small { display: block; color: var(--muted); font-size: 11.5px; }
