/* StirCrazy Time Machine — "looking at the time machine's screen".
   The photo (assets/bg-clock-monitor.jpg) is the page header: title artwork
   sits in the dark upper-left of the monitor, navigation rides the light
   trails, and data continues below on smoked-glass panels over a blurred,
   dimmed copy of the same photo. One committed dark look (the artwork is
   dark), so there is no light theme.
   Fonts: Cinzel, IBM Plex Sans, IBM Plex Mono, defined just below. */

/* Fonts are served from this server, not from Google (POPIA: no visitor
   data goes to a third party). Latin set from Google Fonts, SIL OFL 1.1,
   licences next to the files. Cinzel and IBM Plex Sans are variable fonts. */
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("fonts/cinzel-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-display: swap; src: url("fonts/ibm-plex-sans-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-400-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-500-latin.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --bg-img: url("bg-clock-monitor.jpg");        /* relative to this stylesheet */
  --bg-img-small: url("bg-clock-monitor-small.jpg");
  --void:    #050918;   /* deep navy of the empty screen */
  --glass:   rgba(6, 12, 32, .74);
  --glass-2: rgba(0, 0, 0, .28);
  --arc:     #3fa9ff;   /* electric blue of the trails */
  --ion:     #8fe3ff;   /* hot cyan core of the trails */
  --brass:   #c9a66b;   /* aged clock case */
  --numeral: #ece6d6;   /* clock numerals: body text */
  --mist:    #93a6c4;   /* secondary text */
  --line:    rgba(143, 227, 255, .16);
  --ok:      #5fd3a0;
  --warn:    #f2b35a;
  --bad:     #ff7b88;
  --violet:  #a88bff;   /* after-hours */
  --f-display: "Cinzel", "Trajan Pro", "Times New Roman", serif;
  --f-body:    "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono:    "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html { background: var(--void); }
body {
  margin: 0; min-height: 100vh; position: relative;
  background: var(--void); color: var(--numeral);
  font: 15px/1.55 var(--f-body);
}
body::before {                     /* the ground: same photo, blurred and dimmed */
  content: ""; position: fixed; inset: -40px; z-index: -1;
  background: var(--bg-img-small) center / cover no-repeat;
  filter: blur(22px) brightness(.32) saturate(1.2);
}
a { color: var(--ion); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--ion); outline-offset: 3px; }
img { max-width: 100%; }

/* ---------- the stage: the photo at its true proportions ---------- */
.stage {
  position: relative; container-type: inline-size;
  width: 100%; max-width: 1680px; margin-inline: auto;
  aspect-ratio: 1376 / 768;
  background: var(--bg-img) center top / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 3%, #000 97%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 3%, #000 97%, transparent 100%);
}
/* data pages: crop the bottom of the photo and fade it into the panels */
.page-data .stage {
  aspect-ratio: 1376 / 640;
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 100%), linear-gradient(90deg, transparent 0, #000 3%, #000 97%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(180deg, #000 72%, transparent 100%), linear-gradient(90deg, transparent 0, #000 3%, #000 97%, transparent 100%);
          mask-composite: intersect;
}

/* the dark top-left of the monitor */
.zone { position: absolute; left: 10.5%; top: 9.5%; width: 40%; display: grid; gap: 1cqw; justify-items: start; }
.page-data .zone { top: 11.5%; }
.zone h1 { margin: 0; line-height: 0; }
.art-brand   { width: 30cqw; min-width: 240px; height: auto; }
.art-powered { width: 21cqw; min-width: 200px; height: auto; margin-top: -.4cqw; }
.art-strip   { height: 2.3cqw; min-height: 20px; width: auto; }
.art-title   { height: 5.6cqw; min-height: 44px; width: auto; }
.art-heading { height: 34px; width: auto; display: block; }
.period { font: 500 clamp(12px, .95cqw, 16px) var(--f-mono); color: var(--ion); letter-spacing: .02em; }
.period b { color: var(--brass); font-family: var(--f-display); font-weight: 700; letter-spacing: .12em; }

/* navigation rides the light trails */
.trail { position: absolute; left: 10.5%; top: 72%; display: flex; flex-wrap: wrap; gap: .8cqw; max-width: 64%; }
.page-full .trail { top: 60%; }
.signed-in {
  position: absolute; right: 4.5%; top: 4%;
  font-size: clamp(11px, .8cqw, 13px); color: var(--mist);
  background: rgba(5, 9, 24, .6); padding: .35em .9em; border-radius: 999px;
}
.signed-in b { color: var(--numeral); font-weight: 500; }

/* ---------- buttons ---------- */
.btn, .button-secondary {
  display: inline-flex; align-items: center; gap: .5em;
  font: 500 clamp(12px, 1cqw, 15px)/1 var(--f-body); letter-spacing: .03em;
  color: var(--numeral); text-decoration: none; cursor: pointer;
  padding: .85em 1.3em; border-radius: 999px;
  background: rgba(5, 9, 24, .78); border: 1px solid rgba(143,227,255,.35);
  backdrop-filter: blur(6px);
  box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.45);
  transition: border-color .2s, box-shadow .2s, color .2s;
}
.button-secondary { font-size: 14px; padding: .7em 1.2em; }
.btn:hover, .button-secondary:hover { border-color: var(--ion); box-shadow: 0 0 18px rgba(63,169,255,.55), 0 6px 20px rgba(0,0,0,.45); text-decoration: none; }
.btn[aria-current="page"] { border-color: var(--brass); color: #f6ecd6; box-shadow: inset 0 0 0 1px rgba(201,166,107,.5), 0 6px 20px rgba(0,0,0,.45); }

button {
  font: 600 14px/1 var(--f-body); letter-spacing: .02em; cursor: pointer;
  color: #fff; padding: .75em 1.3em; border-radius: 999px;
  background: linear-gradient(180deg, #2c8cf0, #1560c4); border: 1px solid var(--ion);
  transition: box-shadow .2s;
}
button:hover { box-shadow: 0 0 16px rgba(63,169,255,.55); }
button:active { transform: translateY(1px); }
.link-button {
  background: none; border: 0; padding: 0; border-radius: 0;
  color: var(--ion); font: 500 13px var(--f-body); text-decoration: underline; text-underline-offset: 3px;
}
.link-button:hover { box-shadow: none; color: #fff; }
.link-button.danger { color: var(--bad); }

/* ---------- forms ---------- */
label { color: var(--mist); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
input, select, textarea {
  font: 15px var(--f-body); color: var(--numeral); letter-spacing: normal; text-transform: none;
  background: rgba(0,0,0,.35); border: 1px solid rgba(147,166,196,.3); border-radius: 7px;
  padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { border-color: var(--ion); outline: none; box-shadow: 0 0 0 3px rgba(63,169,255,.25); }
input[type=checkbox] { accent-color: var(--arc); width: 16px; height: 16px; padding: 0; }
input[type=color] { height: 40px; width: 64px; padding: 3px; }
label > input:not([type=checkbox]), label > select, label > textarea { display: block; margin-top: 5px; width: 100%; }
label > input[type=color] { width: 72px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--numeral); text-transform: none; letter-spacing: 0; }
.check input { margin: 0; }

/* ---------- panels below the stage ---------- */
.below { max-width: 1320px; margin: -3rem auto 0; padding: 0 16px 48px; position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
/* a page that starts with a plain heading (no glass panel) must clear the faded photo */
.below > :first-child:not(.panel):not(.notice):not(.error) { margin-top: 3.4rem; }
.panel {
  background: var(--glass); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px;
  min-width: 0;
}
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin-bottom: 14px; }
.panel h2, .panel h3 { margin: 0; font: 700 20px/1.2 var(--f-display); letter-spacing: .06em; color: #efe3c8; }
.panel h3 { font-size: 17px; }
.panel h2:has(img) { line-height: 0; }
.note { font-size: 13px; color: var(--mist); }
.section-title { margin: 6px 0 0; font: 700 20px/1.2 var(--f-display); letter-spacing: .06em; color: #efe3c8; }
.intro { margin: 0; max-width: 70ch; color: var(--mist); font-size: 14px; }
.intro strong { color: var(--numeral); }

.notice, .alert, .error {
  padding: 11px 16px; border-radius: 10px; font-size: 14px; backdrop-filter: blur(10px);
}
.notice { background: rgba(63,169,255,.14); border: 1px solid rgba(143,227,255,.45); color: var(--numeral); }
.alert, .error { background: rgba(255,123,136,.12); border: 1px solid var(--bad); color: #ffc2c8; }

.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; }
.filters label:not(.check) { min-width: 150px; }
.filters .check { padding-bottom: 9px; }

/* totals */
.dials { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.dial { padding: 14px 16px; border-radius: 10px; background: var(--glass-2); border: 1px solid var(--line); display: grid; gap: 6px; align-content: start; }
.dial .lbl { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--mist); }
.dial .v { font: 500 26px/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.dial .s { font-size: 12px; color: var(--mist); }
.dial.biz .v { color: var(--ion); }
.dial.ah .v { color: var(--violet); }
.dial.hol .v { color: var(--brass); }
.split, .minibar { display: flex; overflow: hidden; border-radius: 3px; background: rgba(255,255,255,.06); }
.split { height: 6px; }
.minibar { display: inline-flex; width: 70px; height: 5px; vertical-align: middle; }
.split i, .minibar i { display: block; height: 100%; }
.split .b, .minibar .b { background: var(--ion); }
.split .a, .minibar .a { background: var(--violet); }
.split .h, .minibar .h { background: var(--brass); }

/* tables */
.scroll { overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.report-table th {
  text-align: left; font: 600 11px var(--f-body); letter-spacing: .1em; text-transform: uppercase;
  color: var(--mist); padding: 8px 7px; border-bottom: 1px solid rgba(201,166,107,.35); vertical-align: bottom;
}
.report-table td { padding: 9px 7px; border-bottom: 1px solid rgba(143,227,255,.08); white-space: nowrap; vertical-align: middle; }
.report-table tbody tr:hover td { background: rgba(63,169,255,.07); }
.report-table tr:last-child td { border-bottom: 0; }
.report-table .num { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.report-table td.co { font-weight: 500; }
.report-table td.wrap { white-space: normal; }
.internal-row td { color: var(--mist); font-style: italic; }
.holiday-cell { color: var(--brass); font-weight: 600; }
.savings-positive { color: var(--ok); font-weight: 600; }
.past-row { opacity: .5; }
.notes-cell { font-size: 13px; color: var(--mist); white-space: normal !important; max-width: 340px; }

.pill, .tag, .badge, .role-badge {
  display: inline-block; font: 600 11px var(--f-body); letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; font-style: normal; white-space: nowrap;
}
.tag, .badge-auto, .role-standard { color: var(--mist); background: rgba(147,166,196,.12); }
.badge-manual { color: var(--brass); background: rgba(201,166,107,.14); }
.role-admin { color: var(--ion); background: rgba(63,169,255,.16); }
.pill.ok { color: var(--ok); background: rgba(95,211,160,.12); }
.pill.warn { color: var(--warn); background: rgba(242,179,90,.14); }
.pill.api { color: var(--mist); background: rgba(147,166,196,.12); }

/* settings: expandable rows (users, clients) */
details.row {
  background: var(--glass); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 12px;
}
details.row summary {
  cursor: pointer; padding: 14px 18px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  list-style: none; font-weight: 500;
}
details.row summary::-webkit-details-marker { display: none; }
details.row summary::before { content: "▸"; color: var(--brass); transition: transform .2s; }
details.row[open] summary::before { transform: rotate(90deg); }
.panel > details > summary { list-style: none; }
.panel > details > summary::-webkit-details-marker { display: none; }
.panel > details > summary h2::before { content: "▸ "; color: var(--brass); }
.panel > details[open] > summary h2::before { content: "▾ "; }
details.row .row-body { padding: 4px 18px 18px; border-top: 1px solid var(--line); display: grid; gap: 16px; }
.stack { display: grid; gap: 10px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.inline-row { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; }
.company-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.subtle { border-top: 1px dashed rgba(147,166,196,.25); padding-top: 14px; }

/* branding */
textarea.template { font: 13px/1.5 var(--f-mono); min-height: 220px; width: 100%; }
.placeholders { font-size: 12px; color: var(--mist); line-height: 1.9; }
.placeholders code { font-family: var(--f-mono); background: rgba(255,255,255,.07); padding: 1px 6px; border-radius: 4px; color: var(--numeral); }

/* ---------- login ---------- */
.login-card {
  position: absolute; left: 10.5%; top: 43%; width: 27%; min-width: 270px;
  display: grid; gap: 14px; padding: 1.6cqw 1.8cqw;
  background: var(--glass); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 12px;
}
.login-card button { width: 100%; margin-top: 4px; }
.login-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; }
.login-links a { color: var(--mist); text-decoration: none; }
.login-links a:hover, .login-links a:focus-visible { color: var(--numeral); text-decoration: underline; }
.login-foot { position: absolute; left: 10.5%; bottom: 7%; font-size: clamp(11px, .8cqw, 13px); color: var(--mist); background: rgba(5, 9, 24, .7); padding: .35em .9em; border-radius: 999px; }

/* An error message makes the card taller; on wide screens it would reach the copyright label. */
@media (min-width: 761px) { .login-card:has(.alert) ~ .login-foot { display: none; } }

.site-foot { text-align: center; color: var(--mist); font-size: 12px; padding: 0 16px 28px; }
.page-full .site-foot { display: none; }

/* ---------- phone and narrow screens: photo becomes a cropped backdrop ---------- */
@media (max-width: 760px) {
  .stage, .page-data .stage {
    aspect-ratio: auto; min-height: 0; padding: 72px 20px 72px;
    background-image: var(--bg-img-small); background-position: 72% center;
    display: flex; flex-direction: column; gap: 20px;
    -webkit-mask-image: linear-gradient(180deg, #000 80%, transparent 100%);
            mask-image: linear-gradient(180deg, #000 80%, transparent 100%);
  }
  .page-full .stage { min-height: 100vh; -webkit-mask-image: none; mask-image: none; }
  .stage::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(5,9,24,.92) 30%, rgba(5,9,24,.45)); }
  .zone, .trail, .login-card, .login-foot, .signed-in {
    position: relative; left: auto; right: auto; top: auto; bottom: auto;
    width: auto; max-width: none; min-width: 0;
  }
  .stage > * { z-index: 1; }
  .signed-in, .login-foot { align-self: flex-start; }
  .signed-in { order: -1; }
  .zone { gap: 10px; }
  .trail { gap: 8px; }
  .login-card { padding: 18px; }
  .below { margin-top: -2rem; }
  .panel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
