/* =====================================================================
   The Office — "Soft Glass" theme (v3). Load LAST: tokens, legacy,
   components, layout, then this.
   The room stays pixel art; everything around it becomes modern UI:
   dark glass panels, soft shadows, rounder corners, line icons (icons.js).
   How it works: the base tokens flip to dark (panels dark, --ink light).
   Things that keep a bright fill (primary buttons, gold "on" states,
   sticky notes, your chat bubble, speech bubbles over heads) are "light
   islands": they set --ink and friends back to dark text locally, so every
   rule inside them that reads var(--ink) stays readable.
   ===================================================================== */

:root {
  /* chrome */
  --bg: #161a23;
  --bg-raised: rgba(38, 43, 56, 0.94);
  --bg-sunk: rgba(255, 255, 255, 0.05);
  --chrome-text: #f4eee6;      /* 15.6:1 on --bg */
  --chrome-muted: #c9c2ba;     /* 10.6:1 on --bg */
  --chrome-fill: rgba(255, 255, 255, 0.06);
  --chrome-fill-hover: rgba(255, 255, 255, 0.11);
  --chrome-fill-press: rgba(255, 255, 255, 0.16);
  --chrome-line: rgba(255, 255, 255, 0.16);
  --chrome-line-soft: rgba(255, 255, 255, 0.08);

  /* panels (were paper) */
  --surface: #20242f;
  --surface-2: #2a2f3c;
  --surface-3: #363c4b;
  --surface-input: #161a23;
  --ink: #f4eee6;              /* 13.9:1 on --surface */
  --ink-muted: #aaa39b;        /*  6.6:1 on --surface, 5.7:1 on --surface-2 */
  --ink-placeholder: #8e877f;  /*  4.7:1 on --surface-input */
  --ink-on-dark: #f4eee6;
  --on-fill: #1d1a22;          /* text on every bright fill */

  /* brand & action */
  --primary: #ff9f7a;          /* --on-fill on it 8.6:1 */
  --primary-hover: #ffb294;
  --primary-press: #f58a62;
  --accent-ink: #ffb59a;       /* icons and small accent text on panels, 8.9:1 */
  --selected: #f3cf7a;         /* gold "on" fill, always with dark text */
  --selected-edge: rgba(29, 26, 34, 0.22);
  --gold-ink: #f2c94c;
  --rose-ink: #d6406a;         /* unread badges, white text 4.6:1 */
  --sage: #7fd0a0;
  --sky: #9ab8ff;

  /* feedback: light text colours, dark tinted wells */
  --success: #6fd39a;
  --success-soft: rgba(111, 211, 154, 0.14);
  --warning: #f2c94c;
  --warning-soft: rgba(242, 201, 76, 0.14);
  --danger: #ef5a5f;           /* as text on --surface 4.9:1; fills carry --on-fill */
  --danger-soft: rgba(239, 90, 95, 0.15);
  --live: #ef5a5f;

  /* characters */
  --yazan: #9ab8ff;
  --yazan-soft: rgba(154, 184, 255, 0.14);
  --habib: #7ad7c2;
  --habib-soft: rgba(122, 215, 194, 0.14);

  /* presence */
  --here: #3ecf8e;
  --idle: #f2c94c;
  --away: #8e877f;

  /* focus */
  --focus: #9ab8ff;
  --focus-on-dark: #f3cf7a;

  /* shape: rounder, thinner edges */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --bw: 1px;
  --edge: 1px solid rgba(255, 255, 255, 0.12);
  --edge-soft: 1px solid rgba(255, 255, 255, 0.07);
  --field-edge: rgba(255, 255, 255, 0.24);

  /* elevation: soft, no more hard pixel drops */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --sh-2: 0 10px 28px rgba(0, 0, 0, 0.3);
  --sh-3: 0 14px 36px rgba(0, 0, 0, 0.42);
  --sh-4: 0 28px 70px rgba(0, 0, 0, 0.55);
  --scrim: rgba(8, 10, 14, 0.6);
  --glass: rgba(38, 43, 56, 0.9);
  --blur: saturate(140%) blur(16px);

  --topbar-h: 64px;
  --icon-sm: 12px;
}

body { background: var(--bg); background-image: none; }

/* ------------------------------------------------------------ light islands: bright fills keep dark text */
.btn.primary, .btn.on, .btn[aria-pressed="true"], .btn.danger, .btn.send, .btn.mic[aria-pressed="true"],
.icon-btn.on, .icon-btn[aria-pressed="true"], .icon-btn.danger, .icon-btn.accent,
.tool.on, .tool[aria-pressed="true"], .tool[aria-expanded="true"], .dock .tool.on-air,
.tab-item[aria-current] .tab-ic, .tab-item.on .tab-ic, .tab-item[aria-expanded="true"] .tab-ic,
.room-tab[aria-current], .room-tab.on,
.seg > [aria-checked="true"], .seg > [aria-pressed="true"], .seg > [aria-selected="true"], .seg > .on,
.chip[aria-pressed="true"], .chip[aria-checked="true"], .chip.on, .klanes .chip[aria-selected="true"],
.list-row[aria-checked="true"], .gesture-grid .g[aria-pressed="true"], .tray-items button[aria-pressed="true"],
.datepick-day.chosen, .datepick.open .datepick-btn, .cam-split.on .cam-pick, .faces-ctl[aria-pressed="true"],
.voice-note .play, .live-pill, .faces-self-hidden, .face-you, .bg-pick .px,
.kcard, .paper, .msg.mine .text, .bubble, .yp-q, .tag.me,
.uno-table, .uno-name, .wb-canvas, canvas.qr, .tooltip, .badge.dark {
  --ink: #1d1a22;
  --ink-muted: #4f4752;
  --ink-placeholder: #6a6270;
  --accent-ink: #8a3a1c;
  --gold-ink: #7a560c;
  --warning: #7a4a10;
  --success: #2b6a3c;
  --danger: #b3363c;
  --surface: #fffaf3;
  --surface-2: #f3ebdf;
  --surface-3: #e6dccd;
  --surface-input: #fffdf8;
  --edge: 1px solid rgba(29, 26, 34, 0.18);
  --field-edge: rgba(29, 26, 34, 0.3);
  color: var(--ink);
}
.tooltip, .badge.dark { background: #f4eee6; color: #1d1a22; }

/* icons: line icons, never filled, never pixel-snapped */
.px.ic, .px-icon.ic { fill: none; shape-rendering: geometricPrecision; }
.room-tab .px, .me-pill .px, .tag-lead .px { width: 14px; height: 14px; }
.tag .px { width: 12px; height: 12px; }
.tool .px, .tab-item .px { width: 20px; height: 20px; }

/* ------------------------------------------------------------ buttons */
.btn { background: var(--surface-2); border: var(--edge); box-shadow: none; border-radius: var(--r-sm); font-weight: var(--fw-semibold); }
@media (hover: hover) { .btn:hover { background: var(--surface-3); } }
.btn:active { transform: scale(0.98); box-shadow: none; }
.btn.primary { background: var(--primary); border-color: transparent; }
@media (hover: hover) { .btn.primary:hover { background: var(--primary-hover); } }
.btn.danger { background: var(--danger); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
@media (hover: hover) { .btn.ghost:hover { background: var(--chrome-fill-hover); } }
.btn.on, .btn[aria-pressed="true"] { background: var(--selected); border-color: transparent; box-shadow: none; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--surface-2); border-color: transparent; color: var(--ink-muted); opacity: 0.7; }
.btn.danger-line { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.armed { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.icon-btn { border-radius: var(--r-sm); border-color: var(--chrome-line); background: var(--chrome-fill); font-size: var(--fs-small); }
.icon-btn.on, .icon-btn[aria-pressed="true"] { box-shadow: none; }
.icon-btn.accent { background: var(--primary); border-color: transparent; font-weight: var(--fw-bold); }
@media (hover: hover) { .icon-btn.accent:hover { background: var(--primary-hover); } }
.icon-btn.accent .px { color: currentColor; }
.icon-btn.danger { background: var(--danger); border-color: transparent; }

/* ------------------------------------------------------------ top bar */
.topbar { gap: var(--s-4); padding-inline: var(--s-6); }
.office-btn { height: 44px; padding-inline: var(--s-2) var(--s-3); border-radius: 14px; font-size: 1.0625rem; letter-spacing: -0.01em; }
.office-btn .px { width: 16px; height: 16px; }
.rooms { padding: 4px; gap: 2px; border: 1px solid var(--chrome-line-soft); border-radius: 16px; background: var(--bg-sunk); }
.room-tab { height: 38px; padding: 0 14px; border-radius: 12px; font-weight: var(--fw-semibold); }
.room-tab[aria-current], .room-tab.on { background: var(--chrome-text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.room-tab[aria-current] .room-count, .room-tab.on .room-count { background: #237a52; color: #fff; }
.room-tab .crown, .room-tab .px.crown { color: var(--gold-ink); }
.clock-split, .mic-split, .cam-split { border-radius: var(--r-sm); }

/* ------------------------------------------------------------ the room: rounded, lifted; the art itself untouched */
#room { border-radius: 20px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 24px 60px rgba(0, 0, 0, 0.45); }
.tag { padding: 2px 9px; background: rgba(22, 26, 35, 0.84); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tag.me { background: var(--primary); }
.tag.yazan .ai, .tag .ai { background: #6c5ce7; color: #fff; }
.bubble { border: 0; border-radius: 16px 16px 16px 6px; background: #fff; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28); }

/* ------------------------------------------------------------ the dock */
.dock { gap: 6px; padding: 6px; border: 1px solid var(--chrome-line-soft); border-radius: 20px; background: var(--glass); box-shadow: var(--sh-3); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.dock .sep { margin: 10px 4px; }
.tool { height: 48px; padding: 0 14px; border-radius: 14px; font-size: 0.875rem; }
.tool .px { color: var(--chrome-text); }
.tool.on, .tool[aria-pressed="true"], .tool[aria-expanded="true"] { box-shadow: none; }
.me-pill { height: 48px; padding-inline: 6px 12px; border: 0; border-radius: 14px; background: var(--chrome-fill); }
.me-pill .avatar { width: 36px; height: 36px; }

/* phone bottom bar */
.bottom-bar { border-top: 1px solid var(--chrome-line-soft); background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.tab-item .tab-ic { border-radius: 14px; }

/* ------------------------------------------------------------ badges, dots, avatars */
.badge.quiet { background: var(--surface-3); color: var(--ink); }
.dot { border-color: var(--surface); }
.avatar { background: var(--surface-2); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12); }
.here-who .avatar, .here-row .avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }

/* ------------------------------------------------------------ fields */
.input, .field input, .field textarea, .field select, textarea.input, .chat-input, .datepick-btn, .scribe-lang, .datepick-title select, .link-box input {
  border: 1px solid var(--field-edge); border-radius: var(--r-sm); background: var(--surface-input); color: var(--ink);
}
.switch input { border: 1px solid var(--field-edge); background: var(--surface-3); }
.switch input::after { top: 3px; inset-inline-start: 3px; background: var(--ink); box-shadow: none; }
.switch input:checked { background: var(--selected); }
.switch input:checked::after { background: #1d1a22; }
.seg { border-radius: 14px; }
.seg > [aria-checked="true"], .seg > [aria-pressed="true"], .seg > [aria-selected="true"], .seg > .on { border-color: transparent; box-shadow: none; }
.chip { border: 1px solid var(--chrome-line); background: var(--surface-2); }
.chip[aria-pressed="true"], .chip[aria-checked="true"], .chip.on { border-color: transparent; }
.tabs { border-bottom: 1px solid var(--surface-3); }
.tab[aria-selected="true"] { border-bottom-color: var(--primary); }

/* ------------------------------------------------------------ surfaces: glass */
.panel, .card, .sheet { border: var(--edge-soft); }
.card { border-radius: 24px; }
.sheet { border-radius: 24px 24px 0 0; }
.popover, .menu, .toast, .habib-status, .piece-bar {
  border: var(--edge); background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.popover, .menu { border-radius: 18px; }
.toast { border-radius: 999px; }
/* a notice with answers underneath is a card, not a pill: a pill's big corners
   squeeze the text and leave the wrapped buttons ragged */
.toast.stack {
  align-items: flex-start; border-radius: 22px; padding: var(--s-3) var(--s-4) var(--s-4);
  row-gap: var(--s-3);
}
.toast.stack > .px { margin-top: 2px; }
.toast.stack > span:not(.actions):not(.px) { flex: 1 1 0; line-height: 1.45; }
.toast.stack > .px { flex: none; }
.toast.stack .actions { justify-content: flex-start; gap: var(--s-2); margin-inline-start: 0; }
.toast.stack .actions .btn { border-radius: 999px; flex: 0 0 auto; }
.habib-panel, .yazan-panel { border: var(--edge); border-radius: var(--r-lg); background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.banner, .banner.offline, .banner.live {
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 999px;
  background: var(--glass); color: var(--ink); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.banner .px { color: var(--primary); }
.banner .btn { min-height: 34px; border-radius: 999px; }
.pa-bar, .meeting-bar { border-radius: 14px; }
.menu-tile, .menu-status, .menu-choice { border: var(--edge); background: var(--surface-2); box-shadow: none; }
@media (hover: hover) { .menu-tile:hover, .menu-status:hover { background: var(--surface-3); } }
.list-row { border-radius: 12px; }
.kcol { border-radius: 18px; }
.kcard { border: 0; border-radius: 14px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); }

/* ------------------------------------------------------------ chat */
.chat { border: var(--edge-soft); border-radius: 24px; box-shadow: none; }
.chat-tab { border-radius: 12px; }
.chat-tab[aria-selected="true"] { border-color: transparent; background: var(--surface-3); }
.here-row { margin: 0 var(--s-3); padding: 10px 10px 10px 12px; border: 0; border-radius: 16px; background: rgba(255, 255, 255, 0.04); }
.msg .text { border-radius: 18px 18px 18px 6px; background: var(--surface-2); }
.msg.mine .text { background: var(--primary); border-radius: 18px 18px 6px 18px; }
.chat-form { margin: 0 var(--s-3) var(--s-3); padding: 6px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 18px; background: var(--surface-input); }
.chat-form .chat-input { border: 0; background: transparent; }
.chat-form .btn.mic { border-color: transparent; background: transparent; color: var(--chrome-muted); }
@media (hover: hover) { .chat-form .btn.mic:hover { background: var(--chrome-fill-hover); color: var(--ink); } }
.chat-form .btn.mic[aria-pressed="true"] { background: var(--danger); color: #1d1a22; }
.btn.send { border-color: transparent; border-radius: 12px; }
.decor-bar { border: var(--edge-soft); border-radius: 24px; box-shadow: none; }

/* ------------------------------------------------------------ Yazan's and Habib's panels */
.yp-a { background: var(--surface-2); }
.yp-a.miss { background: var(--warning-soft); color: var(--ink); }
.yp-offer, .yp-ask { border-color: rgba(154, 184, 255, 0.35); background: var(--surface-2); }
.yp-desk { border-color: rgba(154, 184, 255, 0.25); background: var(--surface-2); }
.yp-task.flagged { border-color: rgba(242, 201, 76, 0.4); background: var(--warning-soft); }

/* ------------------------------------------------------------ v1 screens that hard-coded paper white */
.decor-selected .way, .desk-style, .uno-trow, .clock-me, .clock-sessions li, .clock-person, .scores-row, .pick, .signin-code, .rps-hand, .share-pick, .arc-actions li, .arc-notes, .scribe-live {
  border: var(--edge); background: var(--surface-2); color: var(--ink);
}
.desk-style.on { border-color: var(--primary); background: rgba(255, 159, 122, 0.14); }
.meeting-now { background: rgba(255, 159, 122, 0.14); }
.decor-selected { border-radius: 14px; }

/* the phone joystick: a light knob on glass */
.joy { border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(22, 26, 35, 0.45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.joy-knob { border: 0; background: var(--chrome-text); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
.float-btn, .float-pill { border-color: var(--chrome-line-soft); background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
