/* ATLAS-TALLER — Estilos premium del dashboard operativo (responsive + tablet). */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff4ff;
  --accent: #0ea5e9;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e6e9f0;
  --line-soft: #f1f3f8;
  --ok: #15803d; --ok-bg: #dcfce7;
  --warn: #b45309; --warn-bg: #fef3c7;
  --danger: #b91c1c; --danger-bg: #fee2e2;
  --info: #1d4ed8; --info-bg: #dbeafe;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.06);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.12);
  --sidebar: 240px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3 { letter-spacing: -.01em; }

/* Layout ------------------------------------------------------------------ */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: 64px 1fr; min-height: 100vh; }
header.topbar { grid-column: 1 / 3; display: flex; align-items: center; gap: 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 20px; position: sticky; top: 0; z-index: 30; }
.brand { font-weight: 800; font-size: 20px; color: var(--brand); letter-spacing: -.5px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand::before { content: "🔧"; font-size: 18px; }
.brand span { color: var(--ink); }
.search-wrap { position: relative; flex: 1; max-width: 560px; }
.search-wrap input { width: 100%; padding: 11px 16px 11px 38px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 14px center; transition: border-color .15s, background-color .15s; }
.search-wrap input:focus { outline: none; border-color: var(--brand); background-color: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.search-results { position: absolute; top: 48px; left: 0; right: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 380px; overflow: auto; z-index: 50; }
.search-results .item { padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 8px; }
.search-results .item:last-child { border-bottom: 0; }
.search-results .item:hover { background: var(--brand-soft); }
.search-results .item .t { font-size: 11px; text-transform: uppercase; color: var(--muted); align-self: center; }
.role-switch { display: flex; align-items: center; gap: 10px; }
.role-switch select { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; background: #fff; cursor: pointer; }
.role-badge { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); letter-spacing: .03em; }

nav.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 14px 12px; overflow-y: auto; }
nav.sidebar a { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 11px; color: var(--ink-soft);
  font-weight: 600; font-size: 14px; margin-bottom: 2px; transition: background .12s, color .12s; }
nav.sidebar a .ic { width: 20px; text-align: center; font-size: 15px; }
nav.sidebar a:hover { background: var(--bg); color: var(--ink); }
nav.sidebar a.active { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.3); }
nav.sidebar .sec { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 13px 5px; font-weight: 700; }

main { padding: 24px 28px; overflow-x: hidden; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; font-weight: 800; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* Cards & grids ----------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); cursor: pointer; transition: transform .1s, box-shadow .1s; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); opacity: .85; }
.kpi.alert::after { background: var(--danger); }
.kpi.warn::after { background: var(--warn); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi .v { font-size: 32px; font-weight: 800; line-height: 1; }
.kpi .l { color: var(--muted); font-size: 13px; margin-top: 7px; font-weight: 500; }
.kpi.alert .v { color: var(--danger); }
.kpi.warn .v { color: var(--warn); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.panel > h2 { font-size: 15px; margin: 0; padding: 15px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg,#fbfcfe,#f7f9fc); font-weight: 700; }
.panel .body { padding: 16px 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Attention list (dashboard) --------------------------------------------- */
.attention { list-style: none; margin: 0; padding: 0; }
.attention li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .1s; }
.attention li:last-child { border-bottom: 0; }
.attention li:hover { background: var(--bg); }
.attention .ic { font-size: 20px; width: 28px; text-align: center; }
.attention .txt { flex: 1; }
.attention .txt .lbl { font-weight: 600; font-size: 14px; }
.attention .txt .sub { color: var(--muted); font-size: 13px; }
.attention .chev { color: var(--muted); }
.attention li.sev-danger .ic { filter: none; }
.attention li.sev-danger { border-left: 3px solid var(--danger); }
.attention li.sev-warn { border-left: 3px solid var(--warn); }
.attention li.sev-info { border-left: 3px solid var(--accent); }

/* Tables ------------------------------------------------------------------ */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; padding: 11px 14px; border-bottom: 2px solid var(--line); font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; background: #fbfcfe; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fbfcff; }
table.data tr.clickable { cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* Status & priority badges ----------------------------------------------- */
.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.s-neutral { background: #eef1f6; color: var(--muted); }
.badge.s-info { background: var(--info-bg); color: var(--info); }
.badge.s-ok { background: var(--ok-bg); color: var(--ok); }
.badge.s-warn { background: var(--warn-bg); color: var(--warn); }
.badge.s-danger { background: var(--danger-bg); color: var(--danger); }
.prio { display: inline-block; padding: 3px 9px; border-radius: 8px; font-size: 11px; font-weight: 700; }
.prio.BAJA { background: #eef1f6; color: var(--muted); }
.prio.NORMAL { background: var(--info-bg); color: var(--info); }
.prio.ALTA { background: var(--warn-bg); color: var(--warn); }
.prio.URGENTE { background: var(--danger-bg); color: var(--danger); }

/* Buttons ----------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 15px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 14px 20px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; }

/* Forms & modal ----------------------------------------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center;
  padding: 44px 16px; z-index: 100; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 580px; box-shadow: var(--shadow-lg); animation: pop .14s ease-out; }
.modal.wide { max-width: 860px; }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: .6; } to { transform: none; opacity: 1; } }
.modal h2 { margin: 0; padding: 18px 22px; border-bottom: 1px solid var(--line); font-size: 18px; }
.modal .content { padding: 20px 22px; }
.modal .foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fbfcfe; border-radius: 0 0 16px 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink-soft); }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; font-family: inherit; transition: border-color .12s, box-shadow .12s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field textarea { min-height: 74px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* Detail layout ----------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
@media (max-width: 980px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Timeline ---------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.timeline .ev { font-weight: 600; font-size: 14px; }
.timeline .meta { font-size: 12px; color: var(--muted); }

/* Toast ------------------------------------------------------------------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast { background: #0f172a; color: #fff; padding: 13px 18px; border-radius: 11px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 380px; animation: pop .14s ease-out; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* Workbench (technician tablet) ------------------------------------------ */
.work-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; background: var(--surface); box-shadow: var(--shadow); }
.work-card .wc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.work-card .wc-title { font-size: 18px; font-weight: 800; }
.work-card .wc-meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.work-card .wc-block { margin-top: 14px; }
.work-card .wc-block .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.work-card .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.work-card .actions .btn { font-size: 16px; padding: 14px 18px; flex: 1 1 auto; min-width: 140px; justify-content: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; }

/* Wizard (cita rápida) ---------------------------------------------------- */
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.steps .step { flex: 1; min-width: 90px; padding: 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); text-align: center; font-size: 13px; color: var(--muted); }
.steps .step.active { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.steps .step.done { background: var(--ok-bg); color: var(--ok); border-color: #bbf7d0; }
.pick-list { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; }
.pick-list .row { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.pick-list .row:hover { background: var(--brand-soft); }
.pick-list .row:last-child { border-bottom: 0; }

/* Demo guiada ------------------------------------------------------------- */
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.demo-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.demo-card h3 { margin: 0 0 4px; font-size: 16px; }
.demo-card .role { font-size: 12px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .03em; }
.demo-card ol { margin: 10px 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); }
.demo-card .ok { font-size: 13px; color: var(--ok); margin-top: auto; padding-top: 8px; }

/* Banner / aviso ---------------------------------------------------------- */
.notice { padding: 12px 16px; border-radius: 11px; font-size: 13.5px; margin-bottom: 16px; }
.notice.warn { background: var(--warn-bg); color: #92400e; border: 1px solid #fde68a; }
.notice.info { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid #c7d7fe; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 58px auto 1fr; }
  nav.sidebar { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px; border-right: 0; border-bottom: 1px solid var(--line); }
  nav.sidebar .sec { display: none; }
  nav.sidebar a { padding: 9px 11px; }
  .brand span { display: none; }
  .detail-grid, .field-row { grid-template-columns: 1fr; }
  main { padding: 16px; }
}

/* ==========================================================================
   Iteración 06 — Beta Web 0.4: acceso, menú de usuario, calendario, responsive
   ========================================================================== */

/* Menú de usuario (sustituye al selector de rol) */
.user-menu { display: flex; align-items: center; gap: 8px; position: relative; }
.user-menu .user-name { font-weight: 600; font-size: 14px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.user-dropdown { position: absolute; right: 0; top: 44px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 230px; z-index: 60; padding: 6px; }
.user-dropdown .item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 11px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; color: var(--ink); }
.user-dropdown .item:hover { background: var(--bg); }

/* Pantalla de acceso */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(160deg, #eff4ff 0%, #f5f7fb 60%, #e0f2fe 100%); }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; padding: 28px 26px; }
.login-card .field input { padding: 13px 14px; font-size: 16px; }
.demo-login .btn { flex-direction: column; gap: 2px; min-width: 120px; }
.demo-login .role-badge { font-size: 10px; }

/* Calendario operativo */
.panel.cal { padding: 14px 16px 18px; }
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-nav, .cal-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-range { font-size: 13px; color: var(--muted); }
.cal-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 12px; }
.cal-summary .cs-item { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.cal-summary .cs-item.alert { border-color: #fecaca; background: #fff5f5; }
.cal-summary .cs-item.warn { border-color: #fde68a; background: #fffbeb; }
.cal-summary .cs-item.wide { grid-column: span 2; display: flex; flex-direction: column; gap: 6px; }
.cal-summary .cs-v { font-size: 24px; font-weight: 800; line-height: 1.1; }
.cal-summary .cs-l { font-size: 12px; color: var(--muted); }
.cal-summary .cs-t { font-size: 14px; }
.cal-summary.small { grid-template-columns: repeat(4, 1fr); margin-bottom: 14px; }
.legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; margin-bottom: 12px; }
.legend .lg { padding: 3px 10px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; }
.week { margin-bottom: 14px; }
.week-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 6px 0 8px; }
.week-title .hint { text-transform: none; letter-spacing: 0; font-weight: 500; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { border: 1px solid var(--line); border-radius: 12px; padding: 9px 9px 8px; background: #fff; min-height: 150px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: box-shadow .12s, transform .08s; border-top-width: 4px; }
.day:hover, .day:focus-visible { box-shadow: var(--shadow-lg); transform: translateY(-1px); outline: none; }
.day.today { box-shadow: 0 0 0 2px var(--brand); }
.day.past { opacity: .72; }
.day-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.day-label { font-weight: 800; font-size: 14px; text-transform: capitalize; }
.day .pill { background: var(--brand); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; }
.day .lvl { margin-left: auto; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; padding: 2px 7px; border-radius: 999px; }
.lv-libre { --lv: #16a34a; --lv-bg: #dcfce7; }
.lv-media { --lv: #ca8a04; --lv-bg: #fef9c3; }
.lv-alta { --lv: #ea580c; --lv-bg: #ffedd5; }
.lv-saturado { --lv: #dc2626; --lv-bg: #fee2e2; }
.lv-cerrado { --lv: #94a3b8; --lv-bg: #f1f5f9; }
.day { border-top-color: var(--lv, var(--line)); }
.day.lv-cerrado { background: #f8fafc; }
.day .lvl, .legend .lg { background: var(--lv-bg); color: var(--lv); }
.load { position: relative; height: 16px; background: #eef1f6; border-radius: 999px; overflow: hidden; }
.load .bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--lv); border-radius: 999px; opacity: .85; }
.load .load-txt { position: absolute; inset: 0; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; color: var(--ink); mix-blend-mode: multiply; }
.day-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); }
.day-meta .ok { color: var(--ok); font-weight: 700; }
.day-meta .no { color: var(--danger); font-weight: 700; }
.day-meta.closed { color: var(--muted); font-style: italic; }
.day-flags { display: flex; gap: 5px; flex-wrap: wrap; }
.flag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 8px; }
.flag.danger { background: var(--danger-bg); color: var(--danger); }
.flag.ok { background: var(--ok-bg); color: var(--ok); }
.flag.warn { background: var(--warn-bg); color: var(--warn); }
.day-events { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.ev { display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 4px 7px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); line-height: 1.25; text-decoration: none; overflow: hidden; border-left-width: 4px; }
.ev:hover { background: var(--brand-soft); }
.ev.k-info { border-left-color: var(--info); }
.ev.k-ok { border-left-color: var(--ok); }
.ev.k-warn { border-left-color: var(--warn); }
.ev.k-danger, .ev.blocked { border-left-color: var(--danger); background: #fff7f7; }
.ev.ready { border-left-color: var(--ok); background: #f4fdf7; }
.ev.k-neutral { border-left-color: #cbd5e1; }
.ev .ev-time { font-weight: 800; font-variant-numeric: tabular-nums; }
.ev .ev-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .ev-tech { font-size: 10px; background: var(--bg); border-radius: 6px; padding: 1px 5px; color: var(--muted); white-space: nowrap; }
.ev .ev-tech.warn { background: var(--warn-bg); color: var(--warn); }
.ev.more { justify-content: center; color: var(--brand); font-weight: 700; cursor: pointer; border-style: dashed; border-left-width: 1px; }
.day-next { font-size: 12px; color: var(--ok); }

/* Detalle de día (modal) */
.sub-h { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 8px; }
.day-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.day-list li { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); border-left: 4px solid #cbd5e1; }
.day-list li:last-child { border-bottom: 0; }
.day-list li.k-info { border-left-color: var(--info); }
.day-list li.k-ok { border-left-color: var(--ok); }
.day-list li.k-warn { border-left-color: var(--warn); }
.day-list li.k-danger { border-left-color: var(--danger); }
.day-list .t { font-weight: 800; font-variant-numeric: tabular-nums; }
.day-list .st { text-align: right; font-size: 13px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.slot { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.slot.free { border-color: #bbf7d0; background: #f6fef9; }
.slot.busy { background: #fafafa; }
.slot-t { font-weight: 800; }
.slot-b { display: flex; gap: 4px; flex-wrap: wrap; }
.dot { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; }
.dot.free { background: var(--ok); }
.dot.busy { background: #cbd5e1; color: var(--ink-soft); }

/* Tablas anchas en pantallas estrechas */
.panel .body { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Tablet */
@media (max-width: 1100px) {
  .days { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
  .day { padding: 8px 7px; min-height: 130px; }
  .ev .ev-tech { display: none; }
  .cal-summary .cs-item.wide { grid-column: span 3; }
}

/* Móvil */
@media (max-width: 760px) {
  header.topbar { padding: 0 12px; gap: 10px; }
  .search-wrap input { padding: 10px 12px 10px 34px; font-size: 16px; }
  .user-menu .user-name { display: none; }
  /* Corrección heredada: la cabecera ocupaba 2 columnas en una rejilla de 1 y desplazaba la navegación */
  header.topbar { grid-column: 1; grid-row: 1; }
  nav.sidebar { grid-column: 1; grid-row: 2; display: flex; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 8px 10px; gap: 6px; scrollbar-width: none; position: sticky; top: 58px; z-index: 20; }
  main { grid-column: 1; grid-row: 3; }
  nav.sidebar::-webkit-scrollbar { display: none; }
  nav.sidebar a { white-space: nowrap; padding: 9px 12px; font-size: 13px; flex: 0 0 auto; }
  .page-head h1 { font-size: 20px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 26px; }
  .btn { min-height: 42px; }
  .btn.sm { min-height: 36px; }
  .field input, .field select, .field textarea { font-size: 16px; }
  .modal-overlay { padding: 12px 8px; }
  .modal h2 { font-size: 16px; padding: 14px 16px; }
  .modal .content { padding: 14px 16px; }
  /* Calendario: lista vertical de días (semana actual primero) */
  .days { grid-template-columns: 1fr; }
  .day { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .day .day-head { width: 110px; flex-direction: column; align-items: flex-start; gap: 3px; }
  .day .lvl { margin-left: 0; }
  .day .load { flex: 1 1 120px; }
  .day .day-meta { width: 100%; }
  .day .day-events { width: 100%; }
  .day .day-next { width: 100%; }
  .day.lv-cerrado .day-events:empty { display: none; }
  .cal-summary { grid-template-columns: repeat(2, 1fr); }
  .cal-summary .cs-item.wide { grid-column: span 2; }
  .cal-summary.small { grid-template-columns: repeat(2, 1fr); }
  .day-list li { grid-template-columns: 56px 1fr; }
  .day-list .st { text-align: left; grid-column: 2; }
  .day-list .btn { grid-column: 2; justify-self: start; }
  .work-card .actions .btn { min-width: 46%; }
}

@media print {
  header.topbar, nav.sidebar, .cal-toolbar, .btn { display: none !important; }
  .app { grid-template-columns: 1fr; }
}

/* ==========================================================================
   ITER07 — semántica de capacidad, vista de día móvil a pantalla completa
   ========================================================================== */
.ev.unplanned { border-left-style: dashed; border-left-color: var(--warn); background: #fffbeb; }
.day-next.no { color: var(--danger); }
.cap-line { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); padding: 8px 12px; background: var(--bg); border-radius: 10px; }
.warn-txt { color: var(--warn); }
.slot.nocap { background: #fffbeb; border-color: #fde68a; }
body.no-scroll { overflow: hidden; }
.day-panel { position: fixed; inset: 0; background: var(--bg); z-index: 120; display: flex; flex-direction: column; }
.day-panel-head { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); z-index: 1; }
.day-panel-title { font-weight: 800; font-size: 15px; flex: 1; }
.day-panel-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px; }
.day-panel-foot { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
.day-panel-foot .btn { flex: 1; justify-content: center; }
@media (max-width: 760px) {
  .day-list li { grid-template-columns: 64px 1fr; }
  .slots { grid-template-columns: repeat(2, 1fr); }
}
