/* The Office — Studio by day, Night Shift in the evening. The look is set on
   <html data-look> by the clock (app.js), and every colour below is a token of it. */
:root,
[data-look="studio"] {
  --bg: #EDF0F1;
  --panel: #FFFFFF;
  --ink: #1E2629;
  --mute: #5D6A70;
  --line: #DCE2E5;
  --red: #C8372D;
  --redbg: #FDF3F2;
  --redline: #EFC6C1;
  --acc: #2B6A50;
  --warn: #8A6100;
  --warnbg: #FFF4DE;
  --room: linear-gradient(#EEF2F3, #E1E7E9);
  --tag: #FFFFFF;
  --tagline: #D2D9DC;
  --font: 'Lexend', system-ui, sans-serif;
  --mono: 'Martian Mono', ui-monospace, monospace;
  color-scheme: light;
}
[data-look="night"] {
  --bg: #0F131B;
  --panel: #161B26;
  --ink: #E6EAF2;
  --mute: #8D97A8;
  --line: #262D3B;
  --red: #FF6F61;
  --redbg: #2A1719;
  --redline: #5B2A2A;
  --acc: #6FD3A2;
  --warn: #F2C230;
  --warnbg: #2A2414;
  --room: radial-gradient(120% 90% at 40% 30%, #1E2638, #0B0F16);
  --tag: rgba(22, 27, 38, 0.92);
  --tagline: #34405A;
  --font: 'Red Hat Display', system-ui, sans-serif;
  --mono: 'Red Hat Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; transition: background-color 0.6s; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
em, time, .num { font-style: normal; font-family: var(--mono); font-size: 0.9em; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---- sign in ---- */
.login { max-width: 22rem; margin: 18vh auto 0; padding: 0 20px; display: grid; gap: 10px; }
.login h1 { margin: 0; font-size: 1.9rem; font-weight: 650; letter-spacing: -0.02em; }
.login p { margin: 0 0 8px; color: var(--mute); }
.login input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.login button { padding: 10px; border: 0; border-radius: 999px; background: var(--acc); color: #FFFFFF; font-weight: 600; cursor: pointer; }
.login .error { color: var(--red); min-height: 1.4em; }

/* ---- the frame ---- */
.app { height: 100%; display: grid; grid-template-rows: auto auto 1fr; padding-top: env(safe-area-inset-top, 0px); }
.top { display: flex; align-items: center; gap: 14px; padding: 10px 16px 8px; min-width: 0; }
.brand { font-weight: 650; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; }
.when, .spend { color: var(--mute); font-size: 12.5px; white-space: nowrap; }
.spend { margin-left: auto; }
.spend.over { color: var(--red); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); flex: none; }
.seg button { border: 0; background: transparent; color: var(--mute); font-size: 12px; padding: 4px 11px; cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--bg); }
.icon { border: 0; background: transparent; color: var(--mute); padding: 4px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; flex: none; }
.icon:hover { color: var(--ink); }
.banner { margin: 0 16px 8px; padding: 7px 12px; border-radius: 10px; background: var(--warnbg); color: var(--warn); font-size: 12.5px; }

.main { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; border-top: 1px solid var(--line); }
.room-wrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.room { position: relative; flex: 1; min-height: 0; background: var(--room); overflow: hidden; touch-action: none; }
.room-canvas { position: absolute; inset: 0; display: block; cursor: grab; }
.room-canvas:active { cursor: grabbing; }
.hint { position: absolute; left: 12px; bottom: 10px; font-size: 11px; color: var(--mute); background: color-mix(in srgb, var(--panel) 80%, transparent); padding: 2px 9px; border-radius: 99px; pointer-events: none; }
.no3d { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--mute); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 8px 16px; font-size: 11.5px; color: var(--mute); border-top: 1px solid var(--line); background: var(--panel); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.legend .l-now { background: color-mix(in srgb, var(--acc) 30%, transparent); box-shadow: inset 0 0 0 2px var(--acc); }
.legend .l-recent { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--acc) 60%, transparent); }
.legend .l-quiet { box-shadow: inset 0 0 0 1.5px var(--mute); opacity: 0.6; }
.legend .l-walk { border-radius: 2px; width: 14px; height: 4px; background: repeating-linear-gradient(90deg, var(--mute) 0 3px, transparent 3px 6px); }
.legend .l-flag { border-radius: 1px; width: 9px; height: 11px; background: var(--red); clip-path: polygon(0 0, 100% 30%, 0 60%); }

/* ---- the labels over the people ---- */
.tags { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.tag { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; text-align: left; background: var(--tag); border: 1px solid var(--tagline); border-radius: 9px; padding: 4px 9px 5px 8px; white-space: nowrap; box-shadow: 0 6px 14px -8px rgba(0, 0, 0, 0.35); color: var(--ink); will-change: transform; }
.tag::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px; background: var(--tag); border-right: 1px solid var(--tagline); border-bottom: 1px solid var(--tagline); transform: translateX(-50%) rotate(45deg); }
.tag b { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; line-height: 1.2; }
.tag b i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.tag.st-recent b i { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.tag.st-quiet b i, .tag.st-unknown b i { background: #B4BDC1; }
.tag.st-down b i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--mute); }
.tag.st-down { opacity: 0.75; }
.tag small { display: block; font-size: 10.5px; color: var(--mute); line-height: 1.25; }
.tag.st-now small { color: var(--ink); }
.tag.moving { border-style: dashed; }
.tag.focused { box-shadow: 0 0 0 2px var(--c, var(--acc)), 0 6px 14px -8px rgba(0, 0, 0, 0.35); }
.tag .n { position: absolute; right: -8px; top: -8px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #FFFFFF; font: 700 11px/18px var(--font); text-align: center; padding: 0 5px; }
.tag .warn { position: absolute; left: -7px; top: -8px; width: 17px; height: 17px; border-radius: 4px; background: #F2C230; color: #1E2629; font: 800 11px/17px var(--font); text-align: center; }
.tag.you { background: var(--redbg); border-color: var(--redline); }
.tag.you::after { background: var(--redbg); border-color: var(--redline); }
.tag.you.calm { background: var(--tag); border-color: var(--tagline); }
.tag.you.calm::after { background: var(--tag); border-color: var(--tagline); }

/* ---- the panel ---- */
.side { background: var(--panel); border-left: 1px solid var(--line); padding: 12px 14px 18px; overflow: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.side h2 { margin: 6px 0 0; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mute); display: flex; align-items: center; gap: 6px; }
.side h2 .k { background: var(--red); color: #FFFFFF; border-radius: 99px; font-size: 10px; padding: 0 6px; letter-spacing: 0; }
.empty { margin: 0; color: var(--mute); font-size: 12.5px; }
.wait { display: grid; gap: 2px; border: 1px solid var(--redline); background: var(--redbg); border-radius: 10px; padding: 8px 10px; text-decoration: none; }
.wait b { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.wait p { margin: 0; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.wait small { color: var(--red); font-weight: 600; font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--c); }
.desks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.desks button { width: 100%; display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; border: 0; background: transparent; padding: 5px 6px; border-radius: 8px; cursor: pointer; text-align: left; }
.desks button:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.desks .who { font-weight: 600; font-size: 12.5px; }
.desks .what { color: var(--mute); font-size: 11.5px; }
.desks .st-recent .dot { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.desks .st-quiet .dot, .desks .st-unknown .dot, .desks .st-down .dot { background: #B4BDC1; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.log li { display: grid; grid-template-columns: 42px 1fr; gap: 4px; font-size: 11.6px; line-height: 1.35; }
.log time { color: var(--mute); font-size: 9.8px; padding-top: 1px; }
.log .open span { color: var(--acc); font-weight: 600; }
.log .alert span { color: var(--red); }
.log span { overflow-wrap: anywhere; }

/* ---- one agent ---- */
.back { align-self: flex-start; border: 0; background: transparent; color: var(--mute); padding: 2px 0; cursor: pointer; font-size: 12px; }
.who-head { display: flex; align-items: center; gap: 10px; }
.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #FFFFFF; font-weight: 600; font-size: 16px; flex: none; background: var(--c); }
.who-head b { display: block; font-size: 17px; font-weight: 600; line-height: 1.2; }
.who-head small { font-size: 11.5px; color: var(--mute); }
.stchip { margin-left: auto; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, var(--c) 18%, var(--panel)); color: var(--ink); white-space: nowrap; }
.doing { margin: 0; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stats div { background: var(--bg); border-radius: 10px; padding: 7px 8px; display: grid; }
.stats em { font-size: 13.5px; }
.stats small { font-size: 10.5px; color: var(--mute); }
.warnline { margin: 0; font-size: 12px; background: var(--warnbg); color: var(--warn); border-radius: 9px; padding: 6px 9px; }
.btn { display: block; text-align: center; font-size: 13px; font-weight: 600; padding: 10px; border-radius: 99px; background: var(--c, var(--acc)); color: #FFFFFF; text-decoration: none; margin-top: 4px; }

/* ---- settings ---- */
.settings { position: fixed; inset: 0; z-index: 5; background: var(--bg); overflow: auto; padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 40px; }
.settings .inner { max-width: 40rem; margin: 0 auto; display: grid; gap: 14px; }
.settings h2 { margin: 0; font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.settings h2 button { margin-left: auto; }
.setting { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; }
.setting label { font-weight: 600; }
.setting p { margin: 0; color: var(--mute); font-size: 12.5px; }
.setting .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.setting input, .setting select { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.setting .src { font-size: 11px; color: var(--mute); }
.setting .msg { font-size: 12px; min-height: 1em; }
.setting .msg.bad { color: var(--red); }
.plain { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.plain.primary { background: var(--acc); color: #FFFFFF; border-color: var(--acc); }

/* ---- phones ---- */
@media (max-width: 759px) {
  .app { height: auto; min-height: 100%; display: block; }
  .top { flex-wrap: wrap; gap: 6px 10px; padding: 8px 14px; }
  .when { order: 5; width: 100%; }
  .main { display: block; }
  .room { height: 54vh; min-height: 300px; flex: none; }
  .hint { display: none; }
  .legend { display: none; }
  .side { border-left: 0; overflow: visible; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); }
  .tag { padding: 2px 7px 3px 6px; }
  .tag small { display: none; }
  .tag.focused small, .tag.you small { display: block; }
}
