/* C301 Timeclock — shared base styles. Big targets, plain language, works in sun and in the dark. */
:root {
  --bg: #F2F4F7; --panel: #FFFFFF; --panel-2: #F7F9FB; --ink: #16212B; --muted: #5F6E7C; --line: #D7DEE5; --line-strong: #B9C4CE;
  --accent: #1F6F8B; --accent-ink: #FFFFFF; --accent-soft: #E3F0F5;
  --in: #1F8A4C; --in-soft: #E4F3EA; --out: #B5471F; --out-soft: #F8E7DF; --warn: #B7791F; --warn-soft: #FBF1DC; --danger: #B42318; --danger-soft: #FBE4E1; --info: #2E5AAC; --info-soft: #E6EDF9;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(22,33,43,.06), 0 4px 16px rgba(22,33,43,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --control-h: 48px; --control-h-xl: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0F161C; --panel: #182129; --panel-2: #1F2A33; --ink: #E6EDF3; --muted: #93A3B1; --line: #2A3640; --line-strong: #3A4856; --accent: #5BB0CC; --accent-ink: #0F161C; --accent-soft: #16333D; --in: #43B67A; --in-soft: #16352A; --out: #E07A52; --out-soft: #3D2419; --warn: #E0A33A; --warn-soft: #3B3017; --danger: #F0776A; --danger-soft: #3E1F1C; --info: #7EA7E8; --info-soft: #1D2B45; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35); }
}
:root[data-theme="dark"] { --bg: #0F161C; --panel: #182129; --panel-2: #1F2A33; --ink: #E6EDF3; --muted: #93A3B1; --line: #2A3640; --line-strong: #3A4856; --accent: #5BB0CC; --accent-ink: #0F161C; --accent-soft: #16333D; --in: #43B67A; --in-soft: #16352A; --out: #E07A52; --out-soft: #3D2419; --warn: #E0A33A; --warn-soft: #3B3017; --danger: #F0776A; --danger-soft: #3E1F1C; --info: #7EA7E8; --info-soft: #1D2B45; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.45; color: var(--ink); background: var(--bg); min-height: 100dvh; }
body.modal-open { overflow: hidden; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 17px; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }
small, .muted { color: var(--muted); }
.muted { font-size: 15px; }
code, .mono { font-family: var(--mono); font-size: .95em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control-h); padding: 0 20px; border-radius: var(--radius); border: 1.5px solid var(--line-strong); background: var(--panel); color: var(--ink); font-weight: 600; font-size: 17px; cursor: pointer; text-decoration: none; transition: transform .06s ease, background .15s ease; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-in { background: var(--in); border-color: var(--in); color: #fff; }
.btn-out { background: var(--out); border-color: var(--out); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn-xl { min-height: var(--control-h-xl); font-size: 20px; padding: 0 28px; border-radius: 16px; }
.btn-sm { min-height: 38px; font-size: 15px; padding: 0 14px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 0; font-size: 26px; line-height: 1; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--panel-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-weight: 600; font-size: 15px; }
.field .hint { font-size: 14px; color: var(--muted); }
.field-inline { flex-direction: row; align-items: center; gap: 12px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="search"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%; min-height: var(--control-h); padding: 10px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); color: var(--ink); font-size: 17px;
}
textarea { min-height: 96px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 38px; }
input:disabled, select:disabled, textarea:disabled { background: var(--panel-2); color: var(--muted); }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-size: 17px; }
.check input { width: 26px; height: 26px; accent-color: var(--accent); margin: 0; flex: 0 0 auto; }
.check.check-big { padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--panel); min-width: 0; }
.check.check-big > span { min-width: 0; overflow-wrap: anywhere; }
.check.check-big:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.form-grid > * { min-width: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 4px; margin: 0 0 16px; }
legend { font-weight: 650; padding: 0 6px; }
details.more { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; margin: 8px 0 16px; background: var(--panel-2); }
details.more > summary { cursor: pointer; font-weight: 600; min-height: 48px; display: flex; align-items: center; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸"; display: inline-block; width: 20px; color: var(--muted); transition: transform .15s; }
details.more[open] > summary::before { transform: rotate(90deg); }
details.more > summary + * { padding-bottom: 8px; }

/* Cards & lists */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-title h2, .card-title h3 { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-height: 56px; }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .sub { color: var(--muted); font-size: 15px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.pill-in { background: var(--in-soft); color: var(--in); } .pill-out { background: var(--out-soft); color: var(--out); }
.pill-warn { background: var(--warn-soft); color: var(--warn); } .pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); } .pill-ok { background: var(--in-soft); color: var(--in); } .pill-accent { background: var(--accent-soft); color: var(--accent); }

/* Notices */
.notice { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel-2); margin-bottom: 14px; }
.notice-warn { background: var(--warn-soft); border-color: transparent; color: var(--ink); }
.notice-danger, .error-box { background: var(--danger-soft); border: 1px solid transparent; color: var(--ink); padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; }
.notice-ok { background: var(--in-soft); border-color: transparent; }
.notice-info { background: var(--info-soft); border-color: transparent; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty p { margin-bottom: 12px; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 650; color: var(--muted); font-size: 13.5px; background: var(--panel-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--panel-2); }
tfoot td { font-weight: 650; background: var(--panel-2); }

/* Modal + toast */
.overlay { position: fixed; inset: 0; background: rgba(10, 18, 26, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0; }
.modal { background: var(--panel); border-radius: 18px 18px 0 0; width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-wide { max-width: 960px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-body { padding: 4px 18px 12px; overflow: auto; }
.modal-actions { display: flex; gap: 10px; padding: 12px 18px 18px; border-top: 1px solid var(--line); justify-content: flex-end; flex-wrap: wrap; }
.modal-actions .btn { flex: 1 1 auto; }
@media (min-width: 640px) { .overlay { align-items: center; padding: 20px; } .modal { border-radius: 18px; } .modal-actions .btn { flex: 0 0 auto; } }
.toast-host { position: fixed; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; opacity: 0; transform: translateY(-8px); transition: all .25s ease; max-width: 520px; text-align: center; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: none; }
.toast-ok { background: var(--in); color: #fff; } .toast-danger { background: var(--danger); color: #fff; } .toast-warn { background: var(--warn); color: #fff; }
.spinner-wrap { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 16px 0; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Layout helpers */
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 560px; margin: 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kbd { font-family: var(--mono); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { height: 36px; width: auto; max-width: 160px; object-fit: contain; }
.brand .brand-name { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; letter-spacing: -.02em; flex: 0 0 auto; }
@media print { .no-print { display: none !important; } }

/* Big choice buttons (wizard, receipts) */
.choice { display: grid; gap: 12px; }
.choice .btn { min-height: 72px; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left; padding: 12px 18px; gap: 2px; width: 100%; }
.choice .btn small { font-weight: 500; color: var(--muted); white-space: normal; line-height: 1.3; }
.choice .btn.selected { border-color: var(--accent); background: var(--accent-soft); }
