/* Finest Cup — the shared look (docs/UI.md).
   Loaded by every app before its own <style>: tokens (light and dark), the top bar (shared/nav.js), and the
   controls every app uses. An app's own stylesheet comes after this one, so anything it defines wins. */

/* ---------- tokens ---------- */
:root{
  --bg:#f2f1ee; --surface:#fff; --sunk:#e9e7e3; --ink:#1c1a18; --ink2:#4f4842; --muted:#6a645e; --line:#dcd8d2;
  --accent:#8f1d3a; --accent-ink:#fff; --accent-soft:#f3e3e7;
  --good:#2f6b3f; --good-soft:#e2efe4; --warn:#9a5b00; --warn-soft:#f6ead6; --bad:#a3271c; --bad-soft:#f6e0dd; --info:#2b5f86; --info-soft:#e0ebf4;
  /* a colour per section, used only as a cue (the bar's stripe, the Ops page's tile edges) */
  --section-crm:#8f1d3a; --section-cafe:#0E5C46; --section:var(--section-crm);
  /* older names some apps still use */
  --ground:var(--bg); --raised:var(--sunk); --soft:var(--sunk); --crit:var(--bad); --crit-soft:var(--bad-soft); --bar:var(--section-cafe); --bar2:#cfc4b4;
  --f-body:system-ui,-apple-system,"Segoe UI",sans-serif; --f-display:var(--f-body); --f-head:var(--f-body); --f-mono:ui-monospace,Menlo,Consolas,monospace;
  --r:10px; --fc-bar-h:48px;
  color-scheme:light;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --bg:#141312; --surface:#1d1c1a; --sunk:#262422; --ink:#ece9e4; --ink2:#c5bdb5; --muted:#a39d96; --line:#34312e;
  --accent:#e2768f; --accent-ink:#1a0d11; --accent-soft:#3a1d25;
  --good:#7fc28f; --good-soft:#1f3125; --warn:#e3ad5c; --warn-soft:#3a2c17; --bad:#ec8a7f; --bad-soft:#3d221f; --info:#86b8de; --info-soft:#1c2c3a;
  --section-crm:#e2768f; --section-cafe:#63C6A1; --bar2:#5a4f44;
  color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#141312; --surface:#1d1c1a; --sunk:#262422; --ink:#ece9e4; --ink2:#c5bdb5; --muted:#a39d96; --line:#34312e;
  --accent:#e2768f; --accent-ink:#1a0d11; --accent-soft:#3a1d25;
  --good:#7fc28f; --good-soft:#1f3125; --warn:#e3ad5c; --warn-soft:#3a2c17; --bad:#ec8a7f; --bad-soft:#3d221f; --info:#86b8de; --info-soft:#1c2c3a;
  --section-crm:#e2768f; --section-cafe:#63C6A1; --bar2:#5a4f44;
  color-scheme:dark}

/* ---------- base ---------- */
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.5 var(--f-body)}
h1,h2,h3{margin:0;letter-spacing:-.01em;line-height:1.2;font-family:var(--f-display)}
h1{font-size:clamp(24px,3vw,32px)} h2{font-size:18px} h3{font-size:15px;margin-bottom:6px}
button,input,select,textarea{font:inherit;color:inherit}
a{color:inherit}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
[hidden]{display:none!important}
.wrap{max-width:1200px;margin:0 auto;padding:20px 16px 64px}
.wrap.wide{max-width:1400px}
.eyebrow{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:600}
.muted{color:var(--muted)} .small{font-size:13px} .sub{font-size:12.5px;color:var(--muted)}
.num{font-variant-numeric:tabular-nums}
header.top,.top{display:flex;flex-wrap:wrap;gap:12px 24px;align-items:flex-end;justify-content:space-between;margin-bottom:12px}
.tools{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important;scroll-behavior:auto!important}}

/* ---------- controls ---------- */
.btn{border:1px solid var(--line);background:var(--surface);color:inherit;border-radius:8px;padding:6px 12px;font-size:14px;font-weight:500;cursor:pointer;text-decoration:none;display:inline-block;white-space:nowrap;line-height:1.5}
.btn:hover{border-color:var(--muted)}
.btn.primary{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.btn.sm{padding:3px 9px;font-size:13px}
.btn.danger{color:var(--bad);border-color:var(--bad)}
.btn.ghost{border-color:transparent;background:transparent}
.btn:disabled{opacity:.5;cursor:default}
.sel,select.sel,.inp,input.inp{border:1px solid var(--line);border-radius:8px;padding:6px 10px;background:var(--surface);color:var(--ink);max-width:100%}
.tabs{display:flex;gap:4px;overflow-x:auto;border-bottom:1px solid var(--line);margin-bottom:16px;scrollbar-width:thin}
.tabs a,.tabs .tab,.tab{border:0;background:transparent;padding:8px 12px;text-decoration:none;color:var(--muted);font-weight:600;font-size:14px;border-bottom:2px solid transparent;margin-bottom:-1px;white-space:nowrap;cursor:pointer}
.tabs a[aria-current="page"],.tab[aria-selected="true"],.tabs [aria-pressed="true"]{color:var(--ink);border-bottom-color:var(--accent)}
.badge,.pill{display:inline-block;font-size:12px;font-weight:600;border-radius:999px;padding:2px 9px;background:var(--sunk);color:var(--muted);white-space:nowrap}
.badge.good,.pill.good{background:var(--good-soft);color:var(--good)} .badge.warn,.pill.warn{background:var(--warn-soft);color:var(--warn)}
.badge.bad,.pill.bad{background:var(--bad-soft);color:var(--bad)} .badge.info,.pill.info{background:var(--info-soft);color:var(--info)} .badge.acc,.pill.acc{background:var(--accent-soft);color:var(--accent)}
.card{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:16px;min-width:0}
.empty{background:var(--surface);border:1px dashed var(--line);border-radius:10px;padding:28px;text-align:center;color:var(--muted)}
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:20px;background:var(--ink);color:var(--bg);padding:8px 16px;border-radius:999px;font-size:14px;z-index:40;max-width:92vw;display:flex;gap:12px;align-items:center}
.scrim{position:fixed;inset:0;background:rgb(0 0 0 / .3);z-index:20}
.drawer{position:fixed;top:0;right:0;bottom:0;width:min(560px,100%);background:var(--surface);border-left:1px solid var(--line);z-index:21;overflow-y:auto;padding:20px 22px 40px}
.skeleton{background:linear-gradient(90deg,var(--sunk) 25%,var(--surface) 50%,var(--sunk) 75%);background-size:200% 100%;animation:fc-shimmer 1.2s linear infinite;border-radius:6px;min-height:1em}
@keyframes fc-shimmer{to{background-position:-200% 0}}
kbd.fc-kbd{font:12px var(--f-mono);border:1px solid var(--line);border-bottom-width:2px;border-radius:5px;padding:0 5px;background:var(--sunk);color:var(--muted)}

/* ---------- the bar (shared/nav.js) ---------- */
.fc-bar{position:sticky;top:0;z-index:50;background:var(--surface);border-bottom:1px solid var(--line);min-height:var(--fc-bar-h);display:flex;align-items:center;gap:6px;padding:0 12px;font-size:14px}
.fc-bar .fc-mark{font-weight:700;letter-spacing:-.01em;text-decoration:none;padding:6px 6px;border-radius:8px;white-space:nowrap}
.fc-bar .fc-mark:hover{background:var(--sunk)}
.fc-bar .fc-sep{color:var(--line);user-select:none}
.fc-bar .fc-app{position:relative;display:flex;align-items:center;gap:6px;border:0;background:transparent;padding:6px 8px;border-radius:8px;font-weight:600;cursor:pointer;max-width:50vw}
.fc-bar .fc-app:hover,.fc-bar .fc-app[aria-expanded="true"]{background:var(--sunk)}
.fc-bar .fc-app .fc-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fc-bar .fc-app::before{content:"";width:4px;height:18px;border-radius:2px;background:var(--section);flex:none}
.fc-bar .fc-app .fc-chev{color:var(--muted);font-size:11px}
.fc-bar .fc-cafe{margin-left:6px;border:1px solid var(--line);border-radius:8px;padding:5px 8px;background:var(--surface);color:inherit;font-weight:500;max-width:220px}
.fc-bar .fc-links{display:flex;gap:2px;margin-left:8px}
.fc-bar .fc-links a{padding:6px 8px;border-radius:8px;text-decoration:none;color:var(--muted);font-weight:500}
.fc-bar .fc-links a:hover{background:var(--sunk);color:var(--ink)}
.fc-bar .fc-links a[aria-current="page"]{color:var(--ink);font-weight:600}
.fc-bar .fc-grow{flex:1}
.fc-bar .fc-user{display:flex;align-items:center;gap:8px;border:0;background:transparent;padding:4px 6px 4px 4px;border-radius:999px;cursor:pointer;max-width:260px}
.fc-bar .fc-user:hover,.fc-bar .fc-user[aria-expanded="true"]{background:var(--sunk)}
.fc-bar .fc-avatar{width:28px;height:28px;border-radius:50%;background:var(--accent);color:var(--accent-ink);display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;flex:none}
.fc-bar .fc-user .fc-who{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}
.fc-bar .fc-burger{display:none;border:1px solid var(--line);background:var(--surface);border-radius:8px;width:40px;height:36px;font-size:20px;line-height:1;cursor:pointer}
/* menus */
.fc-menu{position:absolute;top:calc(var(--fc-bar-h) - 4px);z-index:60;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 32px rgb(0 0 0 / .18);padding:8px;min-width:280px;max-height:calc(100vh - var(--fc-bar-h) - 12px);overflow:auto}
.fc-menu[hidden]{display:none}
.fc-menu.fc-apps{left:12px;width:min(760px,calc(100vw - 24px))}
.fc-menu.fc-me{right:12px;min-width:260px}
.fc-menu .fc-search{width:100%;border:1px solid var(--line);border-radius:8px;padding:8px 10px;background:var(--bg);margin-bottom:8px;font-size:15px}
.fc-menu .fc-cols{display:grid;grid-template-columns:1fr 1.2fr;gap:4px 18px}
@media (max-width:700px){.fc-menu .fc-cols{grid-template-columns:1fr}}
.fc-menu .fc-h{font-size:11.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:600;margin:8px 8px 4px;display:flex;align-items:center;gap:6px}
.fc-menu .fc-h i{width:8px;height:8px;border-radius:2px;background:var(--section-crm);display:inline-block}
.fc-menu .fc-h i.cafe{background:var(--section-cafe)}
.fc-menu a.fc-item,.fc-menu button.fc-item{display:flex;align-items:center;gap:8px;width:100%;text-align:left;border:0;background:transparent;border-radius:8px;padding:7px 8px;text-decoration:none;color:inherit;cursor:pointer;font-size:14px}
.fc-menu .fc-item:hover,.fc-menu .fc-item:focus-visible,.fc-menu .fc-item.fc-active{background:var(--sunk);outline:none}
.fc-menu .fc-item[aria-current="page"]{font-weight:700}
.fc-menu .fc-item .fc-b{margin-left:auto;font-size:11px;color:var(--muted);font-weight:500}
.fc-menu .fc-cafe-row{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 8px;padding:5px 8px;border-radius:8px}
.fc-menu .fc-cafe-row b{font-weight:600;min-width:132px}
.fc-menu .fc-cafe-row a{color:var(--muted);text-decoration:none;font-size:13px;padding:2px 4px;border-radius:5px}
.fc-menu .fc-cafe-row a:hover,.fc-menu .fc-cafe-row a:focus-visible{background:var(--sunk);color:var(--ink);outline:none}
.fc-menu .fc-cafe-row a[aria-current="page"]{color:var(--ink);font-weight:700}
.fc-menu .fc-none{padding:10px 8px;color:var(--muted)}
.fc-menu .fc-foot{display:flex;justify-content:space-between;gap:8px;margin:8px 8px 2px;font-size:12px;color:var(--muted)}
.fc-menu .fc-id{padding:6px 8px 10px;border-bottom:1px solid var(--line);margin-bottom:6px}
.fc-menu .fc-id b{display:block} .fc-menu .fc-id span{font-size:13px;color:var(--muted);overflow-wrap:anywhere}
.fc-menu .fc-theme{display:flex;border:1px solid var(--line);border-radius:999px;overflow:hidden;margin:6px 8px}
.fc-menu .fc-theme button{flex:1;border:0;background:transparent;padding:6px 8px;cursor:pointer;font-size:13px}
.fc-menu .fc-theme button[aria-pressed="true"]{background:var(--ink);color:var(--bg)}
.fc-menu .fc-mobile-only{display:none}
@media (max-width:720px){
  .fc-bar{padding:0 8px;gap:4px}
  .fc-bar .fc-cafe,.fc-bar .fc-links,.fc-bar .fc-user .fc-who{display:none}
  .fc-bar .fc-app{max-width:calc(100vw - 150px)}
  .fc-menu .fc-mobile-only{display:block}
  .fc-menu.fc-me{left:8px;right:8px}
  .fc-menu.fc-apps{left:8px;width:calc(100vw - 16px)}
  .fc-menu .fc-item,.btn,.tab,.tabs a,.sel,select.sel{min-height:44px}
  .fc-menu .fc-cafe-row a{min-height:36px;display:inline-flex;align-items:center}
  .drawer{width:100%;border-left:0}
  #fc-env{top:auto!important;bottom:0;border-radius:8px 8px 0 0;padding:3px 14px 1px!important}   /* the DEV/TEST ribbon (shared/fc.js, inline-styled) moves off the bar on phones */
}
@media print{.fc-bar,.fc-menu,#fc-env{display:none!important}}
