:root {
  --bg: #0d0907;
  --panel: #17110d;
  --panel-2: #201712;
  --line: #3a2c22;
  --ink: #f4ebe3;
  --muted: #b6a597;
  --accent: #ff7a1a;
  --sofia: #c9a7ff;
  --claude: #ff9d5c;
  --fernando: #7fd6c2;
  --joel: #9cc3ff;
  --joel_sofia: #f2a7c3;
  --joel_claude: #6fd3c8;
  --ok: #6fd18a;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.5 Inter, "Segoe UI", system-ui, -apple-system, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.login-card h1 { margin: 0 0 6px; font-size: 28px; }
.login-card p { color: var(--muted); margin: 0 0 18px; }
.login-card form { display: flex; gap: 8px; }
.login-card input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
button[type=submit] { background: var(--accent); color: #1a0d04; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; }
button[type=submit]:disabled { opacity: .6; cursor: default; }
.error { color: #ff8f8f; min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }

/* ---- on your phone ---- */
.phone-dialog { width: min(360px, calc(100vw - 32px)); background: var(--panel); color: var(--ink); border: 1px solid var(--line);
                border-radius: var(--radius); padding: 22px; text-align: center; }
.phone-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.phone-dialog h2 { margin: 0 0 6px; font-size: 20px; }
.phone-dialog p { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.phone-dialog .phone-note { font-size: 13px; }
.phone-qr { width: min(240px, 100%); aspect-ratio: 1; margin: 0 auto 14px; background: #fff; border-radius: 10px; overflow: hidden; }
.phone-qr svg { display: block; width: 100%; height: 100%; }
.phone-dialog .error:empty { display: none; }
@media (max-width: 600px) {
  #phone { display: none; }                                  /* a phone has no use for it */
  .tabs { overflow-x: auto; scrollbar-width: none; }         /* five tabs: they scroll rather than squeeze */
  .tabs button { flex: none; padding: 12px 12px; white-space: nowrap; }
}

/* ---- layout ---- */
.app { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); grid-template-rows: auto 1fr;
       grid-template-areas: "top top" "stage panel"; gap: 16px; padding: 16px; height: 100vh; }
.top { grid-area: top; display: flex; align-items: center; gap: 16px; }
.top h1 { margin: 0; font-size: 22px; letter-spacing: .01em; }
.who { color: var(--muted); font-size: 14px; flex: 1; }
.link-button { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; }
.stage { grid-area: stage; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.panel { grid-area: panel; min-height: 0; display: flex; flex-direction: column; background: var(--panel);
         border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

/* ---- Eastern Gate Software radio ---- */
.radio { display: flex; align-items: center; gap: 10px; min-width: 0; background: var(--panel); border: 1px solid var(--line);
         border-radius: 999px; padding: 4px 14px 4px 4px; }
.radio-play { background: var(--accent); color: #1a0d04; border: 1px solid var(--accent); border-radius: 999px; padding: 6px 14px;
              font-weight: 700; cursor: pointer; white-space: nowrap; }
.radio-play[aria-pressed=true] { background: var(--panel-2); color: var(--ink); }
.radio-info { min-width: 0; max-width: 360px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-info b { color: var(--ink); font-weight: 600; }
.radio-vol { width: 90px; accent-color: var(--accent); }
.radio-art { width: 28px; height: 28px; border-radius: 5px; object-fit: cover; flex: none; }
.radio-spotify { background: #1db954; color: #04130a; border: 0; border-radius: 999px; padding: 5px 12px; font-weight: 700;
                 font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.radio-ask { width: 190px; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.msg[data-from=dj] .msg-head b { color: #ffd166; }

/* ---- the scene ---- */
.scene { position: relative; width: 100%; aspect-ratio: 1664 / 928; border-radius: var(--radius); overflow: hidden;
         background: #120c09; border: 1px solid var(--line); }
.layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .7s ease; }
.layer.on { opacity: 1; }
/* One bubble, over the wall and window above everyone's heads; office.js puts it over the speaker
   and its tail (--tail) on them. */
.bubble { position: absolute; top: 3%; left: 8px; max-width: min(30%, 320px); background: rgba(250, 244, 238, .96); color: #1c130e;
          border-radius: 16px; padding: 10px 14px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 14px; line-height: 1.4;
          transform-origin: bottom center; animation: pop .35s ease-out; }
.bubble::after { content: ""; position: absolute; bottom: -9px; left: var(--tail, 24px); width: 18px; height: 18px; background: inherit; transform: rotate(45deg); }
.bubble-name { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .6; margin-bottom: 2px; }
.bubble-text { display: block; overflow-wrap: anywhere; }
.bubble.fading { opacity: 0; transition: opacity 1.2s ease; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Six desks, in the order they sit in the picture. */
.desks { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.desk { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 13.5px;
        display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; }
.desk b { min-width: 0; overflow-wrap: anywhere; }
.desk .dot { width: 9px; height: 9px; border-radius: 50%; background: #5d4c40; }
.desk.here .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(111,209,138,.15); }
.desk .state { width: 100%; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.desk[data-agent=sofia] b { color: var(--sofia); }
.desk[data-agent=claude] b { color: var(--claude); }
.desk[data-agent=fernando] b { color: var(--fernando); }
.desk[data-agent=joel] b { color: var(--joel); }
.desk[data-agent=joel_sofia] b { color: var(--joel_sofia); }
.desk[data-agent=joel_claude] b { color: var(--joel_claude); }
.desk[data-agent=other] b { color: #e8d7a8; }
.desk .tag { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
             border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.desk.off .dot { background: #d65a4a; }
.desk.off .state { color: #e59a8f; }

/* ---- bots and their owner's switch ---- */
.bots { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.bots-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 6px; }
.bots ul { list-style: none; margin: 0; padding: 0; }
.bots li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid rgba(58,44,34,.6); flex-wrap: wrap; }
.bots li:first-child { border-top: 0; }
.bots .dot { width: 9px; height: 9px; border-radius: 50%; background: #5d4c40; flex: none; }
.bots .dot.on { background: var(--ok); }
.bots .dot.off { background: #d65a4a; }
.bot-name { font-weight: 600; }
.bot-name small { color: var(--muted); font-weight: 400; }
.bot-state { color: var(--muted); font-size: 13px; flex: 1; }
.small-button { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.small-button:hover { border-color: var(--accent); }
.small-button.danger { border-color: rgba(214,90,74,.6); color: #f0a094; }

/* ---- conversation ---- */
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; padding: 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.count { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: 999px; background: var(--panel-2); font-size: 12px; }
.log, .tasks { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 12px 14px; list-style: none; }
.msg { padding: 8px 0 10px; border-bottom: 1px solid rgba(58,44,34,.6); }
.msg-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: 13px; color: var(--muted); }
.msg-head b { font-size: 14px; }
.msg[data-from=sofia] .msg-head b { color: var(--sofia); }
.msg[data-from=claude] .msg-head b { color: var(--claude); }
.msg[data-from=fernando] .msg-head b { color: var(--fernando); }
.msg[data-from=joel] .msg-head b { color: var(--joel); }
.msg[data-from=joel_sofia] .msg-head b { color: var(--joel_sofia); }
.msg[data-from=joel_claude] .msg-head b { color: var(--joel_claude); }
.msg[data-from=other] .msg-head b { color: #e8d7a8; }
.msg.system { color: var(--muted); font-size: 13px; font-style: italic; padding: 6px 0; }
.msg.system .time { font-style: normal; opacity: .7; }
.log .day { color: var(--muted); text-align: center; font-size: 12px; padding: 8px 0; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
        border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; color: var(--muted); }
.chip.task { color: var(--accent); border-color: rgba(255,122,26,.5); }
.chip.done { color: var(--ok); border-color: rgba(111,209,138,.5); }
.empty { color: var(--muted); padding: 24px 4px; text-align: center; }
.task-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel-2); }
.task-card.done { opacity: .65; }
.task-card h3 { margin: 0 0 4px; font-size: 15px; }
.task-card p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---- the Business tab ---- */
.biz { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; }
.biz h3 { margin: 16px 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.biz-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); line-height: 1.45; }
.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.biz-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.biz-value { font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.biz-label { font-size: 12.5px; color: var(--muted); }
.biz-sub { font-size: 11.5px; color: var(--muted); opacity: .8; margin-top: 2px; }
.biz-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 96px; align-items: end; }
.biz-bar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.biz-bar span { width: 100%; min-height: 2px; background: var(--accent); border-radius: 6px 6px 2px 2px; }
.biz-bar em { font-style: normal; font-size: 10.5px; color: var(--muted); }
.biz-time { color: var(--muted); font-size: 12px; margin: 14px 0 4px; }
.biz-reels { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.biz-reels li { padding: 5px 0; border-top: 1px solid rgba(58,44,34,.6); }
.biz-reels li span { color: var(--muted); }

/* ---- composer ---- */
.composer { border-top: 1px solid var(--line); padding: 10px 12px 12px; background: var(--panel-2); }
.composer .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.composer .row + .row { margin-top: 8px; flex-wrap: nowrap; align-items: stretch; }
.composer label { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.composer select, .composer input, .composer textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
.composer #title { flex: 1; min-width: 160px; }
.composer textarea { flex: 1; min-width: 0; resize: vertical; min-height: 44px; }

/* ---- phones ---- */
/* ---- mail: the people's inboxes (server/mail.js), wide when open ---- */
.app.mail-wide { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "panel"; }
.app.mail-wide .stage { display: none; }
.mail { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mail-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mail-box { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-right: auto; }
.mail-box select { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
.mail-gate { padding: 20px 18px 6px; }
.mail-gate:empty { display: none; }
.mail-gate h2 { margin: 0 0 6px; font-size: 19px; }
.mail-gate p { color: var(--muted); margin: 0 0 14px; max-width: 62ch; }
.mail-gate .code { font: 700 22px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .08em; color: var(--ink); }
.mail-gate .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.main-button { background: var(--accent); color: #1a0d04; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer; }
.main-button:disabled { opacity: .6; cursor: default; }
.mail-error { margin: 0 18px; }
.mail-error:empty { display: none; }
.mail-devices { padding: 10px 14px 12px; overflow-y: auto; max-height: 45%; border-bottom: 1px solid var(--line); }
.mail-devices h3 { margin: 10px 0 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mail-devices ul { list-style: none; margin: 0; padding: 0; }
.mail-devices li { display: flex; gap: 6px 10px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid rgba(58,44,34,.6); font-size: 13px; }
.mail-devices li span { color: var(--muted); }
.mail-devices li .small-button:first-of-type { margin-left: auto; }
.mail-frame { flex: 1; min-height: 0; width: 100%; border: 0; background: #fff; }

/* ---- docs: the team's files, edited in Collabora Online (server/docs.js) ---- */
.docs { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.docs-upload { cursor: pointer; }
.docs-list { list-style: none; margin: 0; padding: 4px 14px 14px; overflow-y: auto; flex: 1; min-height: 0; }
.docs-list li { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; padding: 9px 0; border-top: 1px solid rgba(58,44,34,.6); font-size: 14px; }
.docs-list li.empty { color: var(--muted); border: 0; }
.docs-icon { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; font: 700 12px/1 system-ui, sans-serif; color: #fff; flex: none; }
.docs-icon.w { background: #2b5797; } .docs-icon.x { background: #1e7145; } .docs-icon.p { background: #c43e1c; } .docs-icon.o { background: #6b5b4e; }
.docs-name { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 600; cursor: pointer; text-align: left; }
.docs-name:hover { color: var(--accent); }
.docs-meta { color: var(--muted); font-size: 12.5px; margin-right: auto; }
.docs-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.docs-title { font-size: 14px; margin-right: auto; }
.docs-icon.f { background: #8a6d2f; }
.docs-icon svg { width: 17px; height: 17px; }
.docs-crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 8px 14px 0; color: var(--muted); font-size: 13.5px; }
.docs-crumb { background: none; border: 0; padding: 2px 4px; color: var(--muted); cursor: pointer; border-radius: 6px; }
.docs-crumb:last-child { color: var(--ink); font-weight: 600; }
.docs-crumb:hover { color: var(--accent); }
.docs-progress { margin: 10px 14px 0; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.docs-progress-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; margin-bottom: 8px; }
.docs-progress-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-progress-track { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.docs-progress-track span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .15s linear; }
.docs.drop .docs-list { outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: 12px; }
.docs-move { text-align: left; }
.docs-move select { width: 100%; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 4px 0 6px; }
.docs-move .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(420px, 1fr);
         grid-template-areas: "top" "stage" "panel"; height: auto; min-height: 100vh; padding: 12px 16px; }
  .bubble { max-width: 34%; font-size: 11px; line-height: 1.3; padding: 6px 8px 7px; border-radius: 12px; }
  .bubble-name { font-size: 9px; }
  .desks { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .top { flex-wrap: wrap; row-gap: 10px; }
  .radio { order: 3; width: 100%; flex-wrap: wrap; border-radius: 16px; }
  .radio-info { flex: 1; max-width: none; }
  .radio-ask { order: 5; width: 100%; }
  .desk { padding: 8px; font-size: 12.5px; gap: 2px 6px; }
  .desk .state { font-size: 11.5px; line-height: 1.3; }
  .panel { min-height: 70vh; }
  .app.mail-wide { grid-template-rows: auto minmax(560px, 1fr); }
  .mail-frame { min-height: 72vh; }
  .docs-meta { width: 100%; order: 3; }
}
