/* Solutions Time. Light only. Warm neutrals and the FMSA blue: friendly for employees, still a work tool. */
:root {
  color-scheme: light;
  --bg: #f7f6f3;
  --surface: #ffffff;
  --sunk: #f1efea;
  --line: #e7e4dd;
  --line-strong: #d5d1c8;
  --ink: #16202e;
  --ink-2: #4b5563;
  --muted: #7b8494;
  --go: #1f7a4d;
  --go-deep: #17603c;
  --go-bg: #e6f3ec;
  --stop: #b8452c;
  --stop-deep: #963722;
  --stop-bg: #f9e9e4;
  --sky: #2f5fa8;
  --sky-bg: #eaf0fa;
  --sun: #c98a1b;
  --sun-bg: #fbf1dc;
  --grape: #2d7d8c;
  --grape-bg: #e3f1f3;
  --warn: #8a5a00;
  --warn-bg: #fcf4e2;
  --bad: #a3231c;
  --bad-bg: #fceceb;
  --shadow: 0 1px 2px rgb(22 32 46 / 6%), 0 2px 8px rgb(22 32 46 / 4%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r-card: 12px;
  --r-control: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { font-size: 16px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--sky); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--sun); animation: bob 0.9s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-10px); } }

/* ---------- Employee layout ---------- */
.emp { max-width: 540px; margin: 0 auto; min-height: 100vh; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(env(safe-area-inset-bottom, 0px) + 96px); display: flex; flex-direction: column; gap: 14px; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hello { font-size: 15px; color: var(--ink); font-weight: 700; }
.hello b { color: var(--ink); }
.admin-switch { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); font-weight: 600; font-size: 13px; padding: 7px 12px; border-radius: 8px; text-decoration: none; }
.admin-switch svg { width: 16px; height: 16px; }

.sky { position: relative; overflow: hidden; border-radius: 14px; padding: 18px 18px 18px; color: var(--ink); border: 1px solid var(--line); isolation: isolate; }
.sky[data-time="morning"] { background: linear-gradient(135deg, #fdf0e1 0%, #ffffff 70%); }
.sky[data-time="day"] { background: linear-gradient(135deg, #e8f0fb 0%, #ffffff 70%); }
.sky[data-time="evening"] { background: linear-gradient(135deg, #f7e8e2 0%, #ffffff 70%); }
.sky[data-time="night"] { background: linear-gradient(135deg, #eceaf6 0%, #ffffff 70%); }
.sky-icon { position: absolute; right: 16px; top: 16px; width: 28px; height: 28px; color: var(--sun); }
.sky[data-time="night"] .sky-icon, .sky[data-time="evening"] .sky-icon { color: #5a5f9e; }
.sky-icon svg { width: 100%; height: 100%; }
.greet { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; margin: 0; text-wrap: balance; max-width: 85%; }
.greet-sub { margin-top: 4px; color: var(--ink-2); font-size: 15px; }
.sky .timer { margin-top: 6px; font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.sky .timer-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-top: 14px; }

.clock-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 0 4px; }
.big-clock { position: relative; width: min(56vw, 200px); aspect-ratio: 1; border-radius: 50%; border: 0; color: #fff; font-weight: 700; font-size: 22px; display: grid; place-items: center; transition: transform 0.12s ease, background-color 0.15s ease; }
.big-clock span { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.big-clock small { font-size: 13px; font-weight: 500; opacity: 0.9; }
.big-clock.go { background: var(--go); box-shadow: 0 6px 16px rgb(31 122 77 / 22%); }
.big-clock.go:hover:not(:disabled) { background: var(--go-deep); }
.big-clock.stop { background: var(--stop); box-shadow: 0 6px 16px rgb(184 69 44 / 22%); }
.big-clock.stop:hover:not(:disabled) { background: var(--stop-deep); }
.big-clock.stop::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid rgb(184 69 44 / 25%); animation: pulse 3s ease-out infinite; }
.big-clock:active:not(:disabled) { transform: scale(0.97); }
.big-clock:disabled { background: #e2dfd8; box-shadow: none; color: #6b6f78; cursor: not-allowed; }
.big-clock.busy { opacity: 0.8; }
@keyframes pulse { from { transform: scale(0.96); opacity: 1; } to { transform: scale(1.12); opacity: 0; } }

.where { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; font-size: 14px; background: var(--surface); border: 1px solid var(--line); max-width: 100%; }
.where .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.where.in .dot { background: var(--go); box-shadow: 0 0 0 4px var(--go-bg); }
.where.out .dot { background: var(--stop); box-shadow: 0 0 0 4px var(--stop-bg); }
.where.wait .dot { background: var(--sun); animation: bob 0.6s ease-in-out infinite alternate; }
.where button { border: 0; background: none; color: var(--sky); font-weight: 600; padding: 0 0 0 4px; }
.hint { text-align: center; color: var(--ink-2); font-size: 14px; max-width: 34ch; margin: 0 auto; }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--surface); border-radius: var(--r-card); padding: 14px 16px; border: 1px solid var(--line); }
.stat .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.stat .value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 14px; color: var(--muted); font-weight: 600; }

.card { background: var(--surface); border-radius: var(--r-card); padding: 16px; border: 1px solid var(--line); }
.card h2, .section-title { font-size: 18px; font-weight: 700; margin: 0 0 10px; letter-spacing: -0.01em; }
.page-title { font-size: 24px; font-weight: 700; margin: 6px 0 0; letter-spacing: -0.02em; }
.page-sub { color: var(--ink-2); margin: 2px 0 0; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 8px); background: rgb(255 255 255 / 92%); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: flex; justify-content: center; z-index: 5; }
.tabbar-inner { width: 100%; max-width: 540px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.tab { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 12px; text-decoration: none; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--sky); background: var(--sky-bg); }
.tab.on svg { color: var(--sky); }

/* Week bars on the Time tab */
.period-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.period-nav .label { font-weight: 700; font-size: 16px; text-align: center; flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:disabled { opacity: 0.4; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 120px; margin: 8px 0 4px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar i { width: 100%; max-width: 30px; border-radius: 4px 4px 2px 2px; background: #9db4d8; min-height: 3px; }
.bar.today i { background: var(--sky); }
.bar.empty i { background: var(--sunk); }
.bar b { font-size: 11px; color: var(--muted); font-weight: 600; }
.bar em { font-style: normal; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.week-total { display: flex; justify-content: space-between; font-weight: 600; color: var(--ink-2); font-size: 14px; }

.shift-list { display: flex; flex-direction: column; }
.shift { display: grid; grid-template-columns: 58px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.shift:first-child { border-top: 0; }
.shift .day { font-weight: 700; font-size: 14px; line-height: 1.1; }
.shift .day small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.shift .times { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.shift .times small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.shift .hrs { font-weight: 700; font-variant-numeric: tabular-nums; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--go-bg); color: var(--go-deep); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--sky-bg); color: var(--sky); }
.pill.grape { background: var(--grape-bg); color: var(--grape); }
.pill.plain { background: var(--sunk); color: var(--ink-2); }

/* Time off */
.pto-hero { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.ring { width: 118px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; }
.ring-inner { width: 86px; aspect-ratio: 1; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; line-height: 1; }
.ring-inner b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring-inner small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.06em; }
.pto-facts { display: flex; flex-direction: column; gap: 4px; font-weight: 700; color: var(--ink-2); font-size: 14px; }
.pto-facts b { color: var(--ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--r-control); padding: 11px 16px; font-weight: 600; font-size: 15px; background: var(--ink); color: #fff; text-decoration: none; }
.btn.block { width: 100%; }
.btn.grape { background: var(--grape); }
.btn.go { background: var(--go); }
.btn.stop { background: var(--stop); }
.btn.sky { background: var(--sky); }
.btn.soft { background: var(--sunk); color: var(--ink); }
.btn.ghost { background: var(--surface); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

.req { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.req:first-child { border-top: 0; }
.req .when { font-weight: 700; }
.req .meta { color: var(--muted); font-size: 13px; font-weight: 700; grid-column: 1 / -1; }

/* Forms and sheets */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.field input, .field select, .field textarea { width: 100%; min-width: 0; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 16px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--sky); outline: none; }
.field .help { font-size: 13px; color: var(--muted); font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.error { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 12px; font-weight: 700; font-size: 14px; }

.sheet-backdrop { position: fixed; inset: 0; background: rgb(29 36 51 / 40%); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s ease; }
.sheet { width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 16px 16px 0 0; padding: 10px 18px calc(env(safe-area-inset-bottom, 0px) + 20px); animation: rise 0.2s ease; }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 14px; font-size: 22px; font-weight: 700; }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 14px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(30px); opacity: 0.6; } }

.toast { position: fixed; font-weight: 500 !important; left: 16px; right: 16px; margin: 0 auto; width: fit-content; bottom: calc(env(safe-area-inset-bottom, 0px) + 92px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 30; box-shadow: 0 10px 30px rgb(0 0 0 / 20%); max-width: calc(100vw - 32px); text-align: center; animation: rise 0.2s ease; }
.toast.bad { background: var(--bad); }


.empty { text-align: center; padding: 18px 8px; color: var(--muted); font-weight: 700; }
.empty svg { width: 36px; height: 36px; color: var(--go); display: block; margin: 0 auto 6px; }

.me-card { display: flex; gap: 14px; align-items: center; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--sky); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 22px; flex: none; }
.list-link { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); font-weight: 600; color: var(--ink); text-decoration: none; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; }

/* ---------- Admin layout ---------- */
.adm { min-height: 100vh; display: flex; flex-direction: column; }
.adm-top { position: sticky; top: 0; z-index: 6; background: rgb(247 246 243 / 94%); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 0; }
.adm-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 1180px; margin: 0 auto; }
.adm-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.adm-brand img { width: 30px; height: 30px; border-radius: 9px; }
.adm-brand .pill { margin-left: 2px; }
.adm-brand .brand-name, .back-btn { white-space: nowrap; }
@media (max-width: 520px) {
  .adm-brand .brand-name, .wide-only { display: none; }
}
@media (min-width: 521px) { .narrow-only { display: none; } }
.adm-nav { display: flex; gap: 4px; overflow-x: auto; max-width: 1180px; margin: 8px auto 0; scrollbar-width: none; }
.adm-nav::-webkit-scrollbar { display: none; }
.adm-nav a { flex: none; padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--ink-2); text-decoration: none; border-bottom: 3px solid transparent; display: flex; gap: 6px; align-items: center; }
.adm-nav a.on { color: var(--ink); border-bottom-color: var(--sky); }
.adm-nav .count { background: var(--stop); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.adm-main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; display: flex; flex-direction: column; gap: 16px; }
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.adm-head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.adm-head p { margin: 2px 0 0; color: var(--ink-2); font-weight: 600; }
.adm-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.kpi .value { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi.alert .value { color: var(--stop-deep); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.table-card { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 10px 12px; background: var(--sunk); white-space: nowrap; }
table.t td { padding: 11px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr:hover td { background: #faf9f6; }
table.t .who { font-weight: 600; }
table.t .who small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
table.t input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--sky); }

.exc { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: center; }
.exc:first-child { border-top: 0; }
.exc .who { font-weight: 700; }
.exc .what { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.exc .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.people-mini { display: flex; flex-direction: column; }
.people-mini div { display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); font-weight: 700; }
.people-mini div:first-child { border-top: 0; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--sunk); border-radius: 10px; max-width: 420px; width: 100%; }
.segmented a { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border-radius: 7px; font-weight: 600; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.segmented a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented .count { background: var(--stop); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.select-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--sky-bg); border-radius: 14px; font-weight: 600; color: var(--sky); }

.detail-day { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); }
.detail-day:first-child { border-top: 0; }
.detail-day .d { font-weight: 700; }
.detail-day .d small { display: block; color: var(--muted); font-weight: 700; }
.detail-shift { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.detail-shift .t { font-weight: 600; }
.edits { font-size: 12px; color: var(--muted); font-weight: 600; width: 100%; }

.role-select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700; font-size: 14px; }

/* ---------- Printing timesheets ---------- */
.print-root { display: none; }
@media print {
  @page { size: letter; margin: 0.55in; }
  html, body { background: #fff; }
  #app, #toast, .sheet-backdrop { display: none !important; }
  .print-root { display: block; color: #000; font-family: var(--font); font-size: 11pt; }
}
.ts { break-after: page; page-break-after: always; }
.ts:last-child { break-after: auto; page-break-after: auto; }
.ts-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #000; padding-bottom: 6pt; margin-bottom: 10pt; }
.ts-head h1 { margin: 0; font-size: 18pt; font-weight: 700; }
.ts-head .org { font-size: 10pt; }
.ts-head .period { text-align: right; font-size: 10pt; }
.ts-head .period b { font-size: 12pt; display: block; }
.ts table { width: 100%; border-collapse: collapse; font-size: 10pt; font-variant-numeric: tabular-nums; }
.ts th { text-align: left; border-bottom: 1px solid #000; padding: 4pt 5pt; font-size: 9pt; text-transform: uppercase; letter-spacing: 0.04em; }
.ts td { border-bottom: 1px solid #bbb; padding: 4pt 5pt; vertical-align: top; }
.ts td.num, .ts th.num { text-align: right; }
.ts tr.week td { border-bottom: 1px solid #000; font-weight: 600; background: #f2f2f2; }
.ts .note { font-size: 8.5pt; color: #333; }
.ts-totals { display: flex; gap: 24pt; margin: 10pt 0; font-size: 11pt; }
.ts-totals b { font-size: 13pt; }
.ts-attest { margin-top: 14pt; font-size: 9.5pt; }
.ts-sign { display: grid; grid-template-columns: 2fr 1fr; gap: 26pt 18pt; margin-top: 30pt; font-size: 9pt; }
.ts-sign div { border-top: 1px solid #000; padding-top: 3pt; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
