/* office.css — dense, light, laptop-first. Builds on /shared/base.css tokens. */

[hidden] { display: none !important; }
input[type="checkbox"] { min-height: 0; }
body { font-size: 14px; }
.muted { color: var(--text-dim); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.right { text-align: right; }
.pad { padding: 24px; }
.pad-x { padding: 0 4px; }
.spacer { flex: 1; }
.err { color: var(--fault); font-weight: 600; }
.warn { color: var(--time); }
.t-fault { color: var(--fault); }
.t-time { color: var(--time); }
.t-clear { color: var(--clear); font-weight: 600; }
.run { color: var(--clear); font-weight: 600; }
.nat { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--text-dim); border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 4px; vertical-align: 1px; }
.linklike { background: none; border: 0; padding: 0; color: var(--focus); text-decoration: underline; font-weight: 600; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.btn { min-height: 36px; padding: 0 14px; font-size: 14px; }
a.btn { text-decoration: none; color: inherit; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn:hover:not([disabled]) { border-color: var(--ink-400); }
.btn-primary:hover:not([disabled]) { background: var(--ink-600); }

/* brand */
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.01em; }
.brand-dot { width: 12px; height: 12px; border-radius: 3px; background: var(--hivis); box-shadow: inset 0 0 0 1.5px var(--hivis-deep); }

/* login */
.login { min-height: 80vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.login-card h1 { margin: 0; font-size: 28px; }
.login-card p { margin: 0; }

/* fields */
.field { display: grid; gap: 4px; min-width: 0; }
.field input, .field select, input, select, textarea {
  border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: var(--paper);
  padding: 6px 8px; min-height: 34px; min-width: 0; font-size: 14px;
}
input[readonly] { background: var(--cloth); color: var(--text-dim); }
textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.checks { display: flex; gap: 12px; flex-wrap: wrap; min-height: 34px; align-items: center; }
.checks label { display: inline-flex; gap: 4px; align-items: center; font-weight: 600; }
.w-xs { width: 64px; } .w-s { width: 80px; } .w-m { width: 130px; } .grow { flex: 1; min-width: 140px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; padding: 8px 16px; background: var(--ink); color: var(--cloth); }
.top .brand { font-size: 16px; }
.top .btn-ghost { color: var(--cloth-dim); min-height: 32px; text-decoration: none; }
.top .sync { color: var(--cloth-dim); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 2px; }
.tabs button { background: none; border: 0; color: var(--cloth-dim); padding: 8px 14px; border-radius: var(--r-sm); font-weight: 700; letter-spacing: .02em; }
.tabs button[aria-selected="true"] { background: var(--hivis); color: var(--ink); }
.tabs button:hover:not([aria-selected="true"]) { color: var(--cloth); background: var(--ink-600); }

main { padding: 14px 16px 24px; max-width: 1500px; margin: 0 auto; }

/* LIVE */
.live-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.div-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.div-tab { border: 1.5px solid var(--line-strong); background: var(--paper); border-radius: var(--r); padding: 6px 12px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.div-tab[aria-pressed="true"] { background: var(--ink); color: var(--cloth); border-color: var(--ink); }
.div-tab[aria-pressed="true"] .muted { color: var(--cloth-mute); }
.publish-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pub { display: flex; gap: 8px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 8px 6px 12px; }

.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); padding: 8px 8px; border-bottom: 1.5px solid var(--line-strong); white-space: nowrap; background: var(--paper); }
td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.c-num { text-align: right; white-space: nowrap; }
.c-place { width: 36px; text-align: right; font-weight: 800; }
.c-bib { width: 48px; }
.standings tbody tr { cursor: pointer; }
.standings tbody tr:hover { background: color-mix(in srgb, var(--hivis) 10%, white); }
.standings tr.is-live { background: color-mix(in srgb, var(--clear) 8%, white); box-shadow: inset 4px 0 0 var(--clear); }
.standings tr.is-out td:not(:last-child) { color: var(--text-dim); }
.standings .total { font-weight: 800; font-size: 15px; }
.standings .sub { display: block; font-size: 11px; color: var(--time); }
.rider { font-weight: 700; }
.horse { color: var(--text-dim); font-size: 13px; }
.empty { text-align: center; padding: 64px 16px; }
.empty h2 { margin: 0 0 8px; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(13, 15, 12, .28); z-index: 10; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); z-index: 11; background: var(--cloth); box-shadow: -8px 0 24px rgba(0, 0, 0, .15); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.drawer-head > div { flex: 1; }
.drawer-head h2 { margin: 2px 0 0; font-size: 22px; }
.drawer-body { overflow-y: auto; padding: 12px 16px 32px; display: grid; gap: 12px; align-content: start; }
.dsec { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 8px; }
.dsec h3 { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.mini th { font-size: 10px; padding: 4px 6px; }
.mini td { padding: 5px 6px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0; }
.kv dt { color: var(--text-dim); font-size: 12px; }
.kv dd { margin: 0; }
.list { margin: 0; padding-left: 18px; }
.warnbox { margin: 0; padding: 8px 10px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--time) 12%, white); color: #6d4800; font-weight: 600; }
.form-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-top: 8px; border-top: 1px dashed var(--line); }
.form-row .full { flex-basis: 100%; }
.audit { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.audit li { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.audit li.voided > span:nth-child(2) { text-decoration: line-through; color: var(--text-dim); }

/* setup */
.savebar { position: sticky; top: 50px; z-index: 4; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
.savebar[data-dirty="true"] { border-color: var(--hivis-deep); box-shadow: inset 4px 0 0 var(--hivis), var(--shadow); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; }
.card h2 { margin: 0 0 10px; font-size: 17px; }
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card-head h2 { margin: 0 0 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.span3 { grid-column: span 3; }
.divcard { border: 1px solid var(--line); border-left: 4px solid var(--hivis-deep); border-radius: var(--r-sm); padding: 10px 12px 6px; margin-bottom: 10px; background: var(--cloth); }
.divcard-foot { display: flex; align-items: center; justify-content: space-between; }
.entries input, .entries select { min-height: 30px; padding: 3px 6px; width: 100%; }
.entries .w-xs { width: 64px; }
.entries td { padding: 3px 4px; }
.csv-in { display: grid; gap: 8px; }
.csv-actions { display: flex; gap: 10px; align-items: center; }
.row-bad { background: color-mix(in srgb, var(--fault) 7%, white); }
.danger { border-color: color-mix(in srgb, var(--fault) 40%, white); }
.danger h2 { color: var(--fault); }

/* devices */
.devgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.dev { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 8px; }
.dev-main { flex: 1; min-width: 0; }
.dev-main > div:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev .btn-sm { padding: 0 6px; min-height: 26px; font-size: 12px; color: var(--text-dim); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; vertical-align: -1px; }
.dot.green { background: var(--clear); box-shadow: 0 0 0 3px color-mix(in srgb, var(--clear) 25%, transparent); }
.dot.amber { background: var(--time); }
.dot.grey { background: var(--cloth-dim); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--cloth); padding: 10px 16px; border-radius: var(--r); font-weight: 600; box-shadow: var(--shadow); max-width: 90vw; }
.toast-bad { background: var(--fault); color: #fff; }

/* sheet */
.sheet-modal { position: fixed; inset: 0; z-index: 20; background: var(--cloth); overflow-y: auto; }
.sheet-bar { position: sticky; top: 0; display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.sheet-body { padding: 16px; display: grid; gap: 20px; justify-items: center; }
.sheet { background: var(--paper); width: min(900px, 100%); padding: 24px 28px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.sheet-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 10px; }
.sheet-head h2 { margin: 2px 0; font-size: 20px; }
.sheet-who { text-align: right; }
.bigbib { font-size: 34px; font-weight: 800; line-height: 1; }
.sheet-table { font-size: 12.5px; }
.sheet-table th { font-size: 10px; padding: 5px 6px; }
.sheet-table td { padding: 4px 6px; vertical-align: top; }
.sheet-table .pre { white-space: pre-line; }
.sheet-table tr.coll td { background: var(--cloth); font-weight: 600; }
.sheet-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 14px; align-items: flex-end; }
.sig img { display: block; max-width: 260px; max-height: 90px; border-bottom: 1px solid var(--ink); }
.sheet-note { font-size: 11px; color: var(--text-dim); margin: 14px 0 0; }

@media (max-width: 900px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span3 { grid-column: span 2; }
  .grid3 { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; gap: 8px; }
}

/* PRINT: the rider copy only — one judge's sheet per page */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body { background: #fff; }
  body > *:not(#sheetModal) { display: none !important; }
  .sheet-modal { position: static; overflow: visible; background: #fff; }
  .no-print { display: none !important; }
  .sheet-body { padding: 0; display: block; }
  .sheet { border: 0; box-shadow: none; width: auto; padding: 0; page-break-after: always; break-after: page; }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  .sheet-table tr { break-inside: avoid; }
}
