/* Globe on People. White layout, black text, navy brand; dark follows the laptop (prefers-color-scheme). */
:root {
  color-scheme: light dark;
  --bg: #fff;
  --soft: #f4f6f9;
  --panel: #fff;
  --line: #e2e6ec;
  --text: #000;
  --muted: #5b6574;
  --faint: #9aa3b0;
  --navy: #213a63;
  --primary: #213a63;
  --primary-text: #fff;
  --link: #1f4f9c;
  --focus: #2a6fd6;
  --ok: #146c3c; --okbg: #e2f3e8;
  --warn: #8a5200; --warnbg: #fdf0d8;
  --bad: #b3261e; --badbg: #fbe5e3;
  --sick: #574184; --sickbg: #ece7f6;
  --input: #fff; --inputline: #c8d0dc;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 10px rgba(16, 24, 40, .04);
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --soft: #141e33;
    --panel: #101a2c;
    --line: rgba(255, 255, 255, .09);
    --text: #f3f6fb;
    --muted: #9aa6b8;
    --faint: #66728a;
    --primary: #3e66ad;
    --link: #8fb4f2;
    --focus: #6fa0f5;
    --ok: #6fd39a; --okbg: rgba(111, 211, 154, .13);
    --warn: #f3b860; --warnbg: rgba(243, 184, 96, .13);
    --bad: #f08a83; --badbg: rgba(240, 138, 131, .13);
    --sick: #c4b2f0; --sickbg: rgba(196, 178, 240, .14);
    --input: rgba(0, 0, 0, .25); --inputline: rgba(255, 255, 255, .2);
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
h1 { font-size: 22px; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 10px; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.dim { color: var(--faint); }
.neg { color: var(--bad); }
.strong { font-weight: 650; }
.small-text { font-size: 12.5px; margin: 4px 0 8px; }
.sp { flex: 1; }
.center { text-align: center; }

/* ---------- top bar ---------- */
header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
  padding: 10px 22px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { height: 18px; width: auto; display: block; }
.brand-app { font-weight: 700; font-size: 14px; color: var(--text); padding-left: 8px; border-left: 1px solid var(--line); line-height: 18px; }
.seg { display: flex; gap: 2px; background: var(--soft); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg a { font-weight: 600; font-size: 13px; padding: 4px 12px; border-radius: 7px; color: var(--muted); text-decoration: none; }
.seg a.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
#whoami { font-size: 13px; color: var(--muted); text-decoration: none; font-weight: 600; }
#whoami:hover { color: var(--text); }

/* ---------- buttons and inputs ---------- */
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button.busy { opacity: .6; }
.primary, .secondary {
  border-radius: 10px; font-weight: 650; font-size: 14px; padding: 8px 14px; min-height: 36px;
  border: 1px solid transparent;
}
.primary { background: var(--primary); color: var(--primary-text); }
.primary:not(:disabled):hover { filter: brightness(1.12); }
.secondary { background: var(--panel); color: var(--text); border-color: var(--inputline); }
.secondary:not(:disabled):hover { background: var(--soft); }
.primary.danger { background: var(--bad); color: #fff; }
.secondary.danger { color: var(--bad); }
.big { width: 100%; min-height: 52px; font-size: 17px; border-radius: 12px; }
.link { background: none; border: 0; padding: 4px 6px; color: var(--link); font-weight: 600; font-size: 13px; text-decoration: none; }
.link:hover { text-decoration: underline; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
input, select {
  display: block; width: 100%; margin-top: 4px;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--input); border: 1px solid var(--inputline); border-radius: 10px;
  padding: 8px 10px; min-height: 42px;
}
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--primary); }
input:focus, select:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
input:disabled { background: var(--soft); color: var(--muted); }
.msg { min-height: 0; margin: 0; font-size: 13.5px; font-weight: 600; }
.msg:empty { display: none; }
.msg.ok { color: var(--ok); }
.msg.bad { color: var(--bad); }
.msg.warn { color: var(--warn); }

/* ---------- layout ---------- */
main { padding: 18px 22px 40px; }
.wrap { max-width: 1180px; margin: 0 auto; }
.wrap.narrow { max-width: 520px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.card.compact { padding: 14px; }
.pagehead { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 14px; }
h2.sub { margin: 24px 0 8px; font-size: 15px; }
h2.sub .muted { font-weight: 500; font-size: 13px; }
.back { display: inline-block; font-size: 13px; font-weight: 600; text-decoration: none; margin-bottom: 6px; }
.back::before { content: "\2039  "; }

/* ---------- login and password ---------- */
.auth { min-height: calc(100vh - 80px); display: grid; place-items: center; }
.authcard { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.auth-logo img { height: 26px; width: auto; display: block; }
.authcard h1 { margin-bottom: 6px; }
.authcard p { margin: 0; }

/* ---------- my hours ---------- */
.summary .sum-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sum-rem { display: flex; align-items: baseline; gap: 6px; }
.sum-rem .lbl { font-size: 13px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.sum-rem b { font-size: 34px; line-height: 1.05; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sum-rem .unit { font-size: 15px; color: var(--muted); font-weight: 600; }
.sum-of { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sum-of span { color: var(--text); font-weight: 650; }
/* The ruler: approved hours solid, pending hours hatched, ticks every 10 percent. */
.ruler {
  position: relative; display: flex; height: 12px; margin: 12px 0 12px; border-radius: 6px; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), var(--bg) calc(10% - 1px) 10%),
    var(--soft);
}
.ruler i { display: block; height: 100%; }
.ruler .ap { background: var(--navy); }
.ruler .pe { background: repeating-linear-gradient(135deg, var(--warn) 0 3px, transparent 3px 6px); opacity: .7; }
@media (prefers-color-scheme: dark) { .ruler .ap { background: #6f97dc; } }
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.sum-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sum-grid div { background: var(--soft); border-radius: 10px; padding: 8px 12px; }
.sum-grid dt { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.sum-grid dd { margin: 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary > p { margin: 0 0 10px; }

.entry { display: flex; flex-direction: column; gap: 12px; }
.entry-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.entry-head h2 { margin: 0; font-size: 17px; }
.entry-head input { width: auto; margin: 0; min-height: 40px; font-size: 15px; font-weight: 600; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.entry .fields input {
  min-height: 60px; font-size: 26px; font-weight: 650; text-align: center; border-radius: 12px;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.entry .fields input::placeholder { color: var(--faint); font-weight: 500; }
.note { margin: 0; font-size: 13.5px; font-weight: 600; padding: 8px 12px; border-radius: 10px; }
.note:empty { display: none; }
.note.ok { background: var(--okbg); color: var(--ok); }
.note.warn { background: var(--warnbg); color: var(--warn); }
.note.bad { background: var(--badbg); color: var(--bad); }
.note.sick { background: var(--sickbg); color: var(--sick); }
.net { display: flex; align-items: baseline; justify-content: center; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.net b { font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.net b.bad { font-size: 15px; color: var(--bad); }

.days { list-style: none; margin: 0 -8px; padding: 0; }
.days li + li { border-top: 1px solid var(--line); }
.day {
  display: grid; grid-template-columns: 92px 52px 1fr; align-items: center; gap: 2px 8px;
  width: 100%; padding: 9px 8px; background: none; border: 0; text-align: left; color: var(--text); font-size: 14px;
  border-radius: 8px;
}
.day.edit:hover { background: var(--soft); }
.day .d { font-weight: 600; }
.day .h { font-variant-numeric: tabular-nums; text-align: right; font-weight: 650; }
.day .b { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.day .reason { grid-column: 1 / -1; font-size: 13px; color: var(--bad); padding-left: 2px; }
.day .reason::before { content: "Reason: "; font-weight: 650; }
.weekend .d { color: var(--muted); font-weight: 500; }
.none { color: var(--faint); font-size: 13px; }
.badge { display: inline-block; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.pending { background: var(--warnbg); color: var(--warn); }
.badge.approved { background: var(--okbg); color: var(--ok); }
.badge.rejected { background: var(--badbg); color: var(--bad); }
.badge.sick { background: var(--sickbg); color: var(--sick); }
.badge.manager { background: var(--soft); color: var(--muted); border: 1px solid var(--line); }

.sick p { margin: 0 0 10px; font-size: 14px; }
form.inline { display: flex; align-items: flex-end; gap: 10px; }
form.inline label { flex: 1; }
form.inline button { min-height: 42px; }
.sick .msg { margin-top: 8px; }

/* ---------- tables (team, person, admin) ---------- */
.tbl { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: auto; }
.tbl.audit { max-height: 480px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th {
  position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left;
  font-size: 12px; font-weight: 650; color: var(--muted); padding: 10px 12px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
th.n, td.n { text-align: right; font-variant-numeric: tabular-nums; }
td { padding: 0 12px; height: 38px; color: var(--text); white-space: nowrap; vertical-align: middle; }
tbody tr + tr td { border-top: 1px solid var(--line); }
tbody tr:hover td { background: var(--soft); }
td.name a { color: var(--text); font-weight: 650; text-decoration: none; }
td.name a:hover { text-decoration: underline; }
td.name .muted { font-size: 12px; margin-left: 4px; }
td.act { text-align: right; width: 1%; }
td.act .secondary, td.act .primary { min-height: 28px; padding: 3px 10px; font-size: 12.5px; border-radius: 8px; }
td.st { white-space: normal; min-width: 160px; }
td.st .reason { color: var(--bad); font-size: 12.5px; }
td.detail { max-width: 420px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
tr.inactive td { color: var(--faint); }
.reject-form { display: inline-flex; gap: 6px; align-items: center; }
.reject-form input { width: 220px; margin: 0; min-height: 30px; font-size: 13px; padding: 4px 8px; border-radius: 8px; }

.stats { margin-bottom: 14px; max-width: 720px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 14px; }
.side form { display: flex; flex-direction: column; gap: 10px; }
.side h2 { margin: 0; }
.fields.small { gap: 10px; }
.plain { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.plain li { padding: 4px 0; }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; font-size: 14px; }
.confirm .primary { min-height: 34px; padding: 6px 12px; }
.sick-list { margin-top: 10px; }
.sick-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.sick-list li .what { flex: 1; }
.sick-list li.cancelled .what { text-decoration: line-through; color: var(--faint); }

/* ---------- dialogs ---------- */
dialog {
  width: min(440px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 16px; padding: 0;
  background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(10, 18, 32, .45); }
dialog form, .dlg-body { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
dialog h2 { font-size: 17px; margin: 0; }
dialog p { margin: 0; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.temp { display: flex; gap: 8px; align-items: center; }
.temp code {
  flex: 1; font: 600 18px/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .04em;
  background: var(--soft); border: 1px dashed var(--inputline); border-radius: 10px; padding: 10px 12px; user-select: all;
}

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  header { padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); gap: 8px 10px; }
  #whoami { display: none; }
  /* Phone: logo and Sign out on one row, the tabs below (hidden when there is only My hours). */
  .brand { order: 1; }
  header .sp { order: 2; }
  #signout { order: 3; }
  #nav { order: 4; width: 100%; }
  #nav a { flex: 1; text-align: center; }
  #nav.single { display: none; }
  .hide-sm { display: none; }
  main { padding: 12px 12px 32px; }
  .card { padding: 14px; }
  .cols { grid-template-columns: 1fr; }
  .sum-grid.four { grid-template-columns: 1fr 1fr; }
  td.st { min-width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
