/* BosslyStudio — agents room. Dark navy, English LTR, Heebo. Matches the approved design. */
:root {
  --bg: #12142B;
  --panel: #171A36;
  --surface: #1B1E3D;
  --surface-2: #232750;
  --line: #2A2E57;
  --line-2: #343A70;
  --text: #EEF0FF;
  --muted: #A9AED4;
  --soft: #C4C8E8;
  --accent: #F5B83D;
  --accent-ink: #1A1300;
  --ok: #5FD39A;   --ok-bg: #1F3B33;
  --warn: #FFC163; --warn-bg: #3A3020;
  --bad: #FF8A7A;  --bad-bg: #3D2228;
  --info: #7FB4FF; --info-bg: #1F2E4D;
  --plan: #A9B4FF; --plan-bg: #262B55;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; font-size: 15px; line-height: 1.5; min-height: 100vh; }
a { color: var(--accent); }
a:hover { color: #FFD27A; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- top bar ---------------------------------------------------------- */
.topbar {
  min-height: 72px; padding: 12px 32px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.brand-name { font-size: 20px; font-weight: 800; }
.topnav { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 8px 16px; border-radius: 999px; border: 1px solid #2F3463; color: var(--soft);
  font-size: 14px; text-decoration: none; background: transparent;
}
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.top-status { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ok); flex: none; }
.dot.idle { background: #6B7099; }
.dot.warn { background: var(--warn); }

.flash { margin: 16px 32px 0; padding: 12px 16px; border-radius: 12px; background: var(--ok-bg); color: #9FF0C8; }
.flash.error { background: var(--bad-bg); color: #FFB3A8; }

/* ---- agents room ------------------------------------------------------ */
.room { display: flex; flex-wrap: wrap; min-height: calc(100vh - 72px); }
.network { position: relative; flex: 999 1 640px; min-width: 0; padding: 16px; }
.network-canvas { position: relative; width: 100%; max-width: 1000px; margin: 0 auto; aspect-ratio: 1000 / 880; }
.network-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.agent {
  position: absolute; transform: translate(-50%, -42px); width: 150px; display: flex; flex-direction: column;
  align-items: center; gap: 4px; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none;
  color: var(--text); text-align: center;
}
.agent .face {
  width: clamp(52px, 8.4vw, 84px); height: clamp(52px, 8.4vw, 84px); border-radius: 50%; overflow: hidden;
  border: 3px solid #4A4F80; background: var(--surface); display: block; transition: transform .15s, box-shadow .15s;
}
.agent .face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.agent .face .avatar-initials { width: 100%; height: 100%; font-size: clamp(18px, 2.6vw, 28px); }
.agent:hover .face { transform: scale(1.06); border-color: #B8C0FF; }
.agent.selected .face { border-color: #B8C0FF; box-shadow: 0 0 0 5px rgba(184,192,255,.2); }
.agent.lead { transform: translate(-50%, -66px); width: 220px; }
.agent.ceo { transform: translate(-50%, -70px); width: 220px; z-index: 2; }
.agent.ceo .face {
  width: clamp(92px, 14vw, 140px); height: clamp(92px, 14vw, 140px); border-color: var(--accent);
  box-shadow: 0 0 0 7px rgba(245,184,61,.16), 0 0 48px rgba(245,184,61,.45);
}
.agent.ceo .face .avatar-initials { font-size: clamp(28px, 4vw, 44px); background: var(--warn-bg); color: var(--accent); }
.agent.ceo .name { font-size: 20px; font-weight: 800; }
.agent.unassigned .face { border-style: dashed; border-color: #4A4F80; background: transparent; }
.agent.unassigned .face .avatar-initials { background: transparent; color: var(--muted); font-size: 30px; font-weight: 400; }
.agent.unassigned .name { color: var(--soft); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.agent .badge { white-space: nowrap; }
.agent.lead .face {
  width: clamp(84px, 13vw, 132px); height: clamp(84px, 13vw, 132px); border-color: var(--accent);
  box-shadow: 0 0 0 6px rgba(245,184,61,.18), 0 0 40px rgba(245,184,61,.45);
}
.agent.lead .face img { filter: none; }
.agent .name { font-weight: 700; font-size: 15px; margin-top: 4px; }
.agent.lead .name { font-size: 18px; }
.agent .role { font-size: 12px; color: var(--muted); line-height: 1.2; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 10px; border-radius: 999px;
  color: var(--muted);
}
.badge.live { background: var(--warn-bg); color: #FFD27A; }
.network-hint { text-align: center; margin-top: 8px; font-size: 13px; color: var(--muted); }

/* Org tree: +/− on a manager's circle shows the people under them (laid out by studio.js). */
.agent.member .face { width: clamp(44px, 6.6vw, 66px); height: clamp(44px, 6.6vw, 66px); }
.agent.collapsed, .team-toggle.collapsed { display: none; }
.team-toggle {
  position: absolute; z-index: 3; transform: translate(calc(-50% + 34px), calc(-50% - 30px));
  display: inline-flex; align-items: center; gap: 2px; min-width: 30px; height: 26px; padding: 0 7px;
  border-radius: 999px; border: 2px solid #8E97FF; background: var(--surface); color: var(--text);
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; line-height: 1;
}
.team-toggle .sign { font-size: 15px; }
.team-toggle:hover, .team-toggle[aria-expanded="true"] { background: #8E97FF; color: #12142B; }
.team-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.org-actions { white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 0; color: #B8C0FF; font: inherit; cursor: pointer; text-decoration: underline; }

/* Phones: the ring becomes a grid of agent cards, Bossly first and full width. */
@media (max-width: 700px) {
  .network-canvas { aspect-ratio: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 8px; padding-top: 8px; }
  .agent .badge { white-space: normal; text-align: center; justify-content: center; font-size: 11px; }
  .network-canvas svg { display: none; }
  .agent, .agent.lead, .agent.ceo { position: static; transform: none; width: auto; }
  .agent.lead, .agent.ceo { grid-column: 1 / -1; }
  .agent .role { font-size: 11px; }
  .network-hint { position: static; text-align: center; margin-top: 16px; }
  /* Phones: the whole tree is listed (each team right after its manager); no toggles. */
  .agent.collapsed { display: flex; }
  .team-toggle, .org-actions { display: none; }
  .room { min-height: 0; }
}

.side { flex: 1 1 360px; min-width: 0; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.side-body { padding: 28px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.side h2 { margin: 0; font-size: 20px; font-weight: 800; }
.side .sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.feed-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--surface); }
.feed-item img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.feed-chip { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.feed-text { font-size: 14px; line-height: 1.5; }
.feed-time { font-size: 12px; color: var(--muted); }
.agent-panel-head { display: flex; gap: 16px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.agent-panel-head img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 3px solid #8E97FF; }
.note { padding: 14px 16px; border-radius: 12px; background: #2A2540; color: #FFD27A; font-size: 14px; }

/* ---- buttons / forms -------------------------------------------------- */
.btn {
  min-height: 40px; padding: 0 18px; border-radius: 12px; border: 1px solid #2F3463; background: transparent;
  color: var(--soft); cursor: pointer; font-size: 14px; display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; justify-content: center;
}
.btn:hover { border-color: #8E97FF; color: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; }
.btn.primary:hover { filter: brightness(1.05); color: var(--accent-ink); }
.btn.outline-accent { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.icon-btn { width: 44px; height: 44px; padding: 0; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input {
  height: 44px; border-radius: 10px; border: 1px solid var(--line-2); background: #1E2244; color: var(--text);
  padding: 0 12px; font-size: 14px; width: 100%;
}
textarea.input { height: auto; padding: 12px 14px; line-height: 1.6; resize: vertical; }
.input::placeholder { color: #8C91B8; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row > * { flex: 1 1 160px; }
.form-row > .btn { flex: 0 0 auto; }
.inline { display: inline; }

/* ---- workspace -------------------------------------------------------- */
.ws-head { padding: 20px 32px 0; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ws-head .lead-face { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); box-shadow: 0 0 24px rgba(245,184,61,.35); }
.ws-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ws-title h1 { margin: 0; font-size: 24px; font-weight: 800; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid #2E5E46; color: var(--soft); }
.chip.off { border-style: dashed; border-color: #4A4F80; color: var(--muted); }
.chip.sim { border-color: #6B5A2A; color: #FFD27A; }
.tabs { display: flex; gap: 4px; padding: 16px 32px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  height: 44px; padding: 0 18px; display: inline-flex; align-items: center; white-space: nowrap; color: var(--muted);
  text-decoration: none; border-bottom: 3px solid transparent; font-size: 15px;
}
.tab.on { color: #fff; font-weight: 800; border-bottom-color: var(--accent); }
.tab .count { margin-inline-start: 6px; font-size: 12px; background: var(--bad-bg); color: var(--bad); border-radius: 999px; padding: 0 7px; }
.ws-body { padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 20px; }

.grid { display: grid; gap: 20px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid.sidebar { grid-template-columns: minmax(260px, 400px) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .grid.sidebar { grid-template-columns: 1fr; } .topbar, .ws-head, .tabs, .ws-body { padding-inline: 16px; } .flash { margin-inline: 16px; } }

.card { padding: 20px; border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card h3 { margin: 0; font-size: 16px; font-weight: 800; }
.card .hint { font-size: 13px; color: var(--muted); margin: 0; }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { font-size: 34px; font-weight: 800; line-height: 1.1; }
.kpi .value.warn { color: var(--warn); } .kpi .value.bad { color: var(--bad); } .kpi .value.ok { color: var(--ok); }
.kpi .foot { font-size: 12px; color: var(--muted); }

.tag { font-size: 12px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; display: inline-block; text-align: center; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.plan { background: var(--plan-bg); color: var(--plan); }

.proj-row { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.proj-row .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.proj-row .top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; }
.bar > span.ok { background: var(--ok); } .bar > span.warn { background: var(--warn); }
.bar > span.bad { background: var(--bad); } .bar > span.plan { background: var(--plan); }

.issue { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #231F3A; }
.issue .stripe { width: 4px; flex: none; border-radius: 2px; }
.issue .stripe.bad { background: var(--bad); } .issue .stripe.warn { background: var(--warn); }
.issue .what { font-size: 14px; line-height: 1.5; }
.issue .where { font-size: 12px; color: var(--muted); }
.summary-text { margin: 0; white-space: pre-line; font-size: 14px; line-height: 1.7; color: var(--soft); }

.approval { padding: 14px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.approval .why { font-size: 12px; color: var(--muted); }
.approval .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.list { display: flex; flex-direction: column; gap: 10px; }
.proj-card {
  padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 6px;
}
.proj-card.on { border-color: #8E97FF; background: var(--plan-bg); }
.proj-card .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; }
.proj-card .meta { font-size: 12px; color: var(--muted); }

.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 14px; border-radius: 12px; background: var(--surface-2); }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 800; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0 8px; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 0 12px; white-space: nowrap; }
table.data td { background: var(--surface-2); padding: 10px 12px; vertical-align: middle; }
table.data tr td:first-child { border-radius: 10px 0 0 10px; }
table.data tr td:last-child { border-radius: 0 10px 10px 0; }
table.data.on-bg td { background: var(--surface); }
.muted { color: var(--muted); } .late { color: var(--bad); }
.analysis { padding: 14px 16px; border-radius: 12px; background: #231F3A; font-size: 14px; line-height: 1.6; }

/* ---- gantt ------------------------------------------------------------ */
.gantt { display: grid; grid-template-columns: minmax(160px, 240px) minmax(420px, 1fr); }
.gantt-scroll { overflow-x: auto; }
.g-label { height: 52px; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--surface-2); padding-inline-end: 12px; }
.g-label .t { font-size: 14px; }
.g-label .o { font-size: 12px; color: var(--muted); }
.g-head { height: 36px; display: flex; align-items: center; font-size: 12px; color: var(--muted); }
.g-weeks { height: 36px; position: relative; border-bottom: 1px solid var(--line); }
.g-week { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); font-size: 12px; color: var(--muted); padding: 8px 6px 0; }
.g-row { height: 52px; position: relative; border-bottom: 1px solid var(--surface-2); }
.g-bar {
  position: absolute; top: 14px; height: 24px; border-radius: 6px; color: #10122A; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap; min-width: 8px;
}
.g-bar.ok { background: var(--ok); } .g-bar.info { background: var(--info); } .g-bar.bad { background: var(--bad); }
.g-bar.warn { background: var(--warn); } .g-bar.plan { background: #4A4F80; color: var(--text); }
.g-today { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--accent); pointer-events: none; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--soft); flex-wrap: wrap; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 12px; height: 8px; border-radius: 2px; display: inline-block; }

/* ---- switches --------------------------------------------------------- */
.rule { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--surface-2); }
.rule .txt { flex: 1; }
.rule .txt .sub { font-size: 12px; color: var(--muted); }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #3A3F6E; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { left: 25px; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.conn { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.conn .sub { font-size: 12px; color: var(--muted); }

.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick button { min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: #1E2244; color: var(--text); cursor: pointer; font-size: 13px; }
.reply { white-space: pre-line; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); font-size: 14px; line-height: 1.7; }
.history-item { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.history-item .meta { font-size: 12px; color: var(--muted); }
details.add { border: 1px dashed var(--line-2); border-radius: 14px; padding: 12px 14px; }
details.add summary { cursor: pointer; color: var(--accent); font-weight: 700; }
details.add[open] summary { margin-bottom: 12px; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.login { max-width: 380px; margin: 12vh auto; padding: 0 16px; }

.feed-chip.tag { display: grid; padding: 0; border-radius: 10px; }

/* ---- auth / owner ----------------------------------------------------- */
.auth-steps { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.auth-steps span { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.auth-steps span.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.auth-steps span.done { color: var(--ok); }
.code-input { font-size: 22px; letter-spacing: 6px; text-align: center; height: 52px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.recovery-codes code { padding: 8px; border-radius: 8px; background: var(--surface-2); text-align: center; font-size: 15px; letter-spacing: 1px; }
.lead-face.initials, .face .initials, .avatar-initials {
  display: grid; place-items: center; background: var(--plan-bg); color: var(--plan); font-weight: 800; font-size: 26px;
}
.lead-face.initials { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--accent); }

/* ---- agent page -------------------------------------------------------- */
.bubbles { display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow-y: auto; padding: 4px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.6; white-space: pre-line; }
.bubble.out { align-self: flex-end; background: #1F3B33; border-top-right-radius: 4px; }  /* LTR: your messages on the right, like WhatsApp */
.bubble.in { align-self: flex-start; background: var(--surface-2); border-top-left-radius: 4px; }
.bubble .meta { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.focus-list { margin: 0; padding-inline-start: 18px; color: var(--soft); font-size: 14px; line-height: 1.8; }
.draft-box { border: 1px solid var(--accent); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #221F2E; }

/* tasks table on the agent page */
.input.small, select.input.small { height: 34px; min-height: 34px; padding: 0 8px; font-size: 13px; border-radius: 8px; min-width: 0; width: auto; }
td > form { margin: 0; }
.agent.ceo .ceo-action { margin-top: 4px; font-weight: 700; }
.agent.ceo:hover .ceo-action { filter: brightness(1.15); }
