  :root{
    --bg:#eef0f0;
    --surface:#ffffff;
    --surface-2:#e3e6e6;
    --ink:#1a1d1c;
    --ink-dim:#5c635f;
    --border:#d2d6d3;
    --accent:#1f4fa3;
    --accent-strong:#0f2c5e;
    --accent-tint:#dde6f6;
    --busy:#bd3324;
    --busy-tint:#f8ded9;
    --busy-ink:#6f1d13;
    --mine:#c47f00;
    --mine-tint:#f8e6c2;
    --mine-ink:#6b4400;
    --past:#c7cbc8;
    --done:#2f7d4f;
    --done-tint:#d8efe0;
    --done-ink:#1c5233;
    --shadow: 0 1px 2px rgba(20,25,22,.07), 0 8px 24px -12px rgba(20,25,22,.2);
    color-scheme: light;
  }

  *{box-sizing:border-box;}
  html,body{ margin:0; }
  body{
    background:var(--bg);
    color:var(--ink);
    font-family:'Public Sans', system-ui, sans-serif;
    padding:28px 20px 60px;
    display:flex;
    justify-content:center;
  }
  img{ max-width:100%; }
  .page{ width:100%; max-width:920px; display:flex; flex-direction:column; gap:22px; }

  h1,h2,h3{ font-family:'Big Shoulders Display', system-ui, sans-serif; text-wrap:balance; margin:0; }
  .mono{ font-family:'JetBrains Mono', ui-monospace, monospace; font-variant-numeric:tabular-nums; }

  /* ---------- ticker ---------- */
  .ticker{
    display:flex; align-items:center; gap:12px;
    background:var(--accent-strong); border-radius:4px;
  }
  .ticker[hidden]{ display:none; }
  .ticker-badge{
    flex:none; margin-left:12px; background:var(--busy); color:#fff;
    font-family:'Big Shoulders Display'; font-weight:800; font-size:11.5px;
    letter-spacing:.08em; text-transform:uppercase; padding:3px 9px; border-radius:3px;
  }
  .ticker-viewport{ flex:1; min-width:0; overflow:hidden; }
  .ticker-track{
    display:flex; white-space:nowrap; padding:9px 0; width:max-content;
    animation-name: ticker-scroll; animation-timing-function:linear; animation-iteration-count:infinite;
  }
  .ticker:hover .ticker-track{ animation-play-state:paused; }
  .ticker-content{ display:inline-block; color:#fff; font-size:13px; }
  .ticker-content .item{ display:inline-block; padding-right:34px; position:relative; }
  .ticker-content .item::after{ content:"•"; position:absolute; right:13px; opacity:.5; }
  @keyframes ticker-scroll{ from{ transform:translateX(0); } to{ transform:translateX(-50%); } }

  /* ---------- header ---------- */
  header{ display:flex; flex-wrap:wrap; align-items:flex-end; justify-content:space-between; gap:16px 24px;
    border-bottom:3px solid var(--accent); padding-bottom:16px; }
  header h1{
    font-size:clamp(40px,8vw,60px); font-weight:900; line-height:.85;
    text-transform:uppercase; letter-spacing:.01em; color:var(--accent-strong);
  }
  .stat{ text-align:right; }
  .stat-num{
    font-family:'Big Shoulders Display'; font-weight:800; font-size:40px; line-height:.82;
    color:var(--accent-strong); font-variant-numeric:tabular-nums;
  }
  .stat-label{ font-size:12px; color:var(--ink-dim); margin-top:2px; }
  .stat-label b{ color:var(--ink); font-weight:600; }

  /* ---------- now strip + quiet hint ---------- */
  .now-strip{ display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; }
  .now-chip{
    flex:0 0 auto; display:flex; align-items:stretch; white-space:nowrap;
    background:var(--surface); border:1.5px solid var(--accent-strong); border-radius:2px;
    overflow:hidden;
  }
  .nc-name{
    font-family:'Big Shoulders Display', system-ui, sans-serif;
    font-weight:800; font-size:16px; text-transform:uppercase; letter-spacing:.02em;
    color:var(--accent-strong); padding:5px 10px; display:flex; align-items:center;
  }
  .nc-detail{
    font-size:12px; color:var(--ink-dim); padding:5px 10px;
    border-left:1px solid var(--border); display:flex; align-items:center;
  }
  .nc-state{
    font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.09em;
    color:#fff; padding:5px 10px; display:flex; align-items:center;
    background:var(--accent-strong);
  }
  .nc-state.is-free{ background:var(--done); }
  .nc-state.is-busy{ background:var(--busy); }
  .now-chip.plain{ border-color:var(--border); }
  .now-chip.plain .nc-name{ font-family:'Public Sans', system-ui, sans-serif; font-weight:500;
    font-size:12.5px; text-transform:none; letter-spacing:0; color:var(--ink-dim); }

  /* ---------- profile bar ---------- */
  .profile{
    display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end;
    background:var(--surface); border:1px solid var(--border);
    border-top:3px solid var(--accent-strong); border-radius:2px;
    padding:14px; box-shadow:var(--shadow);
  }
  .profile label{
    font-family:'Big Shoulders Display', system-ui, sans-serif;
    font-size:15px; font-weight:800; text-transform:uppercase; letter-spacing:.04em;
    color:var(--accent-strong); display:block; margin-bottom:3px;
  }
  .field{ display:flex; flex-direction:column; flex:1 1 180px; min-width:150px; }
  .field input{
    font:inherit; font-size:15px; padding:9px 10px; border-radius:2px;
    border:1.5px solid var(--border); background:var(--bg); color:var(--ink);
  }
  .field input:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }
  .field.needs-attention input{ outline:2px solid var(--busy); outline-offset:1px; }
  .profile-note{
    font-size:12px; line-height:1.5; color:var(--ink-dim); flex:1 1 100%;
    border-top:1px solid var(--border); padding-top:10px; margin-top:2px;
  }
  .profile-note.penalty{
    color:var(--mine-ink); font-style:italic; border-top:none; padding-top:0; margin-top:-4px;
  }

  /* ---------- day tabs ---------- */
  .day-tabs{ display:flex; gap:6px; overflow-x:auto; padding-bottom:2px; }
  .day-tab{
    font-family:'Public Sans'; flex:0 0 auto; cursor:pointer; text-align:center;
    border:1px solid var(--border); background:var(--surface); border-radius:4px;
    padding:8px 14px; min-width:64px; color:var(--ink-dim);
  }
  .day-tab .wd{ font-size:11px; text-transform:uppercase; letter-spacing:.07em; font-weight:600; }
  .day-tab .dm{ font-family:'JetBrains Mono'; font-size:16px; font-weight:500; color:var(--ink); margin-top:2px; }
  .day-tab.active{ background:var(--accent); border-color:var(--accent); }
  .day-tab.active, .day-tab.active .dm{ color:#fff; }
  .day-tab:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

  /* ---------- grid ---------- */
  .board{
    background:var(--surface); border:1px solid var(--border); border-radius:6px;
    box-shadow:var(--shadow); overflow:hidden;
  }
  .grid-wrap{ overflow-x:auto; }
  .grid{
    display:grid;
    grid-template-columns: 78px repeat(4, minmax(126px,1fr));
    min-width:640px;
  }
  .machine-head{
    position:sticky; top:0; z-index:2; background:var(--surface-2);
    border-bottom:1px solid var(--border); border-left:1px solid var(--border);
    padding:12px 10px; display:flex; align-items:center; gap:8px;
  }
  .machine-head:first-child{ border-left:none; }
  .machine-head svg{ width:16px; height:16px; color:var(--accent); flex:none; }
  .machine-head .lbl{
    font-family:'Big Shoulders Display'; font-weight:800; font-size:16px;
    text-transform:uppercase; letter-spacing:.02em;
  }
  .corner{ position:sticky; top:0; left:0; z-index:3; background:var(--surface-2); border-bottom:1px solid var(--border); }
  .time-cell{
    position:sticky; left:0; z-index:1; background:var(--surface);
    border-bottom:1px solid var(--border); border-right:1px solid var(--border);
    display:flex; align-items:center; justify-content:flex-end;
    padding:0 10px; font-size:12.5px; color:var(--ink-dim);
  }
  .time-cell.row-now{ color:var(--accent-strong); font-weight:600; }
  .slot{
    border-bottom:1px solid var(--border); border-left:1px solid var(--border);
    padding:6px; display:flex;
  }
  .slot-btn{
    width:100%; min-height:44px; border-radius:4px; border:1.5px dashed var(--border);
    background:transparent; color:var(--ink-dim); font:inherit; font-size:12.5px;
    cursor:pointer; display:flex; align-items:center; justify-content:center; text-align:center;
    padding:4px 6px; line-height:1.25;
  }
  .slot-btn:hover{ border-color:var(--accent); color:var(--accent-strong); border-style:solid; background:var(--accent-tint); }
  .slot-btn:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
  .slot-fill{
    width:100%; min-height:44px; border-radius:4px; border:1.5px solid transparent;
    font-size:12.5px; line-height:1.25; padding:5px 8px;
    display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:1px;
  }
  .slot-fill.busy{ background:var(--busy-tint); color:var(--busy-ink); }
  .slot-fill.mine{ background:var(--mine-tint); color:var(--mine-ink); border-color:var(--mine); position:relative; }
  .slot-fill.done{ background:var(--done-tint); color:var(--done-ink); border-color:var(--done); cursor:pointer; position:relative; }
  .slot-fill.mine.clickable{ cursor:pointer; }
  .slot-fill .name{ font-weight:600; }
  .slot-fill .room{ font-size:11px; opacity:.85; }
  .slot-fill .tag-state{ font-size:10.5px; font-style:italic; opacity:.9; }
  .cancel-btn{
    position:absolute; top:4px; right:4px; width:18px; height:18px; border-radius:50%;
    border:none; background:transparent; color:inherit; opacity:.65; cursor:pointer;
    font-size:13px; line-height:1; display:flex; align-items:center; justify-content:center;
  }
  .cancel-btn:hover{ opacity:1; background:rgba(0,0,0,.08); }
  .slot-fill.menu-open{ justify-content:center; gap:4px; padding:5px; }
  .menu-btn{
    width:100%; font:inherit; font-size:11px; font-weight:500; border-radius:3px;
    border:1px solid currentColor; background:transparent; color:inherit;
    padding:4px 5px; cursor:pointer; line-height:1.2;
  }
  .menu-btn:hover{ background:rgba(0,0,0,.08); }
  .menu-btn:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }
  .slot-past{
    width:100%; min-height:44px; border-radius:4px; background:var(--past);
    opacity:.35;
  }
  .slot-locked{
    width:100%; min-height:44px; border-radius:4px; border:1.5px dotted var(--border);
    display:flex; align-items:center; justify-content:center; text-align:center;
    font-size:11px; color:var(--ink-dim); padding:4px 6px; line-height:1.2;
  }
  .slot.row-now{ background:var(--accent-tint); }

  /* ---------- legend ---------- */
  .legend{ display:flex; flex-wrap:wrap; gap:14px; padding:12px 14px; border-top:1px solid var(--border); font-size:12px; color:var(--ink-dim); }
  .legend .item{ display:flex; align-items:center; gap:6px; }
  .swatch{ width:12px; height:12px; border-radius:3px; }
  .swatch.free{ border:1.5px dashed var(--border); }
  .swatch.busy{ background:var(--busy-tint); border:1px solid var(--busy); }
  .swatch.mine{ background:var(--mine-tint); border:1px solid var(--mine); }
  .swatch.done{ background:var(--done-tint); border:1px solid var(--done); }
  .swatch.locked{ border:1.5px dotted var(--border); }
  .swatch.past{ background:var(--past); }

  footer{ text-align:center; font-size:12px; color:var(--ink-dim); display:flex; flex-direction:column; gap:4px; }
  .footer-joke{ font-style:italic; opacity:.85; }

  /* ---------- chat: Ask Sudsy ---------- */
  .chat-launcher{
    position:fixed; right:20px; bottom:20px; z-index:20;
    display:flex; align-items:center; gap:8px;
    background:var(--accent-strong); color:#fff; border:none; border-radius:999px;
    padding:12px 18px; font:inherit; font-weight:600; font-size:14px;
    cursor:pointer; box-shadow:var(--shadow);
  }
  .chat-launcher:hover{ background:var(--accent); }
  .chat-launcher svg{ width:18px; height:18px; flex:none; }
  .chat-launcher:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

  .chat-panel{
    position:fixed; right:20px; bottom:20px; z-index:21;
    width:min(360px, calc(100vw - 40px)); height:min(480px, calc(100vh - 40px));
    background:var(--surface); border:1px solid var(--border); border-radius:8px;
    box-shadow:var(--shadow); display:flex; flex-direction:column; overflow:hidden;
  }
  .chat-panel[hidden]{ display:none; }
  .chat-head{
    display:flex; align-items:flex-start; justify-content:space-between; gap:8px;
    padding:12px 14px; border-bottom:1px solid var(--border); background:var(--surface-2);
  }
  .chat-title{ font-family:'Big Shoulders Display'; font-weight:800; font-size:20px; text-transform:uppercase; color:var(--accent-strong); }
  .chat-sub{ font-size:11.5px; color:var(--ink-dim); margin-top:1px; }
  .chat-close{
    background:transparent; border:none; color:var(--ink-dim); font-size:20px;
    line-height:1; cursor:pointer; padding:2px 4px;
  }
  .chat-close:hover{ color:var(--ink); }
  .chat-log{ flex:1; overflow-y:auto; padding:12px 14px; display:flex; flex-direction:column; gap:10px; }
  .chat-msg{ font-size:13.5px; line-height:1.4; max-width:88%; padding:8px 11px; border-radius:8px; }
  .chat-msg.bot{ align-self:flex-start; background:var(--accent-tint); color:var(--ink); border-bottom-left-radius:2px; }
  .chat-msg.user{ align-self:flex-end; background:var(--accent); color:#fff; border-bottom-right-radius:2px; }
  .chat-msg.typing{ font-style:italic; color:var(--ink-dim); background:transparent; padding:0; }
  .chat-disclaimer{
    font-size:10.5px; line-height:1.35; color:var(--ink-dim);
    padding:0 14px 8px; border-top:1px solid var(--border); padding-top:8px;
  }
  .chat-form{ display:flex; gap:8px; padding:0 10px 10px; }
  .chat-form input{
    flex:1; font:inherit; font-size:13.5px; padding:9px 10px; border-radius:4px;
    border:1px solid var(--border); background:var(--bg); color:var(--ink);
  }
  .chat-form input:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }
  .chat-send{
    font:inherit; font-weight:600; font-size:13px; border:none; border-radius:4px;
    background:var(--accent); color:#fff; padding:0 16px; cursor:pointer;
  }
  .chat-send:hover{ background:var(--accent-strong); }
  .chat-send:disabled{ opacity:.6; cursor:default; }

  #toast{
    position:fixed; left:50%; bottom:24px; transform:translate(-50%,12px);
    background:var(--ink); color:var(--bg); padding:10px 16px; border-radius:4px;
    font-size:13.5px; box-shadow:var(--shadow); opacity:0; pointer-events:none;
    transition:opacity .2s ease, transform .2s ease; max-width:80vw; text-align:center;
    z-index:10;
  }
  #toast.show{ opacity:1; transform:translate(-50%,0); }

  /* ---------- phones ---------- */
  @media (max-width: 560px){
    body{ padding:16px 12px 88px; }   /* clear the floating chat button */
    .page{ gap:16px; }

    header{ align-items:flex-start; gap:8px; padding-bottom:12px; }
    header h1{ font-size:clamp(34px,10vw,44px); }
    .stat{ text-align:left; display:flex; align-items:baseline; gap:8px; }
    .stat-num{ font-size:30px; }

    /* 16px stops iOS zooming the whole page in when a field is focused */
    .field input{ font-size:16px; }
    .profile{ padding:12px; }

    .grid{ grid-template-columns:58px repeat(4, minmax(92px,1fr)); min-width:460px; }
    .machine-head{ padding:10px 6px; gap:0; justify-content:center; }
    .machine-head svg{ display:none; }
    .machine-head .lbl{ font-size:14px; white-space:nowrap; }
    .time-cell{ font-size:11.5px; padding:0 8px; }
    .slot{ padding:5px 4px; }
    .slot-fill, .slot-btn, .slot-past, .slot-locked{ min-height:48px; }
    .slot-fill{ font-size:12px; padding:4px 6px; }
    .legend{ gap:10px 14px; font-size:11.5px; }

    /* full-screen chat: immune to mobile viewport + keyboard quirks */
    .chat-panel{
      inset:0; width:100%; height:100dvh; max-height:none;
      border:none; border-radius:0;
    }
    .chat-head{ padding:14px; }
    .chat-log{ padding:14px; gap:12px; }
    .chat-msg{ font-size:15px; max-width:92%; }
    .chat-form{ padding:0 12px 12px; }
    .chat-form input{ font-size:16px; padding:12px; }
    .chat-send{ padding:0 18px; }
    .chat-launcher{ right:14px; bottom:14px; padding:12px 16px; }
  }

  /* the launcher would otherwise sit on top of the open panel */
  .chat-launcher[aria-expanded="true"]{ display:none; }

  @media (prefers-reduced-motion: reduce){
    *{ transition:none !important; }
    .ticker-track{ animation:none !important; overflow-x:auto; }
    #tickerContentDup{ display:none; }
  }
