/* Gestión — lenguaje visual sobrio, inspirado en las apps nativas de Apple */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafc;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.07);
  --label: #1d1d1f;
  --label-2: #6e6e73;
  --label-3: #a1a1a6;
  --sep: rgba(60, 60, 67, 0.13);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --red: #e0352b;
  --red-soft: rgba(224, 53, 43, 0.09);
  --orange: #e68a00;
  --orange-soft: rgba(230, 138, 0, 0.1);
  --green: #1f9d4d;
  --green-soft: rgba(31, 157, 77, 0.1);
  --indigo: #5856d6;
  --indigo-soft: rgba(88, 86, 214, 0.1);
  --crit: #e0352b;
  --imp: #e68a00;
  --op: #0071e3;
  --low: #b8b8be;
  --shadow: 0 0.5px 0 rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.035);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  --r-lg: 14px;
  --seg-on: #ffffff;
  --r-md: 10px;
  --r-sm: 7px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --sidebar: 236px;
  --tabbar: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #232325; --fill: rgba(120, 120, 128, 0.24); --fill-2: rgba(120, 120, 128, 0.14);
    --label: #f5f5f7; --label-2: #98989f; --label-3: #636366; --sep: rgba(84, 84, 88, 0.55);
    --accent: #0a84ff; --accent-soft: rgba(10, 132, 255, 0.16); --red: #ff453a; --red-soft: rgba(255, 69, 58, 0.15);
    --orange: #ff9f0a; --orange-soft: rgba(255, 159, 10, 0.15); --green: #30d158; --green-soft: rgba(48, 209, 88, 0.14);
    --indigo: #7d7aff; --indigo-soft: rgba(125, 122, 255, 0.16); --seg-on: #636366; --crit: #ff453a; --imp: #ff9f0a; --op: #0a84ff; --low: #636366;
    --shadow: none; --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --surface-2: #232325; --fill: rgba(120, 120, 128, 0.24); --fill-2: rgba(120, 120, 128, 0.14);
  --label: #f5f5f7; --label-2: #98989f; --label-3: #636366; --sep: rgba(84, 84, 88, 0.55);
  --accent: #0a84ff; --accent-soft: rgba(10, 132, 255, 0.16); --red: #ff453a; --red-soft: rgba(255, 69, 58, 0.15);
  --orange: #ff9f0a; --orange-soft: rgba(255, 159, 10, 0.15); --green: #30d158; --green-soft: rgba(48, 209, 88, 0.14);
  --indigo: #7d7aff; --indigo-soft: rgba(125, 122, 255, 0.16); --seg-on: #636366; --crit: #ff453a; --imp: #ff9f0a; --op: #0a84ff; --low: #636366;
  --shadow: none; --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--label); font-family: var(--font); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; letter-spacing: -0.005em;
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; border-radius: 6px; }
[hidden] { display: none !important; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { opacity: 0.9; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ---------- Estructura ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: calc(18px + var(--safe-t)) 12px 16px;
  display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--sep);
  background: color-mix(in srgb, var(--surface) 72%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 600; font-size: 17px; }
.brand img { width: 28px; height: 28px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 8px; color: var(--label); font-size: 14.5px;
  border: 0; background: none; width: 100%; text-align: left;
}
.nav-item svg { color: var(--accent); flex: none; }
.nav-item:hover { background: var(--fill-2); }
.nav-item.on { background: var(--fill); font-weight: 600; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.nav-item .dot-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.sidebar .spacer { flex: 1; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 0; background: none; width: 100%; text-align: left; }
.me-chip:hover { background: var(--fill-2); }
.me-chip small { display: block; color: var(--label-2); font-size: 12px; }

.main { margin-left: var(--sidebar); min-height: 100vh; }
.page { max-width: 1060px; margin: 0 auto; padding: calc(28px + var(--safe-t)) 32px 80px; }
.page.narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 32px; line-height: 1.12; letter-spacing: -0.025em; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--label-2); font-size: 14px; margin-top: 4px; }
.page-head .tools { display: flex; gap: 8px; align-items: center; }

.tabbar { display: none; }
.offline-bar { position: sticky; top: 0; z-index: 25; background: var(--orange-soft); color: var(--orange); font-size: 13px; text-align: center; padding: 6px 12px calc(6px); font-weight: 500; backdrop-filter: blur(20px); }

@media (max-width: 899px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--tabbar) + var(--safe-b)); }
  .page { padding: calc(14px + var(--safe-t)) 16px 40px; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 30px; }
  .page-head .sub { font-size: 13.5px; }
  .page-head .tools .lbl { display: none; }
  .page-head .tools .btn.sm { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
  .toolbar .select { flex: 1 1 40%; max-width: none; }
  body { font-size: 16px; }
  .tabbar {
    display: flex; position: fixed; inset: auto 0 0 0; height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b); z-index: 30;
    background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--sep);
  }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; color: var(--label-2); border: 0; background: none; position: relative; padding: 0; }
  .tab.on { color: var(--accent); }
  .tab .badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 600; display: grid; place-items: center; }
}

/* ---------- Tipografía y utilidades ---------- */
.muted { color: var(--label-2); }
.faint { color: var(--label-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.sec-title { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; margin: 30px 0 10px; }
.group-head { display: flex; align-items: baseline; gap: 8px; margin: 26px 4px 8px; }
.group-head h2 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.group-head .hint { font-size: 13px; color: var(--label-2); }
.group-head .n { margin-left: auto; font-size: 13px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; word-break: break-word; }

/* ---------- Listas agrupadas (estilo Ajustes) ---------- */
.list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.list + .list { margin-top: 12px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 48px; position: relative; width: 100%;
  background: none; border: 0; text-align: left; color: inherit;
}
.item::after { content: ""; position: absolute; left: 16px; right: 0; bottom: 0; height: 1px; background: var(--sep); transform: scaleY(0.6); }
.item:last-child::after { display: none; }
.item.indent::after { left: 44px; }
button.item:hover, .item.link:hover { background: var(--fill-2); }
.item .chev { color: var(--label-3); flex: none; }
.item .label { flex: 1; min-width: 0; }
.item .value { color: var(--label-2); text-align: right; min-width: 0; max-width: 60%; }
.item .value.ellipsis { overflow: hidden; }
.list-foot { font-size: 13px; color: var(--label-2); margin: 7px 16px 0; }

/* ---------- Filas de actividad ---------- */
.act {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 4px 12px; align-items: start; padding: 13px 16px; cursor: pointer;
  position: relative; background: none; border: 0; width: 100%; text-align: left; color: inherit;
}
.act::after { content: ""; position: absolute; left: 38px; right: 0; bottom: 0; height: 1px; background: var(--sep); transform: scaleY(0.6); }
.act:last-child::after { display: none; }
.act:hover { background: var(--fill-2); }
.pdot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; background: var(--low); }
.pdot.critica { background: var(--crit); }
.pdot.importante { background: var(--imp); }
.pdot.operativa { background: var(--op); }
.pdot.baja { background: var(--low); }
.act .t { font-weight: 550; font-size: 15.5px; line-height: 1.3; letter-spacing: -0.01em; }
.act .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--label-2); font-size: 13px; margin-top: 3px; }
.act .meta > span { display: inline-flex; align-items: center; gap: 4px; }
.act .side { display: flex; align-items: center; gap: 10px; }
.act .order { display: flex; flex-direction: column; gap: 2px; }
.late { color: var(--red); }
.warn { color: var(--orange); }

.ring { width: 26px; height: 26px; flex: none; }
.ring circle { fill: none; stroke-width: 3; }
.ring .bg { stroke: var(--fill); }
.ring .fg { stroke: var(--green); stroke-linecap: round; transition: stroke-dashoffset 0.4s var(--ease); }
.prog-label { font-size: 12.5px; color: var(--label-2); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 20px; background: var(--fill); color: var(--label-2); white-space: nowrap; }
.pill.en_curso { background: var(--accent-soft); color: var(--accent); }
.pill.bloqueada { background: var(--red-soft); color: var(--red); }
.pill.en_revision { background: var(--indigo-soft); color: var(--indigo); }
.pill.devuelta { background: var(--orange-soft); color: var(--orange); }
.pill.cerrada { background: var(--green-soft); color: var(--green); }
.pill.hecha { background: var(--green-soft); color: var(--green); }
.pill.critica { background: var(--red-soft); color: var(--red); }
.pill.importante { background: var(--orange-soft); color: var(--orange); }
.pill.operativa { background: var(--accent-soft); color: var(--accent); }

/* ---------- Avatares ---------- */
.av { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; line-height: 1; font-size: 11.5px; font-weight: 600; color: #fff; flex: none; overflow: hidden; background: #8e8e93; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.s { width: 22px; height: 22px; font-size: 9.5px; }
.av.l { width: 44px; height: 44px; font-size: 16px; }
.av.xl { width: 72px; height: 72px; font-size: 26px; }
.avs { display: flex; }
.avs .av { box-shadow: 0 0 0 2px var(--surface); }
.avs .av + .av { margin-left: -7px; }

/* ---------- Botones y controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 16px; border-radius: 18px;
  border: 0; font-weight: 550; font-size: 14.5px; background: var(--fill); color: var(--accent); white-space: nowrap; transition: transform 0.12s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { color: var(--red); }
.btn.plain { background: none; padding: 0 8px; }
.btn.lg { height: 46px; border-radius: 12px; font-size: 16px; padding: 0 22px; }
.btn.block { width: 100%; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13.5px; }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--fill); color: var(--label); display: inline-grid; place-items: center; flex: none; }
.icon-btn.ghost { background: none; color: var(--label-2); }
.icon-btn:hover { filter: brightness(0.97); }
.icon-btn.sm { width: 26px; height: 26px; }

.seg { display: inline-flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; padding: 5px 13px; border-radius: 7px; font-size: 13.5px; font-weight: 500; color: var(--label); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--seg-on); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04); font-weight: 600; }
.seg button .c { font-size: 12px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; justify-content: center; }

.input, .select, .textarea {
  width: 100%; border: 0; background: var(--fill-2); border-radius: var(--r-md); padding: 10px 12px; outline: none; min-height: 42px;
  box-shadow: inset 0 0 0 1px transparent; transition: box-shadow 0.15s, background 0.15s;
}
.input:focus, .select:focus, .textarea:focus { background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
.select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--label-2); pointer-events: none; }
.search .input { padding-left: 34px; min-height: 36px; height: 36px; border-radius: 10px; background: var(--fill); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--label-2); font-weight: 500; padding-left: 2px; }
.field .hint { font-size: 12.5px; color: var(--label-2); padding-left: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: var(--fill); transition: background 0.2s; }
.switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.25s var(--ease); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--accent-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--fill); padding: 5px 11px; border-radius: 16px; font-size: 13.5px; color: var(--label); }
.chip.on { background: var(--accent); color: #fff; }
.chip .x { opacity: 0.6; }
.chip.tag { background: var(--fill-2); color: var(--label-2); font-size: 12.5px; padding: 3px 9px; }

/* ---------- Captura rápida ---------- */
.capture {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 6px 6px 6px 16px; display: flex; flex-direction: column;
  transition: box-shadow 0.2s;
}
.capture:focus-within { box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }
.capture-row { display: flex; align-items: center; gap: 10px; }
.capture input { flex: 1; border: 0; background: none; outline: none; font-size: 17px; padding: 10px 0; min-width: 0; }
.capture input::placeholder { color: var(--label-3); }
.capture .plus { width: 22px; height: 22px; border-radius: 50%; border: 1.6px solid var(--label-3); display: grid; place-items: center; color: var(--label-3); flex: none; }
.capture-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 4px 4px 8px 32px; font-size: 13px; color: var(--label-2); }
.capture-opts .seg button { padding: 3px 10px; font-size: 12.5px; }
.capture-opts .result { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin: 18px 0 4px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 180px; }
.toolbar .select { width: auto; min-height: 36px; height: 36px; padding-top: 0; padding-bottom: 0; background-color: var(--fill); border-radius: 10px; font-size: 14px; max-width: 200px; }

/* ---------- Hojas (paneles superpuestos) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.22); z-index: 50; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 51; background: var(--bg); display: flex; flex-direction: column; box-shadow: var(--shadow-pop);
}
.sheet.side { top: 0; right: 0; bottom: 0; width: min(620px, 100vw); animation: slideIn 0.32s var(--ease); }
.sheet.modal { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: min(86vh, 900px); border-radius: 16px; animation: pop 0.26s var(--ease); }
.sheet.modal.small { width: min(420px, calc(100vw - 32px)); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, -48%) scale(0.97); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: calc(12px + var(--safe-t)) 14px 10px; border-bottom: 1px solid transparent; }
.sheet.modal .sheet-head { padding-top: 12px; }
.sheet-head h3 { flex: 1; margin: 0; font-size: 16px; font-weight: 600; text-align: center; }
.sheet-head .side-btn { min-width: 72px; }
.sheet-body { overflow-y: auto; padding: 4px 20px 28px; flex: 1; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--sep); display: flex; gap: 10px; background: var(--surface-2); }
@media (max-width: 899px) {
  .sheet.side, .sheet.modal { top: auto; left: 0; right: 0; bottom: 0; width: 100%; transform: none; border-radius: 14px 14px 0 0; animation: up 0.34s var(--ease); }
  .sheet.side { height: calc(100% - 10px - var(--safe-t)); }
  .sheet.modal { max-height: calc(100% - 40px - var(--safe-t)); }
  .sheet-head { padding-top: 12px; }
  .sheet-body { padding: 4px 16px 24px; }
  @keyframes up { from { transform: translateY(40px); opacity: 0.4; } }
}

/* ---------- Detalle de actividad ---------- */
.detail-title { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 10px; word-break: break-word; }
.bar { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 3px; transition: width 0.4s var(--ease); }
.progress-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--label-2); margin: 14px 0 6px; font-variant-numeric: tabular-nums; }
.callout { border-radius: var(--r-md); padding: 11px 14px; font-size: 14px; background: var(--fill-2); }
.callout.red { background: var(--red-soft); color: var(--red); }
.callout.orange { background: var(--orange-soft); color: var(--orange); }
.callout.indigo { background: var(--indigo-soft); color: var(--indigo); }
.callout.green { background: var(--green-soft); color: var(--green); }
.callout b { font-weight: 600; }
.block-title { font-size: 13px; color: var(--label-2); font-weight: 500; margin: 22px 4px 7px; display: flex; align-items: center; gap: 8px; }
.block-title .grow { flex: 1; }
.text-block { background: var(--surface); border-radius: var(--r-lg); padding: 12px 16px; box-shadow: var(--shadow); font-size: 14.5px; }

/* Microtareas */
.mt { display: flex; gap: 12px; padding: 11px 16px 11px 14px; position: relative; align-items: flex-start; }
.mt::after { content: ""; position: absolute; left: 50px; right: 0; bottom: 0; height: 1px; background: var(--sep); transform: scaleY(0.6); }
.mt:last-child::after { display: none; }
.check {
  width: 24px; height: 24px; border-radius: 50%; border: 1.7px solid var(--label-3); background: none; flex: none; display: grid; place-items: center;
  color: #fff; padding: 0; margin-top: 0; transition: background 0.18s, border-color 0.18s, transform 0.12s;
}
.check:active { transform: scale(0.9); }
.check.on { background: var(--green); border-color: var(--green); }
.check.returned { border-color: var(--orange); }
.check.blocked { border-color: var(--red); border-style: dashed; }
.check:disabled { opacity: 0.45; cursor: default; }
.mt .body { flex: 1; min-width: 0; cursor: pointer; }
.mt .mt-title { font-size: 15px; line-height: 1.35; word-break: break-word; }
.mt.done .mt-title { color: var(--label-2); }
.mt .mt-meta { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 12.5px; color: var(--label-2); margin-top: 3px; }
.mt .mt-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.mt-extra { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; cursor: default; }
.mt-add { display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 14px; }
.mt-add .plus { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }
.mt-add input { flex: 1; border: 0; background: none; outline: none; padding: 8px 0; font-size: 15px; min-width: 0; }

/* Comentarios */
.comment { display: flex; gap: 10px; padding: 12px 16px; position: relative; }
.comment::after { content: ""; position: absolute; left: 54px; right: 0; bottom: 0; height: 1px; background: var(--sep); transform: scaleY(0.6); }
.comment:last-child::after { display: none; }
.comment .who { font-size: 13px; font-weight: 600; }
.comment .who .muted { font-weight: 400; margin-left: 6px; }
.comment .txt { font-size: 14.5px; margin-top: 2px; }
.comment.incidencia .txt { color: var(--red); }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; }
.composer .textarea { min-height: 40px; height: 40px; padding: 9px 12px; border-radius: 20px; }

/* Historial */
.tl { position: relative; padding: 6px 0 4px; }
.tl-item { display: grid; grid-template-columns: 58px 1fr; gap: 12px; padding: 7px 16px; font-size: 13.5px; }
.tl-item time { color: var(--label-2); font-variant-numeric: tabular-nums; font-size: 12.5px; padding-top: 1px; }
.tl-day { font-size: 12px; color: var(--label-2); font-weight: 600; padding: 12px 16px 2px; }

/* Archivos */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; padding: 12px; }
.file { border-radius: 10px; overflow: hidden; background: var(--fill-2); aspect-ratio: 1; position: relative; display: grid; place-items: center; color: var(--label-2); font-size: 12px; text-align: center; border: 0; padding: 0; }
.file img { width: 100%; height: 100%; object-fit: cover; }
.file .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 7px 5px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.55)); text-align: left; }
.file .doc { padding: 10px; word-break: break-all; }

/* ---------- Panel ---------- */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 700px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
.metric { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 14px 16px; text-align: left; border: 0; color: inherit; display: flex; flex-direction: column; gap: 2px; }
.metric:hover { background: var(--surface-2); }
.metric .v { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.metric .k { font-size: 13.5px; color: var(--label-2); display: flex; align-items: center; gap: 6px; }
.metric.alert .v { color: var(--red); }
.metric.review .v { color: var(--indigo); }
.load { display: grid; grid-template-columns: minmax(140px, 1.2fr) 2fr auto; gap: 14px; align-items: center; padding: 12px 16px; position: relative; }
.load::after { content: ""; position: absolute; left: 16px; right: 0; bottom: 0; height: 1px; background: var(--sep); transform: scaleY(0.6); }
.load:last-child::after { display: none; }
.stackbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--fill-2); }
.stackbar i { display: block; height: 100%; }
.stackbar .p { background: var(--low); }
.stackbar .c { background: var(--accent); }
.stackbar .r { background: var(--indigo); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--label-2); flex-wrap: wrap; margin: 8px 4px 0; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
@media (max-width: 600px) { .load { grid-template-columns: 1fr auto; } .load .stackwrap { grid-column: 1 / -1; } }

/* ---------- Varios ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--label-2); }
.empty svg { color: var(--label-3); margin-bottom: 10px; }
.empty h3 { color: var(--label); font-size: 17px; margin: 0 0 4px; font-weight: 600; }
.empty p { margin: 0 auto 16px; max-width: 360px; font-size: 14px; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--safe-b)); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
@media (max-width: 899px) { .toasts { bottom: calc(var(--tabbar) + 14px + var(--safe-b)); } }
.toast { background: color-mix(in srgb, var(--label) 88%, transparent); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-pop); animation: toastIn 0.3s var(--ease); pointer-events: auto; backdrop-filter: blur(20px); }
.toast.err { background: var(--red); color: #fff; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }
.actions-list .item { justify-content: center; color: var(--accent); font-size: 16px; }
.actions-list .item.danger { color: var(--red); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(380px, 100%); text-align: center; }
.auth-card img { width: 64px; height: 64px; margin-bottom: 14px; }
.auth-card h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -0.02em; }
.auth-card p { color: var(--label-2); margin: 0 0 24px; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.err-text { color: var(--red); font-size: 13.5px; }
.notif { display: flex; gap: 12px; padding: 12px 16px; position: relative; width: 100%; border: 0; background: none; text-align: left; color: inherit; }
.notif::after { content: ""; position: absolute; left: 36px; right: 0; bottom: 0; height: 1px; background: var(--sep); transform: scaleY(0.6); }
.notif:last-child::after { display: none; }
.notif:hover { background: var(--fill-2); }
.notif .unread { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: none; }
.notif .unread.off { background: none; }
.notif .nt { font-weight: 600; font-size: 14.5px; }
.notif .nb { font-size: 14px; color: var(--label-2); margin-top: 1px; }
.kbd { font-size: 11.5px; color: var(--label-3); border: 1px solid var(--sep); border-radius: 5px; padding: 0 5px; }
.more-link { display: block; text-align: center; padding: 14px; font-size: 14.5px; }
.preview-prio { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--label-2); padding: 2px; }
.weekday { width: 38px; height: 38px; border-radius: 50%; padding: 0; justify-content: center; }
.divider { height: 1px; background: var(--sep); margin: 18px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Filtros en el móvil: dos por fila */
@media (max-width: 899px) {
  .toolbar .search { flex: 1 1 100%; }
  .toolbar > .select { flex: 1 1 calc(50% - 5px); max-width: none; min-width: 0; }
}
