/* Content Desk — shared tokens, layout and components (colour A, Emerald).
   View-specific styles live in calendar.css, day.css, item.css, dialogs.css. */
:root {
  --bg: #F3F6F2; --surface: #FFFFFF; --side: #FAFCF9; --off: #F7F9F6;
  --ink: #14201A; --muted: #55625A; --line: #DFE6DF; --line-strong: #B9C6BD;
  --accent: #0B7A55; --accent-ink: #0A5A3F; --accent-hover: #096646; --on-accent: #FFFFFF; --soft: #DFF2E9;
  --wait-bg: #FFEFCC; --wait-fg: #7A4A00; --wait-bar: #E8A317;
  --change-bg: #ECE6FF; --change-fg: #5330A8; --change-bar: #7C5CE0; --change-line: #CFC4F5;
  --prog-bg: #DCEBFF; --prog-fg: #12509E; --prog-bar: #2F7BDB;
  --done-bg: #D8F1E0; --done-fg: #12633A; --done-bar: #0B7A55;
  --rej-bg: #FDE2DF; --rej-fg: #9E2A20; --rej-bar: #D4483B; --rej-line: #F2C4BF;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", Inter, system-ui, sans-serif;
  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --shadow: 0 24px 60px rgba(20, 32, 26, 0.22);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(11, 122, 85, 0.35); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.display { font-family: var(--display); letter-spacing: -0.02em; font-weight: 600; }
.h1 { font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.h2 { font-size: 16px; font-weight: 600; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 0; min-width: 0; }
.icon { flex: none; display: inline-block; vertical-align: middle; }

/* ---------- buttons ---------- */
.btn { height: 44px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--off); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-dark:hover { background: #24332B; }
.btn-accent-outline { border: 1.5px solid var(--accent); color: var(--accent-ink); }
.btn-change { color: var(--change-fg); border-color: var(--change-line); }
.btn-danger { color: var(--rej-fg); border-color: var(--rej-line); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--soft); }
.btn-icon { width: 44px; padding: 0; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 46px; border-radius: 12px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- small pieces ---------- */
.pill { height: 26px; padding: 0 10px; border-radius: 13px; display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tone-wait { background: var(--wait-bg); color: var(--wait-fg); }
.tone-change { background: var(--change-bg); color: var(--change-fg); }
.tone-prog { background: var(--prog-bg); color: var(--prog-fg); }
.tone-done { background: var(--done-bg); color: var(--done-fg); }
.tone-rej { background: var(--rej-bg); color: var(--rej-fg); }
.tag { padding: 2px 8px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-0 { background: #E0F5F4; color: #0B5F5C; } .tag-1 { background: #FDEBD7; color: #8A4A07; }
.tag-2 { background: #EFE9FF; color: #5330A8; } .tag-3 { background: #DCEBFF; color: #12509E; }
.tag-4 { background: #FCE4EC; color: #8C1D47; } .tag-5 { background: #E7F0D2; color: #44591A; }
.dot-0 { background: #0EA5A0; } .dot-1 { background: #F08A24; } .dot-2 { background: #8B5CF6; }
.dot-3 { background: #2F7BDB; } .dot-4 { background: #D6457A; } .dot-5 { background: #7A9A2E; }
.avatar { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; }
.avatar-lg { width: 34px; height: 34px; font-size: 13px; }
.av-0 { background: var(--prog-bg); color: var(--prog-fg); } .av-1 { background: var(--change-bg); color: var(--change-fg); }
.av-2 { background: var(--wait-bg); color: var(--wait-fg); } .av-3 { background: #E0F5F4; color: #0B5F5C; }
.av-4 { background: #FCE4EC; color: #8C1D47; } .av-5 { background: #E7F0D2; color: #44591A; }
.av-boss { background: var(--soft); color: var(--accent-ink); }
.serial { flex: none; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 16px; font-weight: 600; background: var(--bg); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.note { padding: 8px 12px; border-radius: var(--r); font-size: 13px; }
.note-change { background: #F5F2FF; color: #3F2488; }
.note-rej { background: #FEF1EF; color: #7F2018; }
.note-plain { background: var(--bg); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* stepper: Script / Content / Pick / Upload */
.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; font-size: 11px; font-weight: 600; text-align: center; }
.stepper span { padding-top: 6px; border-top: 4px solid var(--line); color: var(--muted); }
.stepper .s-done { border-color: var(--done-bar); color: var(--accent-ink); }
.stepper .s-now-wait { border-color: var(--wait-bar); color: var(--wait-fg); }
.stepper .s-now-change { border-color: var(--change-bar); color: var(--change-fg); }
.stepper .s-now-prog { border-color: var(--prog-bar); color: var(--prog-fg); }
.stepper .s-now-rej { border-color: var(--rej-bar); color: var(--rej-fg); }
.stepper-long { font-size: 12px; text-align: left; gap: 6px; }
.stepper-long span { padding-top: 8px; border-top-width: 5px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-weight: 600; }
.input, .textarea { width: 100%; padding: 0 12px; height: 46px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); }
.textarea { height: auto; padding: 12px; font-size: 15px; line-height: 1.55; resize: vertical; }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11, 122, 85, 0.18); }
.field-error { font-size: 13px; color: var(--rej-fg); font-weight: 500; }
.choice { height: 44px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 500; cursor: pointer; }
.choice[aria-pressed="true"] { background: var(--soft); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; }
.side { flex: none; width: 264px; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 22px; background: var(--side); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); }
.brand-name { font-family: var(--display); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.side-wait { justify-content: space-between; height: 46px; border-radius: 12px; font-weight: 500; }
.side-wait[aria-current="page"] { border-color: var(--wait-bar); }
.count { min-width: 26px; height: 24px; padding: 0 7px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-title { padding: 0 12px 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.nav-item { height: 44px; padding: 0 12px; border: 0; border-radius: var(--r); background: transparent; text-align: left; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-item span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--off); }
.nav-item[aria-pressed="true"] { background: var(--soft); color: var(--accent-ink); font-weight: 600; }
.nav-dot { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.me { margin-top: auto; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.me-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.me-links button { border: 0; background: none; padding: 6px 0; cursor: pointer; font-weight: 600; color: var(--accent-ink); }
.main { flex: 1 1 0; min-width: 0; padding: 20px 28px 40px; display: flex; flex-direction: column; gap: 16px; }
.topbar, .bottomnav, .side-close, .scrim { display: none; }

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; position: sticky; top: 0; z-index: 20; background: var(--side); border-bottom: 1px solid var(--line); }
  .side { position: fixed; z-index: 40; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-100%); transition: transform 0.2s ease; }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .side-close { display: inline-flex; align-self: flex-end; margin: -12px -4px -14px 0; }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(20, 32, 26, 0.4); }
  .main { padding: 14px 16px 96px; }
  .bottomnav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .bottomnav a, .bottomnav button { height: 52px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav [aria-current="page"] { background: var(--soft); color: var(--accent-ink); }
  .h1 { font-size: 22px; }
}

/* ---------- modal + toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(20, 32, 26, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; overflow-y: auto; }
.modal { width: 100%; max-width: 480px; padding: 24px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.modal-wide { max-width: 680px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.toasts { position: fixed; z-index: 80; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 500; box-shadow: var(--shadow); }
.toast-error { background: #7F2018; }
@media (max-width: 860px) { .toasts { bottom: 92px; } .modal { padding: 20px; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; padding: 32px 28px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- sidebar: add / rename / remove ---------- */
.nav-row { display: flex; align-items: center; border-radius: var(--r); }
.nav-row .nav-item { flex: 1 1 0; }
.nav-row:hover { background: var(--off); }
.nav-row:hover .nav-item:not([aria-pressed="true"]) { background: transparent; }
.nav-tools { display: flex; opacity: 0; }
.nav-row:hover .nav-tools, .nav-row:focus-within .nav-tools { opacity: 1; }
@media (hover: none) { .nav-tools { opacity: 1; } }
.nav-tool { width: 32px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.nav-tool:hover { color: var(--accent-ink); background: var(--soft); }
.nav-tool-danger:hover { color: var(--rej-fg); background: var(--rej-bg); }
.nav-add { height: 44px; margin-top: 4px; padding: 0 12px; border: 1.5px dashed #9CCDB8; border-radius: var(--r); background: transparent; color: var(--accent-ink); font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.nav-add:hover { background: var(--soft); }
.nav-empty { padding: 2px 12px 4px; font-size: 13px; color: var(--muted); }
.nav-you { color: var(--muted); font-weight: 400; }

/* ---------- login: demo logins ---------- */
.login-demo:empty { display: none; }
.login-demo { padding-top: 18px; border-top: 1px solid var(--line); }
.login-demo-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.login-demo-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.login-demo-row:first-child { border-top: 0; }
.login-demo-cred { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.login-demo-row .btn { height: 44px; }
