/* Work Hours — timesheet look: quiet surfaces, green accent, numbers in tabular figures.
   Layout: top bar with brand + nav, one centered column of panels. */
:root {
  /* MDA Power Engineering: navy + green from the logo */
  --bg: #f2f4f7;
  --surface: #ffffff;
  --ink: #16202e;
  --muted: #5d6879;
  --line: #d8dde5;
  --soft: #edf0f5;
  --accent: #0d3f7a;
  --accent-ink: #ffffff;
  --accent-soft: #e3ebf6;
  --green: #198923;
  --green-soft: #e3f3e5;
  --ot: #a8551c;
  --leave: #3a6fc4;
  --sick: #8a3b5a;
  --warn: #8a6a00;
  --warn-soft: #fbf3d6;
  --danger: #b0322a;
  --danger-soft: #fbe9e7;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161f; --surface: #18202c; --ink: #e3e8ef; --muted: #97a1b3; --line: #2c3546; --soft: #212a38;
    --accent: #7fa8e6; --accent-ink: #0b1626; --accent-soft: #1c2a40;
    --green: #5cc96a; --green-soft: #1b3322;
    --ot: #e0925a; --leave: #8fb0ea; --sick: #d98aaa; --warn: #e6c25a; --warn-soft: #3a3320;
    --danger: #ef8a80; --danger-soft: #3d2422;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
h1 { font-size: 22px; font-weight: 650; margin: 0; text-wrap: balance; }
h2 { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 12px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); font-weight: 400; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Top bar */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar { max-width: 1040px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
       display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand b { display: block; font-weight: 650; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: 12px; line-height: 1.2; }
.mark { width: 40px; height: 40px; border-radius: 8px; background: #ffffff; border: 1px solid var(--line); display: block; }
.hero-logo { display: flex; justify-content: center; margin-top: 12px; }
.hero-logo img { width: 220px; max-width: 70%; height: auto; background: #ffffff; border-radius: 14px; padding: 14px 18px; border: 1px solid var(--line); }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 4px; font-weight: 550; }
.nav a:hover { color: var(--ink); background: var(--soft); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 0; }

/* Page */
.wrap { max-width: 1040px; margin: 0 auto; padding-block: 20px 56px;
        padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
        display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; min-width: 0; }
.panel.narrow { max-width: 460px; width: 100%; margin: 24px auto 0; display: flex; flex-direction: column; gap: 4px; }
.panel.narrow h1 { margin-bottom: 8px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.month { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.month strong { font-size: 17px; font-weight: 650; min-width: 140px; text-align: center; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 550;
       color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 7px 13px;
       text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn.icon { padding: 3px 11px; font-size: 18px; line-height: 1.3; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Forms */
input, select { font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
                border-radius: 5px; padding: 8px 9px; width: 100%; min-width: 0; }
input:focus, select:focus { border-color: var(--accent); }
label { font-size: 13px; font-weight: 550; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack .btn { margin-top: 10px; }
.entry { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: span 2; }
.field.check { flex-direction: row; align-items: center; gap: 8px; grid-column: span 2; padding-bottom: 8px; }
.field.check input { width: auto; }
.field.check label { color: var(--ink); font-weight: 400; font-size: 14px; }
.actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline select { width: auto; max-width: 240px; }
.rowform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rowform input { flex: 1 1 180px; width: auto; }
@media (max-width: 680px) {
  .entry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .entry { grid-template-columns: minmax(0, 1fr); }
  .field.wide, .field.check { grid-column: auto; }
}

/* Messages */
.flash { background: var(--green-soft); color: var(--ink); border-radius: 6px; padding: 10px 14px; margin: 0; }
.error { background: var(--danger-soft); color: var(--danger); border-radius: 6px; padding: 10px 14px; overflow-wrap: anywhere; }
.testmode { background: var(--warn-soft); color: var(--ink); border-radius: 6px; padding: 10px 14px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.testmode ul { margin: 0; padding-left: 18px; }
.testmode code { font-family: var(--mono); font-size: 13px; }
.testmode .btn { align-self: flex-start; }
.notice { margin: 0; color: var(--muted); }
.empty { color: var(--muted); padding: 10px 0; margin: 0; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 0; margin: 0; background: var(--surface);
         border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stats div { background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
             box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font: 500 21px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.stats .ot dd { color: var(--ot); }
.stats .total dd { color: var(--green); font-weight: 650; }


/* Tables */
.scroll { position: relative; overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 650; color: var(--muted); white-space: nowrap; }
td.n, th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.ot { color: var(--ot); }
td.strong { font-weight: 650; }
td.act { text-align: right; white-space: nowrap; }
td.act .inline, td.act .btn { margin-left: 2px; }
td.note { color: var(--muted); max-width: 280px; overflow-wrap: anywhere; }
td.email, td.code { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
td.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 650; border-top: 2px solid var(--line); border-bottom: 0; }
tr.newday td { border-top: 1px solid var(--line); }
tr:not(.newday) td.date { border-top: 0; }
tr.weekend td.date { color: var(--muted); }
tr.inactive td { color: var(--muted); }
tr.editing td { background: var(--soft); }
.days tbody tr:hover td, table tbody tr:hover td { background: var(--soft); }

/* Chips and pills */
.chip { display: inline-block; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
        padding: 1px 7px; border-radius: 3px; border: 1px solid currentColor; white-space: nowrap; }
.t-work { color: var(--green); }
.t-annual_leave { color: var(--leave); }
.t-sick_leave { color: var(--sick); }
.t-holiday { color: var(--muted); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.locked { background: var(--warn-soft); color: var(--warn); }
.pill.admin { background: var(--accent-soft); color: var(--accent); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.hero-logo + .panel.narrow { margin-top: 0; }

/* Year view */
tr.future td { color: var(--muted); }
tr.current td:first-child a { font-weight: 650; }
table.matrix th, table.matrix td { padding: 7px 8px; }
table.matrix td.zero { color: var(--muted); }
table.matrix td.rowhead { white-space: nowrap; }

/* Portal */
.subnav { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-top: -4px; }
.subnav a { color: var(--muted); text-decoration: none; padding: 8px 12px; font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 22px; display: flex; flex-direction: column; gap: 8px;
        color: var(--ink); text-decoration: none; min-width: 0; }
a.tile:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(13, 63, 122, 0.10); }
.tile-icon { width: 46px; height: 46px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.tile-name { font-size: 19px; font-weight: 650; }
.tile-text { color: var(--muted); font-size: 14px; }
.tile-stat { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.tile-stat b { color: var(--ink); font-family: var(--mono); font-weight: 600; }
.tile.soon { background: transparent; border-style: dashed; justify-content: center; }
.field.full { grid-column: 1 / -1; }
input[type="file"] { padding: 7px; background: var(--surface); }
a.receipt { font-weight: 600; }
.c-transport, .c-accommodation, .c-per_diem { color: var(--leave); }
.c-fuel_tolls { color: var(--ot); }
.c-purchases { color: var(--green); }
.c-entertainment { color: var(--sick); }
.c-other { color: var(--muted); }
.curswitch { display: flex; flex-wrap: wrap; gap: 6px; }
h2.inline-h { margin: 0; }
td.conv, th.conv { background: var(--accent-soft); font-weight: 600; }
.warn-note { background: var(--warn-soft); color: var(--ink); border-radius: 6px; padding: 10px 14px; }
tr.missing td { background: var(--warn-soft); }
