/* Guardian53 School Edition — Ivory & Gold · v2.3.0
   Presentation layer only: authentication, API routes, rules and schema unchanged.
   Accessible contrast, no remotely hosted assets, reduced-motion support. */
:root {
  color-scheme: light;
  --bg: #fffaf0;
  --bg-2: #fff5df;
  --card: #fffefd;
  --card-2: #fff8e9;
  --ink: #30291d;
  --ink-2: #4e4030;
  --muted: #776955;
  --muted-2: #8a7962;
  --line: #e9ddc6;
  --line-2: #f0e6d6;
  --brand: #ad7b28;
  --brand-2: #d1a955;
  --brand-bright: #84590f;
  --brand-soft: #f7e9c8;
  --ok: #24744e;
  --ok-soft: #e5f5e9;
  --danger: #9c3036;
  --danger-soft: #fff0ef;
  --warn: #855b0f;
  --warn-soft: #fff1d0;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 22px 60px rgba(103, 76, 28, .13);
  --shadow-soft: 0 6px 24px rgba(103, 76, 28, .075);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
html { background: var(--bg); scroll-behavior: smooth; }
body {
  background:
    radial-gradient(850px 500px at 108% -6%, rgba(210, 165, 73, .23), transparent 66%),
    radial-gradient(850px 500px at -10% 17%, rgba(238, 211, 146, .25), transparent 67%),
    linear-gradient(145deg, #fffefa 3%, #fff8e9 63%, #fff5e5 100%);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  min-height: 100dvh;
}
::selection { background:#f1d9a0; color: #352309; }
:focus-visible { outline: 3px solid #c39543 !important; outline-offset: 3px; }
a { color: var(--brand-bright); text-underline-offset: 3px; }
.brand-mark {
  background: linear-gradient(135deg,#96701c 0%,#d9b66f 52%,#ab7b2c 100%);
  color:#fffefa; font-size: 13px; border:1px solid #ddc994;
  box-shadow: 0 7px 17px rgba(148, 104, 27, .22); border-radius: 11px;
  min-width: 38px; min-height: 38px;
}
.brand-name { color: var(--ink); font-weight: 800; letter-spacing:1.7px; }
.brand-name b, .side-brand b { color: var(--brand); }
h1,h2,h3,h4 { letter-spacing:-.035em; }
h1,h2 { font-weight:800; }
.muted,.panel-sub,.hint,.empty { color: var(--muted); }

/* App shell, ivory sidebar, gold navigation */
.sidebar {
  background: linear-gradient(180deg, #fffefa 0%, #fff7e8 64%, #f9edce 100%);
  border-right:1px solid #ebdfc6;
  box-shadow: 6px 0 24px rgba(103,76,28,.035);
}
.side-brand { border-bottom:1px solid var(--line); padding-bottom:19px; font-weight:800; letter-spacing:.4px; }
.side-brand small { color:#997129; font-size:10px; letter-spacing:1.4px; }
.side-foot { border-color:var(--line); }
.side-user { color:var(--ink-2); }
.navbtn { color:#685945; font-weight:650; border:1px solid transparent; transition:background .22s,border-color .22s,transform .22s,color .22s; }
.navbtn:hover { background:rgba(201,158,73,.11); color:#674714; border-color:#eadabb; transform:translateX(2px); }
.navbtn.active { background:linear-gradient(115deg,#aa782a,#d8b26a); color:#fffefa; box-shadow:0 9px 22px rgba(174,123,39,.23); }
.navbtn.active:hover {transform:none;}
.nav-ico { color:inherit; }
.nav-badge { background:#9e3036; }
.main { max-width:none; }
/* Deliberately NON-sticky: the browser's zoom and native inputs must never sit under it. */
.topbar {
  position:relative; top:auto; z-index:2; margin-bottom:23px;
  padding:18px 3px 15px;
  background:transparent; border-color:rgba(180,142,74,.18);
  backdrop-filter:none;
}
.topbar h2 { color:#382a13; font-size:clamp(20px,2vw,28px); letter-spacing:-.7px; }
.top-actions {flex-wrap:wrap;justify-content:flex-end;}
.conn-chip {background:#f7efdc; color:#715b36; border-color:#e9dab8;}
.conn-chip[data-conn="ok"] { color:var(--ok); border-color:#b7dfc8; background:var(--ok-soft); }
.conn-chip[data-conn="off"] { color:var(--warn); border-color:#e9d39f; background:var(--warn-soft); }

/* Warm surfaces */
.panel,.stat,.auth-card,.modal-card {
  background:linear-gradient(155deg,rgba(255,255,255,.99),rgba(255,252,245,.98));
  border:1px solid #eadfc8; border-radius:19px; box-shadow:var(--shadow-soft);
}
.panel { padding:clamp(18px,2.3vw,26px); margin-bottom:14px; transition:border-color .22s, box-shadow .22s,transform .22s; }
.panel:hover { border-color:#d7bd83; box-shadow:0 10px 32px rgba(113,84,30,.11); transform:translateY(-1px); }
.stat {border-radius:15px; padding:19px;}
.stat-value { color:#493318; }
.stat-value.brand {background:linear-gradient(110deg,#957020,#d2a34a);-webkit-background-clip:text;background-clip:text;color:transparent;}
.stat-label { color:#716249; }
.stat-sub { color:#907d63; }
.panel-head {gap:14px; flex-wrap:wrap;}
.panel-head h3 {font-size:16px; font-weight:800; color:#332716;}
.section-eyebrow {font-size:10px; letter-spacing:2px; color:#a17c32; font-weight:800;}
.pill {background:#fff7e8;border-color:#ead9b4;color:#705a35;}
.pill-soft {background:#f8e9c7;color:#765318;}
.row {border-color:var(--line-2)}
.chip-ok {color:#216d4b}.chip-warn {color:#845d14}.chip-danger {color:#a13138}
.cat-card {opacity:.85;background:#fffbf3;border-color:#ecdfc5;}
.cat-card.on {background:#fffdf8;border-color:#caa05c;box-shadow:0 7px 24px rgba(168,120,36,.11);}
.cat-card:hover {opacity:1;}
.cat-desc { color:var(--muted); }
.toggle .knob {background:#c9bea7;}
.toggle .knob::after {background:#fff;}
.toggle input:checked + .knob {background:linear-gradient(115deg,#a87724,#c9a04b);}

/* Controls */
.btn { background:#fffaf1; color:#523b1b; border-color:#e5d5b7; font-weight:700; border-radius:12px; min-height:40px; box-shadow:0 2px 6px rgba(106,79,30,.025); transition:background .18s,border-color .18s,box-shadow .18s,transform .18s; }
.btn:hover {background:#fff2d9; border-color:#cfaa60; transform:translateY(-1px); box-shadow:0 6px 17px rgba(118,89,39,.10);}
.btn:active {transform:translateY(0);}
.btn-primary {color:#fffefa;background:linear-gradient(120deg,#9d6c1e,#d0a552 65%,#a47627);border-color:#a87a2a;box-shadow:0 6px 15px rgba(145,97,17,.18);}
.btn-primary:hover {color:#fff;background:linear-gradient(120deg,#916019,#bc9040,#94611a);border-color:#92691e;}
.btn-secondary {background:#fdf4e2;}
.btn-ghost {background:#fffdf8;border-color:#e9ddc5;color:#725b35;}
.btn-ghost:hover {color:#4d3515;}
.btn-danger {background:#a2353a;color:#fff;border-color:#a2353a;}
.btn-danger:hover {background:#902c31;color:#fff;}
.btn-danger-ghost {border-color:#e4baba;color:#99343b;background:#fff8f6;}
.btn-danger-ghost:hover {background:#fff0ee;}
.link-btn {color:var(--brand-bright);}
.link-muted {color:#7e6a4e;}
.link-muted:hover {color:#5e451f;}
.icon-btn {background:#fff6e5;border-color:#e5d4b3;color:#735928;}
input,select,textarea {accent-color:#aa7e2a;color-scheme:light;}
.auth-screen {background:radial-gradient(730px 400px at 50% -9%,rgba(213,170,92,.27),transparent 68%),linear-gradient(150deg,#fffdf9,#fff4dc);}
.auth-card {width:min(445px,100%);padding:32px;box-shadow:var(--shadow);}
.auth-card input,.inline-form input,.inline-form select,.select-inline,input[type="search"]#site-search,
.modal-card input[type="text"],.modal-card input:not([type]),.modal-card input[type="time"],
.mac-inline-edit select,.mac-inline-edit input,.mac-add-rule select,.mac-add-rule input,.mac-field input,.g53-school-controls select {
  background:#fffdf8;border:1px solid #e5d7bd;color:#3b2e1c;min-height:42px;border-radius:10px;
}
.auth-card input:focus {border-color:#bc8b34;box-shadow:0 0 0 4px rgba(195,148,64,.12);}
.mode-btn {background:#fff8ed;color:#6e5d42;}
.mode-btn.active {background:#f8e7c4;border-color:#c59b4c;color:#6b4b17;}
.mode-btn:hover {border-color:#c7a45e;color:#5d421f;}
.auth-foot {border-color:var(--line);}
.file-btn {background:#fff7e8;border-color:#d8c5a3;color:#654d25;}
.pair-code {background:#fff9ec;color:#876017;border-color:#d3b678;}
.modal {background:rgba(53,41,23,.44);backdrop-filter:blur(7px);}
.modal-card {box-shadow:0 24px 75px rgba(39,32,19,.25);}
.day {background:#fffdf7;border-color:#e8dabc;color:#6c5836;}
.day:has(input:checked) {background:#f5e4c0;border-color:#c49746;color:#493414;}
.check-label,.check {color:var(--ink-2);}
.cat-checks {background:#fff8ed;}
.suggest-box {background:#fff4db;border-color:#ead5a5;color:var(--ink-2);}
.bar-fill {background:linear-gradient(90deg,#a77723,#e0b96c);}
.bar-track {background:#f6ecd7;}
.tabbar {background:rgba(255,251,241,.97);border-color:#e7d8b8;box-shadow:0 -6px 20px rgba(108,84,34,.05);}
.tabbtn {color:#78674f;}.tabbtn.active {color:#9d6d20;}
.toast {background:#654315;color:#fff9ef;box-shadow:var(--shadow);}
.mac-device {background:linear-gradient(145deg,#fffdf7,#fff6e4);border-color:#e9dbc0;}
.mac-device:hover {border-color:#c4a15c;}
.mac-code {color:#916a22;}
#mac-protection-alerts {border-color:#e5c795;background:#fff6e5;}
.g53-school-summary {background:#fff8e9;color:#635033;border-color:#e4d5b6;}
.g53-school-controls label {color:#796446;}
.g53-school-date {color:#856b40;}

/* Website-only schedule editing: fully in document flow, with independent
   hour / minute controls to prevent clipping by browser native time pickers. */
#view-schedules {overflow:visible;}
#schedule-editor {
  scroll-margin-top:24px; overflow:visible;
  border:1px solid #d8bc7e;
  background:linear-gradient(165deg,#fffefb 0%,#fff8e9 100%);
  box-shadow:0 12px 36px rgba(117,78,21,.10);
}
.schedule-editor-head h3 {font-size:clamp(20px,2vw,25px);}
.schedule-field label,.schedule-days legend {color:#59431f;}
.schedule-field input {background:#fff;border-color:#ddc9a5;color:#372912;min-height:48px;color-scheme:light;}
.schedule-field input:focus-visible {outline-color:#ad7b28;}
.schedule-time-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:17px 0 14px;}
.schedule-time-card {min-width:0;border:1px solid #e4d4b5;background:rgba(255,255,255,.76);border-radius:17px;padding:16px;}
.schedule-time-eyebrow {display:block;color:#987437;letter-spacing:1.75px;font-size:10px;font-weight:800;margin-bottom:3px;}
.schedule-time-label {display:block;font-size:15px;font-weight:800;color:#352915;margin-bottom:10px;}
.schedule-time-label small {font-size:11px;font-weight:500;color:#8a7350;margin-left:5px;}
.schedule-clock {display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:9px;align-items:end;min-width:0;}
.schedule-clock-unit {display:flex;flex-direction:column;gap:6px;min-width:0;}
.schedule-clock-unit span {color:#7b694e;font-size:11px;font-weight:700;}
.schedule-clock-unit select {
  display:block;width:100%;min-width:0;max-width:100%;height:54px;
  background:#fffdf9;color:#382812;border:1.5px solid #d7bc85;
  border-radius:12px;padding:7px 28px 7px 14px;
  font:700 clamp(17px,2.1vw,23px)/1.2 ui-monospace, "SFMono-Regular", Menlo, Consolas,monospace;
  font-variant-numeric:tabular-nums;
  box-shadow:0 3px 10px rgba(107,76,22,.04);
  cursor:pointer;color-scheme:light;
}
.schedule-clock-unit select:hover {border-color:#b08737;background:#fff9eb;}
.schedule-clock-unit select:focus {outline:3px solid #e9c276;outline-offset:2px;}
.clock-colon {font-size:25px;font-weight:800;color:#a67e32;padding-bottom:10px;}
.schedule-preview {display:flex;align-items:center;gap:12px;padding:13px 16px;background:#f9edcf;border:1px solid #e5cb8f;border-radius:13px;color:#4c3716;}
.schedule-preview-icon {display:grid;place-items:center;flex:0 0 36px;height:36px;border-radius:10px;background:#fff9e9;color:#9c7027;font-size:23px;}
.schedule-preview strong {display:block;font-size:12px;}
.schedule-preview p {margin:2px 0 0;font-size:15px;font-weight:700;font-variant-numeric:tabular-nums;}
.schedule-days {margin-top:19px;}
.schedule-days .day {font-size:13px;padding:10px 14px;margin-bottom:6px;}
.schedule-editor .modal-actions {border-top:1px solid #eadbbf;padding-top:17px;margin-top:22px;}
.field-hint {color:#776348;}

/* Interaction, never at the cost of motion-sensitive users */
@media(prefers-reduced-motion:no-preference) {
  @keyframes g53-enter {from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
  @keyframes g53-gold-glow {0%,100%{box-shadow:0 8px 22px rgba(159,111,29,.16)}50%{box-shadow:0 10px 28px rgba(180,128,35,.27)}}
  .view:not([hidden]) > .panel,.view:not([hidden]) > .grid-2,.view:not([hidden]) > .stat-grid {animation:g53-enter .38s cubic-bezier(.2,.72,.22,1) both;}
  .view:not([hidden]) > :nth-child(2) {animation-delay:.04s;}
  .view:not([hidden]) > :nth-child(3) {animation-delay:.08s;}
  .auth-card {animation:g53-enter .43s both;}
  #schedule-editor:not([hidden]) {animation:g53-enter .24s ease-out both;}
  .navbtn.active {animation:g53-gold-glow 4s ease-in-out infinite;}
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after {animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important;}
}
@media(max-width:800px) {
  .topbar {gap:7px;flex-wrap:wrap;}
  .topbar h2 {flex:1;min-width:120px;}
  .top-actions {gap:6px;}
  #emergency-btn {font-size:12px;padding:7px 9px;}
  .schedule-time-grid {grid-template-columns:1fr;}
}
@media(max-width:560px) {
  .panel {padding:17px 14px;}
  .schedule-time-card {padding:14px;}
  .schedule-clock {gap:7px;}
  .schedule-clock-unit select {padding-left:12px;font-size:22px;}
  .schedule-editor .modal-actions {display:grid;grid-template-columns:1fr 1fr;}
  .schedule-editor .modal-actions .btn {width:100%;min-width:0;}
  #view-schedules > .panel:first-child .panel-head {align-items:flex-start;}
  .tabbar {padding-bottom:calc(6px + env(safe-area-inset-bottom));}
}
/* The existing button uses an ID, not the .menu-toggle class. */
@media(min-width:960px) { #menu-toggle { display:none; } }
@media(max-width:959px) { #menu-toggle { display:inline-flex; } }
