/* Ginza CRM. The look follows the Copilot CRM screens (Guestbook,
   Reservations): the same token names and values as branding.py's derived
   default palette (light, with dark when the phone or computer is in dark
   mode), and the same components: the 52px bar, the big top tabs, .hbtn and
   .hbtn-gold buttons, section bands, pills. Colours come only from tokens,
   so a later brand switch changes this file's :root and nothing else. */
:root {
  --ink:#FFFFFF; --ink-raised:#F0F0F0; --ink-high:#E0E0E0; --ink-line:#CCCCCC;
  --rice:#16181D; --rice-dim:#494B4F; --rice-faint:#646568;
  --kin:#2563EB; --kin-lo:#D8E3FB; --kin-deep:#2055CA; --kin-text:#2159D4; --accent-ink:#F3F3F4;
  --gold:#C9A64A; --gold-ink:#16181D; --gold-deep:#AD8F40; --gold-text:#6F5B29;
  --urushi:#DC2626; --urushi-lo:#F9D8D8; --urushi-text:#DC2626; --urushi-ink:#FFFFFF; --urushi-on-high:#BB2020;
  --matcha:#16A34A; --matcha-lo:#D5EEDE; --matcha-text:#12823B;
  --amber:#D97706; --amber-lo:#F8E7D2; --amber-text:#985304;
  --info:#2563EB; --info-lo:#D8E3FB; --info-text:#2159D4;
  --ui:"Helvetica Neue", Roboto, system-ui, -apple-system, sans-serif; --r:3px; --pad:10px;
  --scrim: rgba(10,7,5,.55);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink:#121212; --ink-raised:#202020; --ink-high:#2E2E2E; --ink-line:#414141;
    --rice:#FFFFFF; --rice-dim:#CBCBCB; --rice-faint:#A5A5A5;
    --kin:#2563EB; --kin-lo:#152139; --kin-deep:#2055CA; --kin-text:#719AF2; --accent-ink:#FFFFFF;
    --gold:#D9B968; --gold-ink:#16181D; --gold-deep:#C4A558; --gold-text:#D9B968;
    --urushi:#F87171; --urushi-lo:#3B2323; --urushi-text:#F87171; --urushi-ink:#16181D; --urushi-on-high:#F87171;
    --matcha:#4ADE80; --matcha-lo:#1C3726; --matcha-text:#4ADE80;
    --amber:#FBBF24; --amber-lo:#3A2E14; --amber-text:#FBBF24;
    --info:#60A5FA; --info-lo:#202C3C; --info-text:#60A5FA;
    --scrim: rgba(0,0,0,.65);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ink); color: var(--rice); font-family: var(--ui); font-size: 14px;
  line-height: 1.35; -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--kin); outline-offset: 2px; }
[hidden] { display: none !important; }
.label { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--rice-dim); font-weight: 700; }
.muted { color: var(--rice-dim); }
.small { font-size: 12px; }
.error { color: var(--urushi-on-high); }
.done { color: var(--matcha-text); font-weight: 700; }

/* ---- the bar and the top tabs (Copilot header, CRM's .resv-toptabs) ---- */
.bar { display: flex; align-items: center; gap: 14px; padding: 0 12px; height: 52px;
  background: var(--ink-raised); border-bottom: 1px solid var(--ink-line); }
.brand { font-size: 13px; font-weight: 700; white-space: nowrap; }
.brand .lead { color: var(--rice-dim); }
.brand .crm { color: var(--kin-text); }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--rice-dim); font-size: 12px; }
.link { border: 0; background: none; color: var(--kin-text); padding: 0; font-size: 12px; font-weight: 600; }
.tabs { display: flex; gap: 8px; padding: 12px 12px 0; }
.tabs button { flex: 1; font-size: 16px; font-weight: 800; padding: 11px 10px; border-radius: 10px;
  border: 1px solid var(--ink-line); background: var(--ink-raised); color: var(--rice); position: relative; }
.tabs button.on { background: var(--kin); border-color: var(--kin); color: var(--accent-ink); }
.pill { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; border-radius: 999px;
  padding: 3px 8px; background: var(--ink-high); color: var(--rice); display: inline-block; }
.tabs .count { margin-left: 6px; font-size: 11px; background: var(--urushi); color: var(--urushi-ink);
  border-radius: 999px; padding: 1px 7px; vertical-align: 2px; }
.tabs button.on .count { background: var(--accent-ink); color: var(--kin); }
.pill.all { background: var(--info-lo); color: var(--info-text); }
.pill.ginza { background: var(--kin-lo); color: var(--kin-text); }
.pill.deli { background: var(--amber-lo); color: var(--amber-text); }
.pill.live { background: var(--matcha-lo); color: var(--matcha-text); }
.pill.off { background: var(--ink-raised); color: var(--rice-faint); }
.pill.wait { background: var(--amber-lo); color: var(--amber-text); }
.pill.no { background: var(--urushi-lo); color: var(--urushi-text); }

/* ---- buttons (.hbtn / .hbtn-gold) and inputs (.search) ---- */
.hbtn { background: var(--ink); border: 1px solid var(--ink-line); border-radius: var(--r); padding: 8px 12px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; min-height: 36px; }
.hbtn:hover { background: var(--ink-high); border-color: var(--rice-faint); }
.hbtn.warn { color: var(--urushi-text); }
.hbtn[disabled], .hbtn-gold[disabled] { opacity: .38; cursor: default; }
.hbtn-gold { background: var(--gold); border: none; color: var(--gold-ink); font-weight: 800; border-radius: var(--r);
  padding: 9px 16px; font-size: 13px; letter-spacing: .02em; min-height: 40px; }
.hbtn-gold:hover { background: var(--gold-deep); }
.wide { width: 100%; }
.search, .field input, .field select, .field textarea, textarea.search, select.search {
  background: var(--ink-raised); border: 1px solid var(--ink-line); border-radius: var(--r); padding: 8px 10px;
  color: var(--rice); font-size: 13px; min-height: 36px; width: 100%; }
.search::placeholder, textarea::placeholder { color: var(--rice-faint); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > .label { color: var(--kin-text); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- sign-in and dialogs (Copilot .close-modal) ---- */
.login { flex: 1; display: grid; place-items: center; padding: 16px; }
.dialog { width: 420px; max-width: 100%; background: var(--ink-raised); border: 1px solid var(--ink-line);
  border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.18); display: flex; flex-direction: column; }
.dialog-head { padding: 14px 16px; border-bottom: 1px solid var(--ink-line); font-size: 15px; font-weight: 800; }
.dialog-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.dialog-body p { margin: 0; }
.dialog-actions { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--ink-line); }
.dialog-actions .hbtn, .dialog-actions .hbtn-gold { flex: 1; min-height: 42px; }
.overlay { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; padding: 16px; z-index: 40; }
.steps { margin: 0; padding-left: 20px; }
.key { display: block; font: 700 16px/1.4 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .05em;
  background: var(--ink); border: 1px dashed var(--ink-line); border-radius: var(--r); padding: 10px; word-break: break-all; }

/* ---- pages ---- */
.page { flex: 1; overflow: auto; padding: 12px; max-width: 980px; width: 100%; margin: 0 auto; }
.sec { border: 1px solid var(--ink-line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: var(--ink-raised); }
.sec-head { display: flex; justify-content: space-between; align-items: center; background: var(--kin); color: var(--accent-ink);
  font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 9px 14px;
  margin: -12px -14px 10px; border-radius: 9px 9px 0 0; }
.sec-head.gold { background: var(--gold); color: var(--gold-ink); }
.empty { max-width: 560px; margin: 40px auto; color: var(--rice-dim); text-align: center; }
.empty h2 { color: var(--rice); font-size: 18px; }
.warning { background: var(--amber-lo); color: var(--amber-text); padding: 8px 14px; font-size: 13px; font-weight: 600; }

/* ---- teach ---- */
.teach { flex: 1; display: grid; grid-template-columns: 250px 1fr; min-height: 0; padding-top: 12px; }
.side { border-right: 1px solid var(--ink-line); padding: 0 12px 12px; overflow: auto; }
.sessions { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--ink-line); border-radius: 10px; overflow: hidden; }
.sessions button { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--ink-line); background: var(--ink);
  padding: 9px 12px; font-size: 13px; font-weight: 500; }
.sessions li:last-child button { border-bottom: 0; }
.sessions button.on { background: var(--ink-high); font-weight: 800; box-shadow: inset 4px 0 0 var(--kin); }
.sessions small { display: block; color: var(--rice-faint); font-weight: 400; font-size: 11px; }
.chat { display: flex; flex-direction: column; min-height: 0; }
.log { flex: 1; overflow: auto; padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 720px; padding: 9px 12px; border-radius: 10px; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; }
.msg.teacher { align-self: flex-end; background: var(--kin-lo); }
.msg.ai { align-self: flex-start; background: var(--ink-raised); border: 1px solid var(--ink-line); }
.msg small { display: block; color: var(--rice-dim); font-size: 11px; font-weight: 700; margin-bottom: 2px; }
.msg.upload { align-self: flex-end; background: none; border: 1px dashed var(--ink-line); color: var(--rice-dim); }
.msg.error { color: var(--urushi-text); }
.composer { border-top: 1px solid var(--ink-line); padding: 10px 14px; background: var(--ink-raised); display: grid; gap: 8px; }
.composer .row { justify-content: flex-start; }
.composer #send { margin-left: auto; }
.file { position: relative; overflow: hidden; display: inline-flex; align-items: center; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---- lesson cards ---- */
.lesson { width: min(720px, 100%); border: 1px solid var(--ink-line); border-radius: 10px; background: var(--ink-raised);
  padding: 12px 14px; display: grid; gap: 8px; }
.log .lesson { align-self: flex-start; border-color: var(--gold); }
.lesson-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lesson-head b { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-text); margin-right: 4px; }
.lesson textarea { resize: vertical; }
.lesson.decided textarea, .lesson textarea[readonly] { border-color: transparent; background: transparent; resize: none; padding-left: 0; }
.lesson .why, .meta { font-size: 12px; color: var(--rice-dim); }
.lesson.off { opacity: .6; }
.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.history { font-size: 12px; color: var(--rice-dim); margin: 0; padding-left: 18px; }
.tools { display: flex; gap: 8px; margin-bottom: 8px; }
.tools .search { flex: 1; }
.tools select.search { width: auto; flex: 0 0 auto; }

/* ---- users ---- */
table.users { width: 100%; border-collapse: collapse; background: var(--ink); border: 1px solid var(--ink-line); border-radius: 10px; overflow: hidden; }
table.users th, table.users td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--ink-line); vertical-align: top; font-size: 13px; }
table.users th { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--rice-faint); font-weight: 700; background: var(--ink-raised); }
table.users tr.off { opacity: .55; }
table.users .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }

@media (max-width: 720px) {
  .bar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 6px 12px; }
  .who { font-size: 12px; }
  .who .role { display: none; }
  .tabs { overflow-x: auto; padding: 8px 8px 0; }
  .tabs button { font-size: 13px; padding: 9px 10px; flex: 0 0 auto; }
  .teach { grid-template-columns: 1fr; }
  .side { display: none; }
  table.users thead { display: none; }
  table.users tr { display: grid; padding: 8px 0; border-bottom: 1px solid var(--ink-line); }
  table.users td { border: 0; padding: 2px 10px; }
  #open-password { display: none; }
}
@media (min-width: 1200px) { .tabs button { font-size: 18px; } }

.gap-top { margin-top: 8px; }
.narrow-input { max-width: 260px; }
input[type=radio], input[type=checkbox] { accent-color: var(--kin); }
#settings-view label { display: inline-flex; gap: 6px; align-items: center; }

/* ---- Guestbook (the POS's .gb-* look) ---- */
.guests { flex: 1; display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 12px; padding: 12px; min-height: 0; }
.gb-list { display: flex; flex-direction: column; min-height: 0; }
.gb-names { list-style: none; margin: 0; padding: 0; border: 1px solid var(--ink-line); border-radius: 10px; overflow: auto; background: var(--ink); flex: 1; }
.gb-group { padding: 10px 12px; font-size: 15px; font-weight: 800; color: var(--gbfg); background: var(--gbbg);
  box-shadow: inset 4px 0 0 var(--gbc); display: flex; justify-content: space-between; }
.gb-group span:last-child { font-size: 12px; font-weight: 700; background: var(--gbc); color: var(--ink); border-radius: 999px; padding: 2px 8px; }
.gb-name { display: flex; gap: 8px; width: 100%; text-align: left; padding: 9px 12px 9px 14px; border: 0; border-bottom: 1px solid var(--ink-line);
  background: var(--ink); font-size: 13px; font-weight: 500; box-shadow: inset 4px 0 0 var(--gbc); }
.gb-name.on { background: var(--ink-high); font-weight: 800; }
.gb-name small { margin-left: auto; color: var(--rice-faint); font-size: 11px; }
.gb-detail { border: 1px solid var(--ink-line); border-radius: 10px; padding: 14px 16px; background: var(--ink); overflow: auto; }
.gb-detail h3 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.gb-facts { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.gb-fact { flex: 1 1 110px; border: 1px solid var(--ink-line); border-radius: 8px; background: var(--ink-raised); }
.gb-fact-k { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: var(--ink-high);
  padding: 5px 9px; border-bottom: 1px solid var(--ink-line); }
.gb-fact-v { font-size: 17px; font-weight: 800; padding: 5px 9px; text-align: right; }
.cat-vip { --gbc: var(--kin); --gbbg: var(--kin-lo); --gbfg: var(--kin-text); }
.cat-attention { --gbc: var(--urushi); --gbbg: var(--urushi-lo); --gbfg: var(--urushi-text); }
.cat-regular { --gbc: var(--matcha); --gbbg: var(--matcha-lo); --gbfg: var(--matcha-text); }
.cat-corporate { --gbc: var(--amber); --gbbg: var(--amber-lo); --gbfg: var(--amber-text); }
.cat-guest { --gbc: var(--info); --gbbg: var(--info-lo); --gbfg: var(--info-text); }
.pill.cat { color: var(--gbfg); background: var(--gbbg); box-shadow: inset 0 0 0 1px var(--gbc); }
.list-plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.list-plain li { border-bottom: 1px solid var(--ink-line); padding: 6px 0; font-size: 13px; }
@media (max-width: 720px) {
  .guests { grid-template-columns: 1fr; }
  .guests.detail-open .gb-list { display: none; }
  .guests:not(.detail-open) .gb-detail { display: none; }
}

/* ---- public booking page ---- */
.book { max-width: 720px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- public privacy and data-deletion pages ---- */
.doc { max-width: 760px; line-height: 1.55; }
.doc h1 { font-size: 1.4rem; margin: 8px 0 4px; }
.doc h2 { font-size: 1.05rem; margin: 22px 0 6px; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin: 4px 0; }

/* ---- Reservations ---- */
.wide-page { max-width: 1100px; }
.resv-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: start; border: 1px solid var(--ink-line);
  border-radius: 10px; padding: 10px 12px; background: var(--ink-raised); }
.resv-row.cancelled, .resv-row.no_show { opacity: .55; }
.resv-time { font-size: 17px; font-weight: 800; }
.resv-sub { font-size: 12px; color: var(--rice-dim); }
.resv-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill.planned { background: var(--ink-high); color: var(--rice); }
.pill.confirmed { background: var(--kin-lo); color: var(--kin-text); }
.pill.seated, .pill.completed { background: var(--matcha-lo); color: var(--matcha-text); }
.pill.no_show { background: var(--urushi-lo); color: var(--urushi-text); }
.pill.cancelled { background: var(--ink-raised); color: var(--rice-faint); text-decoration: line-through; }
.resv-slot-head { margin: 12px 0 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--rice-faint); font-weight: 700; }
@media (max-width: 720px) { .resv-row { grid-template-columns: 52px 1fr; } .resv-actions { grid-column: 1 / -1; justify-content: flex-start; } }
