/* Payrelle app. Builds on the site's tokens and components (/assets/css/site.css); the plan is the theme. */

.app-page { background: var(--bg); }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

/* Sidebar: the plan's colour, with its lattice */
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--ground); color: var(--on-ground); padding: 22px 16px; display: grid; grid-template-rows: auto auto 1fr auto; gap: 18px; }
.side > * { position: relative; }
.side-field { position: absolute !important; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.side-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: var(--d-weight) 24px/1 var(--font-d); letter-spacing: var(--d-track); padding: 0 6px; }
.side-brand .mark { width: 30px; height: 30px; --mc: var(--on-ground); }
.side-org { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: var(--r-md); background: color-mix(in srgb, var(--on-ground) 12%, transparent); }
.side-org b { display: block; font-size: 14.5px; }
.side-org span { display: block; font-size: 12.5px; color: var(--hero-muted); }
.side-nav { display: grid; align-content: start; gap: 2px; }
.side-group { margin: 14px 8px 4px; font-size: 13px; font-weight: 600; color: var(--hero-muted); }
.side-group:first-child { margin-top: 0; }
.side-nav a { padding: 9px 12px; border-radius: var(--r-sm); text-decoration: none; font-weight: 500; font-size: 15px; }
.side-nav a:hover { background: color-mix(in srgb, var(--on-ground) 10%, transparent); }
.side-nav a[aria-current] { background: var(--on-ground); color: var(--ground); font-weight: 700; }
.side-reset { all: unset; cursor: pointer; font-size: 13px; color: var(--hero-muted); padding: 6px 8px; border-radius: var(--r-sm); }
.side-reset:hover, .side-reset:focus-visible { color: var(--on-ground); background: color-mix(in srgb, var(--on-ground) 10%, transparent); }
.side-reset[data-armed] { color: var(--on-ground); font-weight: 700; }

.work { min-width: 0; display: grid; grid-template-rows: auto 1fr; }
.work-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; padding: 18px clamp(16px, 3vw, 32px); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.work-bar h1 { font-size: clamp(20px, 2.2vw, 26px); }
.plan-switch { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.plan-switch select, .form select, .form input, .card-head select { font: inherit; font-size: 14px; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 100%; }
.view { padding: clamp(16px, 3vw, 32px); display: grid; gap: 20px; align-content: start; }
.view:focus { outline: none; }

/* Cards and common bits */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; display: grid; gap: 14px; min-width: 0; }
.card h2 { font: 700 18px/1.25 var(--font-b); letter-spacing: 0; }
.card h3 { font: 700 16px/1.3 var(--font-b); letter-spacing: 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.hint { font-size: 13px; color: var(--muted); }
.lede-s { color: var(--muted); font-size: 15px; max-width: 80ch; }
.lede-s b { color: var(--ink); }
.empty { color: var(--muted); font-size: 15px; padding: 18px; border: 1px dashed var(--line); border-radius: var(--r-md); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.actions.top { justify-content: flex-start; }
.err { color: var(--bad); font-size: 14px; min-height: 0; }
.err:empty { display: none; }
.search { font: inherit; font-size: 14px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); min-width: min(280px, 100%); background: var(--surface); color: var(--ink); }
.linkish { all: unset; cursor: pointer; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.linkish:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.back { font-size: 14px; color: var(--accent); font-weight: 600; text-decoration: none; }
.back::before { content: '‹ '; }
.scroll.tall { max-height: 560px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Payroll manager */
.mgr { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; }
.run-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.run-list a { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; }
.run-list a:hover { border-color: var(--accent); }
.run-meta { display: inline-flex; gap: 6px; }
.form { display: grid; gap: 8px; justify-items: start; }
.form label { font-size: 13px; font-weight: 600; }
.form.row { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; justify-items: stretch; gap: 12px; }
.form.row > div { display: grid; gap: 6px; }
@media (max-width: 960px) { .mgr { grid-template-columns: 1fr; } .form.row { grid-template-columns: 1fr; } }

/* The run's steps: a real sequence, so they're numbered */
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.stepper button { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer; }
.stepper .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; background: var(--sunk); flex: none; }
.stepper .done .n { background: color-mix(in srgb, var(--ground) 25%, var(--surface)); }
.stepper .on button { background: var(--ground); color: var(--on-ground); border-color: var(--ground); }
.stepper .on .n { background: var(--on-ground); color: var(--ground); }
.stepper .ahead button { color: var(--muted); cursor: not-allowed; }
.stepper button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 860px) { .stepper { grid-template-columns: 1fr; } }

/* Attendance */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.choice { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; display: grid; gap: 10px; align-content: start; justify-items: start; }
.choice p { font-size: 14.5px; color: var(--muted); }
.file { position: relative; display: inline-flex; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file span { padding: 10px 16px; border-radius: var(--r-md); background: var(--ground); color: var(--on-ground); font-weight: 600; font-size: 15px; }
.file input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 760px) { .choices { grid-template-columns: 1fr; } }
.recon3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.recon3 div { border-radius: var(--r-md); padding: 12px 14px; display: grid; gap: 4px; font-size: 13.5px; }
.recon3 b { font: var(--d-weight) 26px/1.1 var(--font-d); }
.recon3 .ok { background: var(--good-soft); color: var(--good); }
.recon3 .wa { background: var(--warn-soft); color: var(--warn); }
.recon3 .no { background: var(--sunk); color: var(--muted); }
@media (max-width: 760px) { .recon3 { grid-template-columns: 1fr; } }

/* Time review */
.dtr-table tr.expand td { background: var(--sunk); white-space: normal; cursor: default; }
.ot-ask { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; font-weight: 600; }
.proof { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--good); font-variant-numeric: tabular-nums; }

/* Lock */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { padding: 10px 12px 10px 38px; border-radius: var(--r-md); position: relative; font-size: 14.5px; }
.checks li::before { position: absolute; left: 12px; top: 9px; font-weight: 700; }
.checks .ok { background: var(--good-soft); }
.checks .ok::before { content: '✓'; color: var(--good); }
.checks .warn { background: var(--warn-soft); }
.checks .warn::before { content: '!'; color: var(--warn); }
.checks .bad { background: var(--bad-soft); }
.checks .bad::before { content: '✕'; color: var(--bad); }

/* Release */
.release { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.slip-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; display: grid; gap: 10px; }
.slip-card > :not(.slip-mark) { position: relative; }
.slip-card h3 { font: var(--d-weight) 22px/1.2 var(--font-d); letter-spacing: var(--d-track); }
.sub { margin-top: 6px; }
.history { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13.5px; color: var(--muted); }
.history time { color: var(--ink); font-weight: 600; margin-right: 6px; }
@media (max-width: 960px) { .release { grid-template-columns: 1fr; } }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; z-index: 50; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.4); max-width: calc(100vw - 32px); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; grid-template-rows: auto; }
  .side-nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .side-group { display: none; }
}
@media (pointer: coarse) {
  .plan-switch select, .form select, .form input, .card-head select, .search { min-height: 44px; }
  .side-reset { padding: 12px 8px; }
  .side-nav a { padding: 12px 14px; }
}
