/* Flat, almost-square style for the Clock and Graphics panel pages (same simple logic as the handball clock). */
:root {
  --bg: #0f1117;
  --box: #15181f;
  --btn: #232731;
  --btn-2: #2b303c;
  --line: #2a2f3b;
  --text: #f4f6fa;
  --muted: #8b93a3;
  --dim: #6b7383;
  --red: #e2231a;
  --green: #2ed06d;
  --maroon: #6d0000;
  --r: 4px;
  --heavy: 900 1em/1 -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Inter, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 600 15px/1.35 -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- buttons */
.b {
  appearance: none; border: 1px solid transparent; border-radius: var(--r); background: var(--btn);
  min-height: 44px; padding: 8px 14px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  user-select: none; -webkit-user-select: none; transition: background .1s, transform .05s, opacity .1s;
}
.b:active { transform: scale(.97); }
.b.white { background: #f7f8fa; color: #0d0f14; }
.b.white:hover { background: #fff; }
.b.dim { background: var(--btn); color: var(--muted); }
.b.dim:hover { background: var(--btn-2); }
.b.line { background: transparent; border-color: var(--line); color: var(--text); }
.b.line:hover { background: #191c24; }
.b.red { background: var(--red); color: #fff; }
.b.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.b.pending { opacity: .55; }
.b:disabled { opacity: .35; pointer-events: none; }

/* ---------- segmented control */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); }
.seg > button { appearance: none; border: 0; background: transparent; color: var(--dim); font-weight: 800; padding: 10px 18px; min-height: 44px; }
.seg > button + button { border-left: 1px solid var(--line); }
.seg > button.on { background: var(--btn); color: var(--text); }

/* ---------- switch */
.switch { appearance: none; position: relative; width: 46px; height: 26px; border-radius: 13px; border: 0; background: #343946; padding: 0; flex: none; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }
.tog { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 700; font-size: 14px; cursor: pointer; }

/* ---------- top / bottom bars */
.top { display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 8px; }
.pill { display: inline-flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--box); padding: 7px 12px; font-weight: 800; white-space: nowrap; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #666; flex: none; }
.dot.ok { background: var(--green); }
.dot.bad { background: var(--red); }
.spacer { flex: 1; }
.icon-btn { appearance: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--r); background: var(--box); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 20px; height: 20px; }
.err { color: #ff6b61; font-size: 13px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links { display: flex; gap: 18px; align-items: center; font-weight: 700; font-size: 14px; }
.links a { color: var(--muted); }
.links a:hover { color: var(--text); }
.links a.blue { color: #4b8dff; }

/* ---------- sheets (time entry, confirm) – square */
dialog { color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
.sheet { border: 1px solid var(--line); background: var(--box); border-radius: var(--r); padding: 18px; width: min(420px, calc(100vw - 24px)); }
.sheet-title { font-size: 20px; font-weight: 900; margin-bottom: 12px; }
.sheet-title:focus { outline: none; }
.sheet-text { color: var(--muted); margin: 0 0 14px; font-weight: 500; }
.sheet-input { width: 100%; font: var(--heavy); font-size: 48px; text-align: center; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; outline: none; font-variant-numeric: tabular-nums; }
.sheet-input:focus { border-color: #4b8dff; }
.sheet-hint { color: var(--muted); font-size: 13px; margin: 8px 2px; font-weight: 500; }
.sheet-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.chip { appearance: none; border: 1px solid var(--line); background: var(--btn); border-radius: var(--r); padding: 8px 12px; font-weight: 800; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { appearance: none; min-height: 50px; border-radius: var(--r); border: 1px solid var(--line); background: var(--btn); font-weight: 800; }
.sheet-actions .btn.primary { background: #f7f8fa; color: #0d0f14; border-color: #f7f8fa; }
.sheet-actions .btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.sheet-actions .btn.ghost { background: transparent; }
@media (max-width: 600px) {
  .sheet { margin: auto auto 0; width: 100vw; max-width: 100vw; padding-bottom: calc(18px + var(--safe-b)); }
}
#toasts { display: none !important; }
/* hg.js marks the connection dot with .conn.ok / .conn.bad */
.conn { width: 8px; height: 8px; border-radius: 50%; background: #666; flex: none; }
.conn.ok { background: var(--green); }
.conn.bad { background: var(--red); }
.links a { white-space: nowrap; }
.top .pill { min-width: 0; }
@media (max-width: 600px) {
  .top:has(.links) { flex-wrap: wrap; row-gap: 8px; }
  .top .links { order: 3; width: 100%; gap: 20px; }
  .top:has(.links) .pill { max-width: 100%; }
}
