/* TimeSheet Teseo — paleta y tipografía de Teseo Consulting (igual que TRB). */
:root {
  --navy: #001f49;
  --navy-deep: #00122b;
  --night: #050a1f;
  --purple: #5e17eb;
  --purple-2: #8b5cf6;
  --purple-soft: #efe7fd;
  --teal: #00b6a6;
  --teal-dark: #00897d;
  --teal-soft: #dcf6f3;
  --bg: #f6f5f9;
  --surface: #ffffff;
  --ink: #16182b;
  --muted: #6b6f80;
  --line: #e3e2ea;
  --danger: #d13b3b;
  --danger-soft: #fde8e8;
  --warn: #e08a00;
  --warn-soft: #fff3dc;
  --ok: #1f9d55;
  --ok-soft: #e1f5e9;
  --info: #2a6de1;
  --info-soft: #e5eefc;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 31, 73, .06), 0 4px 16px rgba(0, 31, 73, .06);
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); display: flex; flex-direction: column; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--purple); }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ---------- Login ---------- */
.login-screen { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; overflow: auto;
  background: radial-gradient(ellipse at 30% 40%, #1a0b5c 0%, var(--night) 55%), var(--night); }
.login-net { position: absolute; inset: 0; background: url(red-teseo.svg) center/cover no-repeat; opacity: .7; animation: drift 40s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1) translateX(-1%); } to { transform: scale(1.06) translateX(1%); } }
@media (prefers-reduced-motion: reduce) { .login-net { animation: none; } }
.login-wrap { position: relative; display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; max-width: 380px; }
.login-logo { width: 132px; height: 132px; border-radius: 50%; box-shadow: 0 0 60px rgba(94, 23, 235, .45); }
.login-card { width: 100%; background: rgba(255, 255, 255, .97); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.login-card h1 { font-size: 28px; color: var(--navy); }
.login-card h1::after { content: ''; display: block; width: 44px; height: 4px; border-radius: 2px; margin-top: 6px; background: linear-gradient(90deg, var(--purple), var(--teal)); }
.login-sub { margin: -4px 0 6px; color: var(--muted); letter-spacing: .02em; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 14px; border: 1px solid #c9ccd6; border-radius: 10px;
  background: #fff; color: #1f1f1f; font-weight: 600; font-size: 15px; text-decoration: none; transition: box-shadow .15s, background .15s; }
.btn-google:hover { background: #f7f8fa; box-shadow: 0 2px 8px rgba(0, 18, 43, .15); }
.btn-google:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.login-alt { border-top: 1px solid #e3e5ec; padding-top: 10px; }
.login-alt summary { cursor: pointer; font-size: 13px; color: var(--muted); text-align: center; list-style: none; }
.login-alt summary::-webkit-details-marker { display: none; }
.login-alt summary:hover { color: var(--navy); }
.login-alt form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.login-error { color: var(--danger); min-height: 1em; margin: 0; font-size: 13px; }
.login-hint, .login-version { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.login-env { margin: 0; text-align: center; font-weight: 700; color: var(--warn); font-size: 12px; }
body.logged-out > :not(.login-screen):not(dialog):not(.toast) { display: none !important; }
body:not(.logged-out) .login-screen { display: none; }

/* ---------- Barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 8px 20px; color: #fff;
  background: linear-gradient(100deg, var(--navy) 0%, var(--navy) 55%, #1b0c63 100%); box-shadow: 0 2px 10px rgba(0, 18, 43, .25); }
.topbar::before { content: ''; position: absolute; inset: 0; background: url(red-teseo.svg) right center/60% auto no-repeat; opacity: .35; pointer-events: none; }
.topbar > * { position: relative; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex-shrink: 0; }
.brand-mark { width: 42px; height: 42px; border-radius: 50%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; font-size: 18px; }
.brand-sub { font-size: 10px; letter-spacing: .28em; text-transform: uppercase; color: var(--teal); }
.main-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.main-nav a { color: #cfd6ea; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; white-space: nowrap; position: relative; }
.main-nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.main-nav a.active { color: #fff; background: rgba(139, 92, 246, .28); }
.main-nav a.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--teal); }
.nav-badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--teal); color: var(--navy-deep); font-size: 11px; font-weight: 800; text-align: center; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.user-badge { font-size: 12px; color: #dfe4f2; text-align: right; line-height: 1.2; }
.user-badge b { display: block; color: #fff; font-size: 13px; }
.menu { position: relative; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; color: var(--ink); border-radius: 10px; box-shadow: var(--shadow), 0 10px 30px rgba(0, 0, 0, .15); min-width: 230px; max-width: calc(100vw - 16px); padding: 6px; display: flex; flex-direction: column; z-index: 30; }
.menu-panel button { text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 6px; cursor: pointer; }
.menu-panel button:hover { background: var(--purple-soft); }
.env-banner { background: var(--warn); color: #fff; text-align: center; font-weight: 700; font-size: 12px; padding: 4px; letter-spacing: .04em; }
.app-footer { text-align: center; color: var(--muted); font-size: 12px; padding: 14px; }
.app-footer a { color: var(--muted); }

/* ---------- Botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 9px; padding: 8px 14px; font-weight: 600; cursor: pointer; background: #fff; border-color: var(--line); color: var(--ink); text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { border-color: #c9c6d6; background: #fbfaff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--purple), #7a3cf0); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(94, 23, 235, .25); }
.btn-primary:hover { background: linear-gradient(135deg, #5310d6, var(--purple)); }
.btn-teal { background: var(--teal); color: #fff; border-color: transparent; }
.btn-teal:hover { background: var(--teal-dark); }
.btn-danger { color: var(--danger); border-color: #f1c4c4; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn-ok:hover { background: #18834a; }
.btn-link { background: none; border: 0; color: var(--purple); padding: 4px 6px; cursor: pointer; font-weight: 600; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn-ghost-light:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .5); }
.icon-btn { width: 36px; height: 36px; padding: 0; font-size: 18px; border-radius: 9px; cursor: pointer; }
input, select, textarea { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid rgba(94, 23, 235, .35); outline-offset: 1px; border-color: var(--purple); }
textarea { resize: vertical; min-height: 70px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span:not(.hint) { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field.invalid input, .field.invalid select { border-color: var(--danger); background: var(--danger-soft); }
.field .hint { font-size: 12px; color: var(--muted); }
.modal .field input, .modal .field select, .modal .field textarea { width: 100%; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---------- Estructura de las vistas ---------- */
.app { flex: 1; padding: 20px; max-width: 1400px; width: 100%; margin: 0 auto; outline: none; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.view-head h1 { font-size: 24px; color: var(--navy); }
.view-head h1 small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #ecebf2; }
.card + .card { margin-top: 16px; }
.card-pad { padding: 16px 18px; }
.card-title { font-size: 15px; color: var(--navy); display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border: 1px solid #ecebf2; position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--purple); }
.kpi.teal::before { background: var(--teal); }
.kpi.warn::before { background: var(--warn); }
.kpi.ok::before { background: var(--ok); }
.kpi.danger::before { background: var(--danger); }
.kpi-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 24px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-value.money { font-size: 18px; white-space: nowrap; }

/* Navegación de semana / mes */
.period-nav { display: inline-flex; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.period-nav button { border: 0; background: none; padding: 8px 12px; cursor: pointer; font-weight: 700; }
.period-nav button:hover { background: var(--purple-soft); }
.period-nav .label { padding: 0 12px; font-weight: 700; min-width: 190px; text-align: center; color: var(--navy); }

/* ---------- Grilla semanal ---------- */
.week-wrap { overflow-x: auto; }
table.week { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 860px; }
.week th, .week td { padding: 6px; border-bottom: 1px solid var(--line); }
.week thead th { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; background: #faf9fd; position: sticky; top: 0; }
.week thead th.day { text-align: center; width: 82px; }
.week thead th.day b { display: block; font-size: 16px; color: var(--navy); }
.week thead th.today { background: var(--purple-soft); }
.week thead th.today b { color: var(--purple); }
.week thead th.weekend, .week td.weekend { background: #fbfbfd; }
.week thead th.closed { background: repeating-linear-gradient(135deg, #f4f3f8, #f4f3f8 6px, #eceaf3 6px, #eceaf3 12px); }
.week td.rowhead { min-width: 260px; }
.row-client { font-size: 11px; font-weight: 700; color: var(--teal-dark); text-transform: uppercase; letter-spacing: .05em; }
.row-ticket { font-weight: 600; }
.row-ticket .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--purple-soft); color: var(--purple); padding: 1px 6px; border-radius: 5px; margin-right: 6px; }
.row-acts { font-size: 11px; color: var(--muted); }
.week td.cell { text-align: center; padding: 4px; }
.cell-input { width: 64px; text-align: center; padding: 7px 4px; font-weight: 700; font-variant-numeric: tabular-nums; border-color: transparent; background: #f7f6fb; transition: background .15s; }
.cell-input:hover { background: #efedf7; }
.cell-input:focus { background: #fff; }
.cell-input.has { background: #fff; border-color: var(--line); }
.cell-input.st-Borrador { border-color: #c9c6d6; border-style: dashed; }
.cell-input.st-Enviado { border-color: #9cbcf2; background: var(--info-soft); }
.cell-input.st-Aprobado { border-color: #9fd9b6; background: var(--ok-soft); }
.cell-input.st-Rechazado { border-color: #f1a5a5; background: var(--danger-soft); }
.cell-input:disabled { cursor: pointer; color: var(--ink); opacity: 1; }
.cell-input.saving { opacity: .55; }
.cell-multi { display: inline-flex; flex-direction: column; align-items: center; width: 64px; padding: 4px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; }
.cell-multi small { font-size: 10px; color: var(--muted); font-weight: 600; }
.week td.total, .week th.total { text-align: right; font-weight: 800; color: var(--navy); width: 70px; }
.week tfoot td { font-weight: 800; color: var(--navy); background: #faf9fd; border-bottom: 0; }
.week tfoot td.cell { font-variant-numeric: tabular-nums; }
.week tfoot td.over { color: var(--danger); }
.week tfoot td.under { color: var(--warn); }
.row-actions { opacity: 0; transition: opacity .15s; }
tr:hover .row-actions { opacity: 1; }
.add-row { display: flex; gap: 8px; align-items: center; padding: 12px; flex-wrap: wrap; border-top: 1px dashed var(--line); }
.add-row select { max-width: 260px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid; vertical-align: -2px; margin-right: 4px; }

/* Chips de tickets y actividades */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer; user-select: none; }
.chip:hover { border-color: var(--purple-2); }
.chip.on { background: var(--purple); border-color: var(--purple); color: #fff; }
.ticket-list { display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow: auto; }
.ticket-item { text-align: left; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.ticket-item:hover { border-color: var(--purple-2); background: #fbf9ff; }
.ticket-item .t-code { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--purple); font-weight: 700; }
.ticket-item .t-name { font-weight: 600; font-size: 13px; }
.ticket-item .t-meta { font-size: 11px; color: var(--muted); }
.quick-hours { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* Estados */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.Borrador { background: #eeedf3; color: #57536b; }
.badge.Enviado { background: var(--info-soft); color: var(--info); }
.badge.Aprobado { background: var(--ok-soft); color: var(--ok); }
.badge.Rechazado { background: var(--danger-soft); color: var(--danger); }
.badge.trb { background: var(--purple-soft); color: var(--purple); }
.badge.off { background: #eee; color: #888; }
.badge.on { background: var(--teal-soft); color: var(--teal-dark); }

/* ---------- Tablas de datos ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
.data th.sortable { cursor: pointer; user-select: none; }
.data th.sortable:hover { color: var(--ink); }
.data th.sorted { color: var(--purple); }
.data th .sort-ind { margin-left: 4px; font-size: 10px; opacity: .45; }
.data th.sorted .sort-ind { opacity: 1; }
.data th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px; border-bottom: 2px solid var(--line); background: #faf9fd; white-space: nowrap; cursor: default; }
.data th.num { text-align: right; }
.data th.sortable { cursor: pointer; }
.data th.sortable:hover { color: var(--purple); }
.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data tbody tr:hover { background: #fbfaff; }
.data tr.selected { background: #f4efff; }
.data tfoot td { font-weight: 800; color: var(--navy); background: #faf9fd; }
.data .notes { max-width: 340px; color: var(--muted); font-size: 12px; white-space: pre-line; }
.data .reject { color: var(--danger); font-size: 12px; }
.data td.actions { white-space: nowrap; text-align: right; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filters .field { min-width: 140px; }
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 16px; background: var(--purple-soft); border-bottom: 1px solid #ddd0fb; }
.bulkbar b { color: var(--purple); }
.group-row td { background: #f3f1fa; font-weight: 700; color: var(--navy); }
.bar { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--purple), var(--teal)); min-width: 2px; }
.bar-cell { width: 34%; }

/* ---------- Calendario ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-head { background: #faf9fd; padding: 8px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; text-align: center; }
.cal-day { background: #fff; min-height: 104px; padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: background .15s; }
.cal-day:hover { background: #fbf9ff; }
.cal-day.other { background: #fafafa; color: #b5b3c0; }
.cal-day.weekend { background: #fbfbfd; }
.cal-day.today .cal-num { background: var(--purple); color: #fff; }
.cal-day.closed { background: repeating-linear-gradient(135deg, #fff, #fff 8px, #f6f5fa 8px, #f6f5fa 16px); }
.cal-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.cal-total { font-size: 20px; font-weight: 800; color: var(--navy); }
.cal-total.zero { color: #cfcde0; font-size: 14px; font-weight: 600; }
.cal-items { font-size: 11px; color: var(--muted); line-height: 1.3; overflow: hidden; }
.cal-dots { display: flex; gap: 3px; }
.cal-dots i { width: 8px; height: 8px; border-radius: 50%; }
.dot-Borrador { background: #b3afc6; }
.dot-Enviado { background: var(--info); }
.dot-Aprobado { background: var(--ok); }
.dot-Rechazado { background: var(--danger); }

/* ---------- Configuración ---------- */
.subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.subtabs button { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px 12px; font-weight: 600; cursor: pointer; }
.subtabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.key-box { font-family: ui-monospace, Menlo, monospace; background: var(--navy-deep); color: #9ff3ea; padding: 12px; border-radius: 9px; word-break: break-all; }
.status-line { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }

/* ---------- Modal ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 16px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 30px 80px rgba(0, 18, 43, .35); }
dialog.modal.wide { width: min(900px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(5, 10, 31, .55); backdrop-filter: blur(2px); }
.modal-card { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(100deg, #fff 60%, var(--purple-soft)); }
.modal-head h2 { font-size: 18px; color: var(--navy); }
.modal-x { background: none; border: 0; }
.modal-x:hover { background: var(--purple-soft); }
.modal-body { padding: 18px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: #faf9fd; flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
.form-error { color: var(--danger); margin: 0 20px; font-size: 13px; font-weight: 600; }
.form-error:empty { display: none; }
.days-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.days-pick label { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; cursor: pointer; min-width: 52px; font-size: 11px; font-weight: 700; color: var(--muted); }
.days-pick label b { font-size: 15px; color: var(--ink); }
.days-pick input { display: none; }
.days-pick label:has(input:checked) { background: var(--purple); border-color: var(--purple); color: #fff; }
.days-pick label:has(input:checked) b { color: #fff; }
.days-pick label.disabled { opacity: .4; cursor: not-allowed; }
.alert { padding: 10px 12px; border-radius: 9px; font-size: 13px; }
.alert.warn { background: var(--warn-soft); color: #8a5300; }
.alert.danger { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--info-soft); color: #1f4fa6; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 100; font-weight: 600; max-width: calc(100vw - 32px); }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--teal-dark); }

/* ---------- Tira de días (solo celular) ---------- */
.day-strip { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .layout-side { grid-template-columns: minmax(0, 1fr); }
  .user-badge, .brand-sub { display: none; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .main-nav { order: 3; flex-basis: 100%; }
  .brand-sub, .user-badge { display: none; }
  .app { padding: 14px 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .period-nav .label { min-width: 0; }
  .cal-day { min-height: 70px; padding: 4px; }
  .cal-items { display: none; }
  .cal-total { font-size: 15px; }

  /* Celular: menú en una fila que se desliza, textos a 16px (iPhone no hace zoom al escribir) */
  .main-nav { flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .main-nav a { padding: 8px 10px; }
  input, select, textarea { font-size: 16px; }
  .view-head { align-items: stretch; }
  .view-head h1 { font-size: 20px; }
  .toolbar { width: 100%; }
  .toolbar .field { flex: 1 1 100%; }
  .toolbar .field select { width: 100%; }
  .period-nav .label { white-space: nowrap; padding: 0 4px; }
  .period-nav { flex: 1; justify-content: space-between; }
  .period-nav button { padding: 10px 14px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 20px; }

  /* Mi semana: un día por vez, elegido en la tira de días */
  .day-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); background: #faf9fd; }
  .day-strip button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; font-size: 11px; color: var(--muted); font-weight: 700; cursor: pointer; }
  .day-strip button b { font-size: 16px; color: var(--navy); }
  .day-strip button small { font-size: 11px; color: var(--teal-dark); font-weight: 700; }
  .day-strip button.nh { background: #fbfbfd; }
  .day-strip button.today { border-color: var(--purple-2); }
  .day-strip button.sel { background: var(--purple); border-color: var(--purple); color: #e9defd; }
  .day-strip button.sel b, .day-strip button.sel small { color: #fff; }
  table.week { min-width: 0; }
  .week .wd { display: none; }
  .week[data-sel="0"] .wd-0, .week[data-sel="1"] .wd-1, .week[data-sel="2"] .wd-2, .week[data-sel="3"] .wd-3,
  .week[data-sel="4"] .wd-4, .week[data-sel="5"] .wd-5, .week[data-sel="6"] .wd-6 { display: table-cell; }
  .week thead th.day { width: 96px; }
  .week td.rowhead { min-width: 0; overflow-wrap: anywhere; }
  .week thead th.total, .week td.total { display: none; }
  .cell-input, .cell-multi { width: 84px; }
  .cell-input { padding: 10px 4px; }
  .add-row select { max-width: none; flex: 1 1 100%; }
  .add-row .spacer { display: none; }
  .add-row .btn { flex: 1 1 auto; }
  .legend span:last-child { flex-basis: 100%; }

  /* Ventanas a pantalla completa desde abajo */
  dialog.modal, dialog.modal.wide { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .modal-card { max-height: 92dvh; }
  .modal-foot .btn { flex: 1 1 auto; }
}
@media print {
  .topbar, .app-footer, .toolbar, .filters, .bulkbar, .env-banner, .row-actions { display: none !important; }
  .card { box-shadow: none; border: 0; }
}

/* Feriados, vacaciones y autorizaciones de días no hábiles */
.day-tag { display: block; margin: 3px auto 0; width: fit-content; max-width: 100%; font-size: 10px; font-weight: 700; line-height: 1.3; padding: 1px 6px; border-radius: 8px; text-transform: none; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 0; font-family: inherit; }
.day-tag.fer { background: #fdecec; color: var(--danger); }
.day-tag.vac { background: var(--teal-soft); color: var(--teal-dark); }
.day-tag.ok { background: var(--ok-soft); color: var(--ok); }
.day-tag.pend { background: #fff3dc; color: var(--warn); }
.day-tag.req { background: var(--purple-soft); color: var(--purple); cursor: pointer; }
.day-tag.req:hover { background: var(--purple); color: #fff; }
.week thead th.holiday, .week td.holiday { background: #fff6f6; }
.week thead th.vac { box-shadow: inset 0 -3px 0 var(--teal); }
.cal-day.holiday { background: #fff6f6; }
.cal-day.vac { box-shadow: inset 0 0 0 2px var(--teal-soft); }
.cal-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-tags .day-tag { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.tag-add { display: flex; gap: 6px; margin-top: 8px; }
.tag-add input { flex: 1; }
.avisos { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 14px; }
.avisos > div { display: grid; gap: 4px; }
.alert.ok { background: var(--ok-soft); color: #11603a; }
.pedido-item { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.mis-pedidos-links { display: flex; gap: 14px; margin-top: 8px; }
.data tr.group-row td { background: var(--purple-soft); color: var(--navy); font-size: 14px; padding: 10px 12px; border-top: 10px solid #fff; border-bottom: 1px solid #d9cdf7; }
.data tr.group-row:first-child td { border-top: 0; }
.data tr.group-row .btn-link { float: right; }

/* Actividad: barras de consumo y sesión propia */
.usage-bar { display: inline-block; width: 140px; height: 8px; background: #ecebf2; border-radius: 99px; overflow: hidden; vertical-align: middle; }
.usage-bar i { display: block; height: 100%; background: var(--purple); border-radius: 99px; }
.data tr.current td { background: #f6f3ff; }
