/* SandOS layout and STANDARD PARTS. Colours and fonts come only from theme.css.
   Every module reuses these parts; see Admin › Standard parts for a live sheet. */

* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; transition: background-color .2s, color .2s; }
a { color: var(--link); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
#root { flex: 1; display: flex; flex-direction: column; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---- Test environment strip ---- */
.env-strip { background: var(--strip); color: #FFFFFF; text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .12em; padding: 6px 12px; }

/* =========================================================
   STANDARD PARTS
   ========================================================= */

/* Type */
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.title { margin: 0; font: 400 42px/1.08 var(--font-title); }
.title em { font-style: italic; }
.h2 { margin: 0; font: 600 21px/1.25 var(--font-title); }
.lead { margin: 0; color: var(--muted); max-width: 680px; }
.note { font-size: 12px; color: var(--muted); }
.figure { font: 400 32px/1.1 var(--font-title); font-variant-numeric: tabular-nums; }

/* Buttons — one primary per screen; all at least 44 px tall */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: var(--radius-control); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(.96); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--link); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--link); padding: 0 12px; }
.btn-quiet:hover { color: var(--ink); }
.btn-void { background: transparent; color: var(--err-fg); border-color: var(--err-fg); }
.btn-danger { background: var(--err-fg); color: var(--surface); }
.btn-icon { width: 46px; padding: 0; background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn:disabled { background: var(--surface2); color: var(--muted); border-color: transparent; cursor: default; filter: none; }
.btn-block { width: 100%; }

/* Status labels */
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 12px; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill-warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill-err { background: var(--err-bg); color: var(--err-fg); }
.pill-info { background: var(--info-bg); color: var(--info-fg); }
.pill-void { background: var(--err-bg); color: var(--err-fg); text-decoration: line-through; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 24px; box-shadow: var(--shadow); }
.card-feature { background: var(--feature); color: var(--on-feature); border: 0; box-shadow: none; }
.card-feature .lead, .card-feature p { color: var(--on-feature-muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

/* Form fields */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.field input, .field select, .field textarea { min-height: 46px; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 0 12px;
  font: inherit; font-weight: 400; font-size: 14px; color: var(--ink); background: var(--input); min-width: 0; }
.field textarea { padding: 10px 12px; min-height: 96px; }
.field input[aria-invalid="true"] { border: 2px solid var(--err-fg); }
.field .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.field .error { font-weight: 400; font-size: 12px; color: var(--err-fg); }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--c1); }
.toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.toggle .track { position: relative; flex: none; width: 52px; height: 30px; border-radius: 15px; border: 1px solid var(--line); background: var(--track); transition: background .15s; }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.toggle[aria-checked="true"] .track { background: var(--c1); }
.toggle[aria-checked="true"] .knob { left: 25px; background: var(--accent); }

/* Messages */
.msg { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; font-size: 13px; font-weight: 500; text-align: left; }
.msg svg { flex: none; }
.msg-ok { background: var(--ok-bg); color: var(--ok-fg); }
.msg-warn { background: var(--warn-bg); color: var(--warn-fg); }
.msg-err { background: var(--err-bg); color: var(--err-fg); }
.msg-info { background: var(--info-bg); color: var(--info-fg); }

/* Empty page */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 32px 16px; }
.empty-art { position: relative; width: 140px; height: 110px; }
.empty-art i { position: absolute; display: block; border-radius: 50%; }
.empty-art i:nth-child(1) { left: 0; top: 10px; width: 90px; height: 90px; background: var(--surface2); border: 1px solid var(--line); }
.empty-art i:nth-child(2) { left: 50px; top: 0; width: 80px; height: 80px; border: 1.5px dashed var(--c1); }
.empty-art i:nth-child(3) { left: 104px; top: 70px; width: 20px; height: 20px; background: var(--accent); }
.empty-state .empty-title { font: 400 22px/1.2 var(--font-title); }
.empty-state p { margin: 0; font-size: 13px; color: var(--muted); max-width: 360px; }

/* Confirm dialog (uses the native <dialog>) */
dialog.confirm { border: 1px solid var(--line); border-radius: var(--radius-card); padding: 24px; width: min(480px, calc(100% - 32px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
dialog.confirm::backdrop { background: var(--scrim); }
dialog.confirm .dlg-title { font: 400 22px/1.2 var(--font-title); margin: 0 0 8px; }
dialog.confirm .dlg-body { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
dialog.confirm .dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }

/* Appearance switch */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-control); background: var(--surface2); border: 1px solid var(--line); }
.seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs a, .tabs span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; text-decoration: none; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tabs span { opacity: .6; cursor: default; }

/* Tables */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.toolbar .spacer { flex: 1; }
.toolbar .field input { min-width: 200px; }
.table-box { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
table.data th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 8px 10px 10px 0; }
table.data td { padding: 11px 10px 11px 0; border-top: 1px solid var(--line-soft); vertical-align: top; }
table.data td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { color: var(--muted); padding: 24px 0 8px; }

/* =========================================================
   SIGN-IN
   ========================================================= */
.signin { flex: 1; display: flex; flex-wrap: wrap; }
.signin-brand { flex: 1 1 520px; background: var(--panel); color: var(--on-panel); position: relative; overflow: hidden; padding: 56px 64px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px; min-height: 420px; }
.signin-brand .ring { position: absolute; border-radius: 50%; border: 1px solid var(--panel-line); pointer-events: none; }
.signin-brand .ring.r1 { right: -180px; bottom: -180px; width: 620px; height: 620px; }
.signin-brand .ring.r2 { right: -80px; bottom: -80px; width: 420px; height: 420px; }
.signin-brand .dot { position: absolute; right: 92px; bottom: 300px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); }
.signin-brand > * { position: relative; }
.signin-brand img { height: 88px; width: auto; align-self: flex-start; }
.signin-brand .eyebrow { color: var(--on-panel-muted); letter-spacing: .16em; font-size: 12px; }
.signin-brand h1 { margin: 0; font: 400 52px/1.08 var(--font-title); }
.signin-brand h1 em { color: var(--accent); }
.signin-brand .about { margin: 0; font-size: 15px; line-height: 1.6; color: var(--on-panel-muted); max-width: 520px; }
.signin-way { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 16px; background: var(--panel-hover); border: 1px solid var(--panel-line); max-width: 520px; }
.signin-way .bead { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
.signin-way b { display: block; font-size: 15px; margin-top: 4px; }
.signin-way span { display: block; font-size: 13px; color: var(--on-panel-muted); margin-top: 2px; }
.signin-foot { font-size: 12px; color: var(--on-panel-muted); }
.signin-main { flex: 1 1 420px; display: flex; flex-direction: column; padding: 24px 32px 40px; }
.signin-main .top { display: flex; justify-content: flex-end; }
.signin-main .centre { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 0; }
.signin-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 24px; }
.signin-form h2 { margin: 0; font: 400 40px/1.1 var(--font-title); }
.signin-form p { margin: 0; color: var(--muted); font-size: 15px; }
.signin-form .btn { min-height: 52px; font-size: 15px; box-shadow: var(--shadow); }
.signin-form .small { font-size: 13px; color: var(--muted); }

/* =========================================================
   APP SHELL: menu panel + top bar + page
   ========================================================= */
.shell { flex: 1; display: flex; }
.panel { flex: 0 0 256px; background: var(--panel); color: var(--on-panel); padding: 22px 14px; display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.panel-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 0; min-height: 48px; }
.brand img { height: 40px; width: auto; flex: none; }
.brand b { display: block; font-weight: 600; font-size: 14px; }
.brand span { display: block; font-size: 11px; color: var(--on-panel-muted); letter-spacing: .1em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-control);
  color: var(--on-panel); text-decoration: none; font-size: 14px; }
.nav a:hover { background: var(--panel-hover); color: var(--on-panel); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.nav svg { flex: none; }
.who { margin-top: auto; background: var(--panel2); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.who-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.who-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { font-size: 11px; color: var(--on-panel-muted); }
.who .btn { min-height: 40px; width: 100%; background: transparent; color: var(--on-panel); border-color: var(--panel-line); font-size: 13px; }
.who .btn:hover { background: var(--panel-hover); }
.menu-toggle { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 40px; border-bottom: 1px solid var(--line); }
.crumb { font-size: 13px; color: var(--muted); }
.crumb strong { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.page { padding: 28px 40px 56px; display: flex; flex-direction: column; gap: 24px; width: 100%; max-width: 1320px; }
.page:focus { outline: none; }

.tile { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); min-height: 44px; }
.tile:hover { border-color: var(--link); color: var(--ink); }
.tile b { font: 600 18px/1.3 var(--font-title); }
.tile span { color: var(--muted); font-size: 13px; }
.coming { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; }
.coming li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-soft); }

/* Standard parts sheet (Admin) */
.parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.parts .card { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.swatch i { display: block; height: 56px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 8px; }
.swatch b { display: block; font-size: 13px; }
.swatch span { font-size: 11px; color: var(--muted); }

/* ---- Phone and small screens ---- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .panel { position: static; height: auto; flex: none; padding: 12px 16px; gap: 12px; }
  .menu-toggle { display: inline-flex; min-height: 44px; background: transparent; color: var(--on-panel); border-color: var(--panel-line); }
  .panel:not(.open) .nav, .panel:not(.open) .who { display: none; }
  .topbar { padding: 12px 16px; }
  .page { padding: 24px 16px 40px; }
  .title { font-size: 32px; }
  .signin-brand { padding: 32px 24px; gap: 28px; min-height: 0; }
  .signin-brand h1 { font-size: 38px; }
  .signin-brand img { height: 64px; }
  .signin-main { padding: 16px 16px 32px; }
  .signin-form h2 { font-size: 32px; }
  .seg button span { display: none; }
}
