/* Agent Control. JHC house style: Newsreader headings, JHC Text body, deep green accent, gold used once.
   Proportions on the golden ratio: type 14 / 16 / 26 / 42 (16 × φ), spacing 8 13 21 34 55 89, splits 1.618fr : 1fr. */
@font-face { font-family: 'JHC Text'; src: url('/fonts/font-jhctext-latin.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/fonts/font-newsreader-latin.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }

:root {
  --ink: #111418; --sub: #5b6168; --faint: #8a9096;
  --line: #e1e7eb; --line-strong: #cfd6db;
  --soft: #f6f6f4; --tint: #f3f6f8;
  --accent: #1a3a34; --accent-hover: #12302a; --accent-soft: #e8efed;
  --gold: #E2A82B; --wait: #7a5a12; --bad: #9b2c1f; --bad-soft: #fbefed;
  --r-sm: 8px; --r-md: 13px;
  --s1: 8px; --s2: 13px; --s3: 21px; --s4: 34px; --s5: 55px; --s6: 89px;
  --body: 'JHC Text', system-ui, sans-serif; --head: 'Newsreader', Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.618 var(--body); color: var(--ink); background: #fff; }
h1, h2, h3 { font-family: var(--head); font-weight: 500; line-height: 1.236; margin: 0; color: var(--ink); }
h1 { font-size: 42px; letter-spacing: -0.01em; }
h2 { font-size: 26px; }
h3 { font-size: 16px; font-family: var(--body); font-weight: 650; line-height: 1.4; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
.sub { color: var(--sub); }
.small { font-size: 14px; }
.loading { padding: var(--s5) var(--s3); color: var(--sub); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- frame ---------- */
.top { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1236px; margin: 0 auto; padding: var(--s2) var(--s4); display: flex; align-items: center; gap: var(--s3); }
.brand { display: flex; align-items: center; gap: var(--s2); text-decoration: none; color: var(--ink); }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand b { font: 500 21px/1 var(--head); }
.top .who { margin-left: auto; display: flex; align-items: center; gap: var(--s3); font-size: 14px; color: var(--sub); }
.top .who strong { color: var(--ink); font-weight: 600; }
.nav { max-width: 1236px; margin: 0 auto; padding: 0 var(--s4); display: flex; gap: var(--s4); overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: var(--s2) 0; text-decoration: none; color: var(--sub); white-space: nowrap; border-bottom: 2px solid transparent; font-size: 15px; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); border-bottom-color: var(--accent); }
.nav .count { color: var(--wait); font-weight: 650; }
main { max-width: 1236px; margin: 0 auto; padding: var(--s5) var(--s4) var(--s6); }
.page-head { margin-bottom: var(--s4); max-width: 760px; }
.page-head p { margin-top: var(--s2); color: var(--sub); font-size: 17px; }
.split { display: grid; grid-template-columns: 1.618fr 1fr; gap: var(--s5); align-items: start; }
.aside { position: sticky; top: 140px; }
.aside section + section { margin-top: var(--s4); }
.aside h2 { font-size: 21px; margin-bottom: var(--s2); }

/* ---------- buttons and fields ---------- */
button, .btn { font: inherit; font-size: 15px; font-weight: 600; border-radius: var(--r-sm); padding: var(--s1) var(--s3); min-height: 42px; cursor: pointer; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: var(--s1); }
button:hover, .btn:hover { border-color: var(--ink); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.quiet { border-color: transparent; background: none; color: var(--accent); padding-left: 0; padding-right: 0; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; min-height: 34px; }
button.quiet:hover { color: var(--accent-hover); }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: var(--s1) var(--s2); min-height: 42px; background: #fff; max-width: 100%; }
textarea { width: 100%; min-height: 89px; resize: vertical; line-height: 1.5; }
input[type=number] { width: 110px; }
input[type=time] { width: 130px; }
input[type=date] { width: 170px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
label.field { display: block; margin-bottom: var(--s3); }
label.field > span { display: block; font-weight: 600; margin-bottom: 4px; font-size: 15px; }
label.field input:not([type=checkbox]):not([type=radio]) { width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.row + .row { margin-top: var(--s2); }
.err { color: var(--bad); font-size: 15px; margin-top: var(--s1); }
.ok { color: var(--accent); font-size: 15px; margin-top: var(--s1); }

/* segmented on/off and day pickers */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-height: 42px; font-weight: 500; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }
.seg button:disabled { opacity: 1; cursor: default; }
.seg button:disabled:not(.on) { color: var(--faint); }
.days { display: flex; flex-wrap: wrap; gap: var(--s1); }
.days button { min-width: 55px; justify-content: center; font-weight: 500; }
.days button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.choices label { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s1) 0; cursor: pointer; }
.choices input { min-height: 0; margin-top: 6px; accent-color: var(--accent); }

/* ---------- a control ---------- */
.ctl { padding: var(--s3) 0; border-top: 1px solid var(--line); }
.ctl:first-child { border-top: 0; padding-top: 0; }
.ctl-head { display: flex; gap: var(--s3); align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.ctl-head .now { color: var(--sub); font-size: 15px; text-align: right; }
.ctl .help { color: var(--sub); font-size: 15px; margin-top: 2px; max-width: 610px; }
.ctl .edit { margin-top: var(--s2); }
.ctl .rule { margin-top: var(--s2); font-size: 14px; color: var(--sub); }
.ctl .rule.held { color: var(--wait); }
.ctl .waiting { margin-top: var(--s2); background: var(--soft); border-radius: var(--r-sm); padding: var(--s2) var(--s3); font-size: 15px; }
.ctl .waiting + .waiting { margin-top: var(--s1); }
.ctl .waiting b { font-weight: 650; color: var(--wait); }
.list { list-style: none; margin: var(--s2) 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); }
.list li { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); padding: 6px var(--s2); border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li.none { color: var(--faint); }
.meter { height: 8px; background: var(--tint); border-radius: 8px; overflow: hidden; margin-top: var(--s1); max-width: 377px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter.high i { background: var(--gold); }
.hours { display: grid; grid-template-columns: 55px auto 1fr; gap: var(--s1) var(--s2); align-items: center; max-width: 520px; }
.hours label { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.hours input[type=checkbox] { min-height: 0; accent-color: var(--accent); width: 18px; height: 18px; }

/* group headings inside a module page */
.group { margin-top: var(--s5); }
.group:first-of-type { margin-top: 0; }
.group > h2 { margin-bottom: var(--s3); padding-bottom: var(--s1); border-bottom: 1px solid var(--ink); }

/* ---------- overview ---------- */
.agents { border-top: 1px solid var(--ink); }
.agent { display: grid; grid-template-columns: 1.618fr 1fr; gap: var(--s4); padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
.agent h2 a { color: inherit; text-decoration: none; }
.agent h2 a:hover { text-decoration: underline; }
.agent .state { margin-top: var(--s1); font-size: 17px; }
.agent .state.paused { color: var(--wait); }
.agent .line { color: var(--sub); margin-top: 4px; }
.agent .open { margin-top: var(--s2); }
.facts { display: grid; gap: var(--s2); align-content: start; }
.fact b { display: block; font: 500 26px/1.2 var(--head); }
.fact span { color: var(--sub); font-size: 14px; }
.notice-bar { background: var(--soft); border-radius: var(--r-sm); padding: var(--s2) var(--s3); margin-bottom: var(--s4); max-width: 760px; }
.notice-bar.practice { background: var(--tint); }

/* ---------- posts ---------- */
.posts { list-style: none; padding: 0; margin: 0; }
.day-head { font-weight: 650; margin: var(--s3) 0 var(--s1); font-size: 15px; }
.day-head:first-child { margin-top: 0; }
.post { display: grid; grid-template-columns: 89px 1fr; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--line); }
.post img, .post .noimg { width: 89px; height: 89px; object-fit: cover; border-radius: var(--r-sm); background: var(--soft); display: block; }
.post .meta { font-size: 14px; color: var(--sub); }
.post .meta b { color: var(--ink); font-weight: 650; }
.post .text { margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post .acts { margin-top: var(--s1); display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.post .state-wait { color: var(--wait); font-weight: 650; }
.post .state-bad { color: var(--bad); font-weight: 650; }
.post.faded .text, .post.faded img { opacity: .55; }
.composer { border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: var(--s3); margin: var(--s2) 0 var(--s3); box-shadow: 0 21px 34px -22px rgba(17, 20, 24, .28); }
.composer .count { font-size: 14px; color: var(--sub); text-align: right; }
.composer .photo { display: flex; gap: var(--s2); align-items: center; }
.composer .photo img { width: 55px; height: 55px; object-fit: cover; border-radius: var(--r-sm); }
.checks { display: flex; flex-wrap: wrap; gap: var(--s3); }
.checks label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.checks input { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }
.notices { display: grid; gap: var(--s2); }
.notice { border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s2) var(--s3); }
.notice .words { color: var(--sub); font-size: 15px; margin: 4px 0 var(--s1); }
.notice .gaps { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; }
.notice .gaps input { width: 160px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-weight: 650; padding: var(--s1) var(--s2) var(--s1) 0; border-bottom: 1px solid var(--ink); vertical-align: bottom; }
td { padding: var(--s2) var(--s2) var(--s2) 0; border-bottom: 1px solid var(--line); vertical-align: top; }
td .sub, td.sub { font-size: 14px; }
.status-waiting { color: var(--wait); font-weight: 650; }
.status-done { color: var(--accent); font-weight: 650; }
.status-declined { color: var(--bad); font-weight: 650; }
.status-withdrawn { color: var(--faint); }
.empty { color: var(--sub); padding: var(--s3) 0; }
.scroll { overflow-x: auto; }

/* ---------- sign-in ---------- */
.gate { min-height: 100vh; display: grid; grid-template-columns: 1fr 1.618fr; }
.gate .panel { padding: var(--s6) var(--s5); display: flex; flex-direction: column; justify-content: center; }
.gate .panel .brand { margin-bottom: var(--s5); }
.gate form { max-width: 377px; }
.gate h1 { margin-bottom: var(--s2); }
.gate .lead { color: var(--sub); margin-bottom: var(--s4); max-width: 377px; }
.gate .side { background: var(--accent); color: #eef3f1; padding: var(--s6) var(--s5); display: flex; flex-direction: column; justify-content: flex-end; position: relative; overflow: hidden; }
.gate .side h2 { color: #fff; font-size: 26px; max-width: 520px; position: relative; }
.gate .side p { margin-top: var(--s2); max-width: 520px; color: #d3dfdb; position: relative; }
.gate .side svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .18; }
.gate .foot { margin-top: var(--s4); font-size: 14px; color: var(--sub); max-width: 377px; }
.key { font: 600 17px/1.5 var(--body); letter-spacing: .06em; background: var(--soft); padding: var(--s1) var(--s2); border-radius: var(--r-sm); display: inline-block; word-break: break-all; }
.linkbox { display: flex; gap: var(--s1); margin-top: var(--s1); }
.linkbox input { flex: 1; font-size: 14px; }
.callout { background: var(--accent-soft); border-radius: var(--r-sm); padding: var(--s2) var(--s3); margin: var(--s2) 0; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: var(--s3); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: var(--s1) 0; text-decoration: none; color: var(--sub); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 15px; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.perm { display: grid; grid-template-columns: minmax(200px, 1.618fr) 190px 160px 150px; gap: var(--s2); padding: var(--s2) 0; border-top: 1px solid var(--line); align-items: start; }
.perm.head { font-weight: 650; border-top: 0; border-bottom: 1px solid var(--ink); font-size: 14px; }
.perm .why { grid-column: 1 / -1; color: var(--sub); font-size: 14px; margin-top: -4px; max-width: 760px; }
.perm select { width: 100%; font-size: 15px; }
.perm .range { display: flex; gap: 4px; align-items: center; font-size: 14px; }
.perm .range input { width: 66px; padding: 4px 6px; font-size: 15px; }
.perm .changed { color: var(--wait); font-size: 13px; display: block; }
.perm .saved { color: var(--accent); font-size: 13px; }
.mods { display: grid; gap: var(--s1); }
.mods label { display: flex; gap: var(--s1); align-items: center; }
.mods input { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }
.preview-frame { border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: var(--s4); }
.admin-set { margin-top: var(--s1); font-size: 14px; display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: var(--s4); transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: var(--r-sm); padding: var(--s2) var(--s3); display: flex; gap: var(--s3); align-items: center; z-index: 20; max-width: calc(100% - 34px); font-size: 15px; box-shadow: 0 13px 34px -13px rgba(0, 0, 0, .4); }
.toast button { background: none; border: 0; color: #fff; text-decoration: underline; padding: 0; min-height: 0; font-weight: 600; }
.toast.bad { background: var(--bad); }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .split, .agent { grid-template-columns: 1fr; gap: var(--s4); }
  .aside { position: static; }
  .gate { grid-template-columns: 1fr; }
  .gate .side { display: none; }
  .gate .panel { padding: var(--s5) var(--s3); justify-content: flex-start; }
  .perm { grid-template-columns: 1fr 1fr; }
  .perm > :first-child { grid-column: 1 / -1; }
  .perm.head { display: none; }
}
@media (max-width: 640px) {
  h1 { font-size: 34px; }
  h2 { font-size: 23px; }
  .top-in { padding: var(--s2) var(--s3); }
  .top .who .name { display: none; }
  .nav { padding: 0 var(--s3); gap: var(--s3); }
  main { padding: var(--s4) var(--s3) var(--s6); }
  .ctl-head .now { text-align: left; }
  .facts { grid-template-columns: 1fr 1fr; }
  .hours { grid-template-columns: 48px auto; }
  .hours .times { grid-column: 1 / -1; padding-left: 0; }
  td, th { font-size: 14px; }
}
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .2s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
}
