/* Colores corporativos: /brand.css los sobrescribe con los de Ajustes */
:root {
  color-scheme: light;
  --brand: #00165c; --brand-dark: #001045; --on-brand: #fff;
  --accent: #3dff9e; --accent-dark: #31cc7e; --on-accent: #00165c; --accent-soft: #e2fff0; --accent-ink: #1b7347;
  --bg: #f2f5f8; --card: #fff; --text: #00165c; --muted: #5f6f83; --line: #dfe7ea;
  --ok: #1b7347; --warn: #a15c07; --warn-bg: #fdf3e3; --err: #b42318; --err-bg: #fdecea;
  --radius: 16px; --shadow: 0 1px 2px rgba(28,43,79,.06), 0 4px 16px rgba(28,43,79,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }

/* Cabecera */
header.bar { position: sticky; top: 0; z-index: 6; background: #fff; border-bottom: 3px solid var(--accent);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; display: flex; align-items: center; gap: 12px; }
header.bar .logo { height: 34px; width: auto; display: block; }
header.bar .who { flex: 1; text-align: right; font-size: 14px; color: var(--muted); line-height: 1.2; overflow: hidden; }
header.bar .who b { color: var(--text); display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  min-width: 44px; height: 44px; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; }

main { max-width: 640px; margin: 0 auto; padding: 16px 16px 120px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
h2 { font-size: 18px; margin: 0 0 12px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; font-weight: 600; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: #fff;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 50px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
button { font: inherit; cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 12px 18px; min-height: 50px; background: var(--bg); color: var(--text); font-weight: 650; border: 1px solid var(--line); }
.btn.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn.primary:active { background: var(--brand-dark); }
.btn.accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.danger { background: var(--err-bg); color: var(--err); border-color: transparent; }
.btn.link { background: none; border: 0; color: var(--accent-ink); min-height: 0; padding: 6px; text-decoration: underline; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; color: var(--text); border-radius: 999px;
  padding: 8px 16px; min-height: 44px; min-width: 52px; font-weight: 700; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.muted { color: var(--muted); font-size: 14px; }
.status { border-radius: 12px; padding: 12px 14px; font-weight: 650; font-size: 15px; display: flex; gap: 10px; align-items: center; }
.status.ok { background: var(--accent-soft); color: var(--ok); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.err { background: var(--err-bg); color: var(--err); }
.line { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; position: relative; background: #fbfdfd; }
.line .remove { position: absolute; top: 6px; right: 6px; background: none; border: 0; color: var(--muted); font-size: 24px; padding: 4px 10px; }
.line .hours-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.line .hours-row input { width: 92px; flex: 0 0 92px; min-height: 44px; text-align: center; }
.datebar { display: flex; align-items: center; gap: 8px; }
.datebar .d { flex: 1; text-align: center; font-weight: 800; font-size: 18px; }
.datebar .d small { display: block; font-weight: 500; font-size: 13px; color: var(--muted); }
.datebar button { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--text); font-size: 22px; }
.datebar button:disabled { opacity: .3; }
.sticky-foot { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); z-index: 5; box-shadow: 0 -4px 16px rgba(28,43,79,.06); }
.sticky-foot .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.sticky-foot .total { font-weight: 800; white-space: nowrap; font-size: 18px; min-width: 64px; }
.hist-day { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.hist-day:last-child { border-bottom: 0; }
.kpi { display: flex; align-items: baseline; gap: 6px; }
.kpi b { font-size: 28px; }
.toast { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); background: var(--brand); color: var(--on-brand);
  padding: 12px 18px; border-radius: 12px; z-index: 30; max-width: calc(100% - 32px); font-weight: 650; box-shadow: var(--shadow); }
.hidden { display: none !important; }

/* Acceso */
.auth { max-width: 420px; margin: 0 auto; padding: 32px 16px 40px; }
.auth .brand-logo { display: block; width: min(200px, 60%); margin: 8px auto 22px; }
.auth h1 { font-size: 22px; margin: 0 0 4px; text-align: center; }
.auth p.lead { text-align: center; color: var(--muted); margin: 0 0 18px; }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); font-size: 14px; font-weight: 600; padding: 8px; }

/* Hoja lateral (perfil) */
.sheet { position: fixed; inset: 0; background: rgba(15,27,51,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet .panel { background: #fff; width: 100%; max-width: 520px; border-radius: 20px 20px 0 0; padding: 20px 18px calc(env(safe-area-inset-bottom) + 20px); max-height: 90vh; overflow: auto; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.switch input { width: 52px; height: 30px; min-height: 0; accent-color: var(--accent); }

/* Oficina */
.admin main { max-width: 1400px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 57px; z-index: 5; }
.tabs button { border: 0; background: none; padding: 10px 14px; border-radius: 10px; font-weight: 650; color: var(--muted); white-space: nowrap; position: relative; }
.tabs button.on { background: var(--accent-soft); color: var(--brand); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--err); color: #fff; font-size: 12px; line-height: 20px; text-align: center; margin-left: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 650; font-size: 13px; }
.tbl-wrap { overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.pill { display: inline-block; white-space: nowrap; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg); }
.pill.ok { background: var(--accent-soft); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(580px, calc(100% - 32px)); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(15,27,51,.45); }
dialog .card { margin: 0; border: 0; box-shadow: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.toolbar > div { flex: 0 0 auto; }
.toolbar .grow { flex: 1 1 200px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; border: 1px solid var(--line); }

/* Vista del mes */
.month { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.month th, .month td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 5px 6px; white-space: nowrap; }
.month thead th { position: sticky; top: 0; background: #fff; z-index: 2; color: var(--text); font-size: 12px; text-align: center; min-width: 96px; }
.month thead th small { display: block; color: var(--muted); font-weight: 500; max-width: 120px; overflow: hidden; text-overflow: ellipsis; margin: 0 auto; }
.month .day { position: sticky; left: 0; background: #fff; z-index: 1; font-weight: 700; min-width: 70px; }
.month tr.we td { background: #f3f5f7; }
.month tr.we .day { background: #eef1f4; }
.month tr.today td { box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
.month td.c { cursor: pointer; min-width: 96px; }
.month td.c:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.month td.missing { background: #fdeeee; }
.month td.abs { background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.month .o { display: flex; justify-content: space-between; gap: 6px; }
.month .o b { font-weight: 700; }
.month tfoot td { font-weight: 800; background: var(--accent-soft); position: sticky; bottom: 0; }
.month tfoot .day { background: var(--accent-soft); }
.month-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: 12px; }
