/* ==========================================================================
   PlayKeeper design system - shared by landing, customer app and admin.
   Palette: paper / ink / pine (protect, act) / sun (play time left) / berry (blocked)
   Type: Bricolage Grotesque (display) + Atkinson Hyperlegible (text)
   ========================================================================== */

@font-face { font-family: "Bricolage"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(fonts/bricolage-grotesque-latin-standard-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Bricolage"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(fonts/bricolage-grotesque-latin-ext-standard-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Atkinson"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/atkinson-hyperlegible-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Atkinson"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Atkinson"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/atkinson-hyperlegible-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Atkinson"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Atkinson"; font-style: italic; font-weight: 400; font-display: swap;
  src: url(fonts/atkinson-hyperlegible-latin-400-italic.woff2) format("woff2"); }

:root {
  /* colour */
  --paper: #F6F8FB;   --surface: #FFFFFF;  --wash: #EEF2F7;   --line: #DCE3EC;  --line-strong: #C3CEDB;
  --ink: #1D2433;     --ink-2: #4A5468;    --ink-3: #6B7486;
  --pine: #0F6E5B;    --pine-deep: #0A5345; --pine-wash: #E3F2EE;
  --sun: #FFC845;     --sun-deep: #B98300;  --sun-wash: #FFF6DC;
  --berry: #C2255C;   --berry-wash: #FCE8EF;
  --focus: #2B59C3;
  /* type */
  --display: "Bricolage", "Segoe UI", system-ui, sans-serif;
  --text: "Atkinson", "Segoe UI", system-ui, sans-serif;
  --fs-sm: 0.8125rem; --fs-base: 1rem; --fs-md: 1.125rem; --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;   --fs-2xl: 2.25rem; --fs-hero: clamp(2.4rem, 5.2vw, 4.1rem);
  /* shape: big panels round, controls tighter, chips fully round */
  --r-panel: 22px; --r-ctl: 11px; --r-sm: 7px;
  --shadow: 0 1px 0 rgba(29,36,51,.04), 0 8px 24px -12px rgba(29,36,51,.18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 var(--fs-base)/1.55 var(--text);
  -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: var(--pine); text-underline-offset: 3px; }
a:hover { color: var(--pine-deep); }
h1, h2, h3, h4 { font-family: var(--display); color: var(--ink); margin: 0; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.12; font-variation-settings: "wdth" 100; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-md); letter-spacing: -0.01em; }
p { margin: 0 0 1em; max-width: 68ch; }
small, .small { font-size: var(--fs-sm); }
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--sun); color: var(--ink); }

/* ---------- buttons ---------- */
.btn { --b: var(--pine); --f: #fff; display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: 700 var(--fs-base)/1 var(--text); padding: .8em 1.15em; border-radius: var(--r-ctl);
  border: 1.5px solid var(--b); background: var(--b); color: var(--f); cursor: pointer; text-decoration: none;
  white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { --b: var(--pine-deep); color: var(--f); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-busy="true"] { opacity: .55; cursor: default; }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); padding-inline: .7em; }
.btn-quiet:hover { background: var(--wash); color: var(--ink); border-color: transparent; }
.btn-danger { --b: var(--berry); }
.btn-danger:hover { --b: #9E1B4A; }
.btn-danger-outline { background: transparent; color: var(--berry); border-color: #EBB3C6; }
.btn-danger-outline:hover { background: var(--berry-wash); color: var(--berry); border-color: var(--berry); }
.btn-sun { --b: var(--sun); --f: var(--ink); }
.btn-sun:hover { --b: #F4B820; --f: var(--ink); }
.btn-sm { font-size: var(--fs-sm); padding: .6em .85em; border-radius: var(--r-sm); }
.btn-lg { font-size: var(--fs-md); padding: .9em 1.35em; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
label, .label { display: block; font-weight: 700; font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: .35rem; }
.field { margin-bottom: 1rem; }
.help { font-size: var(--fs-sm); color: var(--ink-3); margin-top: .3rem; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; font: 400 var(--fs-base)/1.3 var(--text); color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: var(--r-ctl); padding: .72em .85em; }
input:focus, select, textarea:focus { border-color: var(--ink-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
textarea { min-height: 90px; resize: vertical; }
.input-code { font-family: var(--display); font-size: 1.35rem; letter-spacing: .14em; text-transform: uppercase; text-align: center; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 200px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.error { color: var(--berry); font-size: var(--fs-sm); min-height: 1.3em; margin-top: .5rem; }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 30px; cursor: pointer; transition: background .2s; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--pine); }
.switch input:checked + span::before { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* segmented control */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--wash);
  border-radius: var(--r-ctl); padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; font: 700 var(--fs-sm)/1 var(--text); color: var(--ink-2);
  padding: .75em 1em; border-radius: 8px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(29,36,51,.14); }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 1.4rem; }
.panel + .panel { margin-top: 1rem; }
.panel-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.panel-head h2, .panel-head h3 { flex: 1; }
.list > * { padding: .85rem 0; border-top: 1px solid var(--line); }
.list > *:first-child { border-top: 0; padding-top: 0; }
.list > *:last-child { padding-bottom: 0; }
.banner { border-radius: var(--r-ctl); padding: .85rem 1rem; display: flex; gap: .7rem; align-items: flex-start; font-size: .95rem; }
.banner .bi { font-size: 1.15rem; line-height: 1.3; }
.banner-warn { background: var(--sun-wash); color: #6B4C00; }
.banner-bad { background: var(--berry-wash); color: #7F1239; }
.banner-ok { background: var(--pine-wash); color: var(--pine-deep); }
.banner-info { background: var(--wash); color: var(--ink-2); }

/* status chips */
.chip { display: inline-flex; align-items: center; gap: .4em; font: 700 .75rem/1 var(--text); padding: .45em .75em;
  border-radius: 99px; white-space: nowrap; background: var(--wash); color: var(--ink-2); }
.chip::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; }
.chip-ok { background: var(--pine-wash); color: var(--pine); }
.chip-sun { background: var(--sun-wash); color: var(--sun-deep); }
.chip-bad { background: var(--berry-wash); color: var(--berry); }
.chip-plain::before { display: none; }

/* tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th { text-align: left; font-weight: 700; font-size: var(--fs-sm); color: var(--ink-3); padding: .6rem .75rem;
  border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.table td { padding: .8rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: var(--paper); }
.table .r { text-align: right; }

/* log (activity feeds) */
.log { margin: 0; padding: 0; list-style: none; }
.log li { display: grid; grid-template-columns: 6.2rem 1fr; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--line); font-size: .9375rem; }
.log li:first-child { border-top: 0; }
.log time { color: var(--ink-3); font-size: var(--fs-sm); padding-top: .1em; font-variant-numeric: tabular-nums; }

/* empty state */
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--ink-2); }
.empty .bi { font-size: 2rem; color: var(--line-strong); display: block; margin-bottom: .5rem; }

/* ---------- the play-time dial (the product's signature element) ---------- */
.dial { position: relative; width: 100%; max-width: 240px; aspect-ratio: 1; margin-inline: auto; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial .track { fill: none; stroke: var(--wash); stroke-width: 16; }
.dial .arc { fill: none; stroke: var(--sun); stroke-width: 16; stroke-linecap: round;
  transition: stroke-dashoffset .6s cubic-bezier(.3,.7,.2,1), stroke .3s; }
.dial .ticks { fill: none; stroke: var(--line); stroke-width: 2; }
.dial-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.dial-value { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 9vw, 3.6rem); line-height: .95;
  letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.dial-unit { font-size: var(--fs-sm); color: var(--ink-2); margin-top: .35rem; font-weight: 700; }
.dial.is-blocked .arc { stroke: var(--berry); }
.dial.is-blocked .dial-value { color: var(--berry); font-size: 1.6rem; letter-spacing: -0.02em; }
.dial.is-off .arc { stroke: var(--line-strong); }
.dial.is-protected .dial-value { color: var(--pine); font-size: 1.6rem; letter-spacing: -0.02em; }
.dial.is-protected .arc { stroke: var(--pine); }
.dial.is-low .arc { stroke: #F59E0B; }

/* ---------- toast & dialog ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px);
  background: var(--ink); color: #fff; padding: .8rem 1.1rem; border-radius: var(--r-ctl); font-size: .95rem;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: min(92vw, 480px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--berry); }
dialog.modal { border: 0; border-radius: var(--r-panel); padding: 0; width: min(94vw, 520px); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(29,36,51,.45); }
dialog.modal::backdrop { background: rgba(29,36,51,.45); }
.modal-body { padding: 1.5rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.5rem; background: var(--paper);
  border-top: 1px solid var(--line); }

/* ---------- brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 800 1.2rem/1 var(--display); color: var(--ink);
  text-decoration: none; letter-spacing: -0.03em; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 30px; height: 30px; flex: none; }

/* ---------- app shell (customer app + admin) ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1.4rem 1rem; border-right: 1px solid var(--line); background: var(--surface); }
.side .brand { padding: 0 .55rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .7rem .75rem; border-radius: var(--r-ctl);
  color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: .95rem; }
.nav a .bi { font-size: 1.1rem; }
.nav a:hover { background: var(--wash); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; }
.nav a .count { margin-left: auto; background: var(--sun); color: var(--ink); font-size: .72rem; padding: .2em .55em; border-radius: 99px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 1rem; font-size: var(--fs-sm); }
.side-foot .who { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { min-width: 0; padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem; }
.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head > div { flex: 1 1 260px; }
.page-head p { margin: .35rem 0 0; color: var(--ink-2); }
.content { max-width: 1040px; }
.mobilebar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 1rem 1rem calc(88px + env(safe-area-inset-bottom)); }
  .mobilebar { display: flex; position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    background: var(--surface); border-top: 1px solid var(--line); padding: .4rem .4rem calc(.4rem + env(safe-area-inset-bottom)); }
  .mobilebar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .45rem 0;
    color: var(--ink-3); text-decoration: none; font-size: .72rem; font-weight: 700; border-radius: var(--r-sm); }
  .mobilebar a .bi { font-size: 1.3rem; }
  .mobilebar a[aria-current="page"] { color: var(--pine); }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
  .grid2.stack-sm, .grid3.stack-sm { grid-template-columns: 1fr; }
}
@media (min-width: 861px) { .mobile-top { display: none; } }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { background: var(--ink); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art .brand { color: #fff; }
.auth-art blockquote { margin: 0; font: 700 clamp(1.6rem, 3vw, 2.4rem)/1.15 var(--display); letter-spacing: -0.02em; max-width: 18ch; }
.auth-art p { color: #B8C1D1; }
.auth-form { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-form > div { width: 100%; max-width: 400px; }
.auth-form h1 { margin-bottom: .4rem; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
