:root {
  --ink: #1c2430;
  --muted: #667085;
  --line: #e6e8ec;
  --bg: #f3f4f6;
  --card: #fff;
  --nav: #2a3038;
  --nav-2: #3c4450;
  --blue: #2f6fed;
  --gold: #e6b15c;
  --green: #137a4b;
  --red: #b43333;
  --yellow: #fff6d8;
  font-family: "Segoe UI", Candara, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
.muted, small, em { color: var(--muted); font-style: normal; }
.mark { font-weight: 750; letter-spacing: -0.04em; font-size: 28px; }
.mark.sm { color: #fff; font-size: 20px; margin-right: 8px; }
.gate { min-height: 100vh; display: grid; place-items: center; background: #eceff3; }
.gate-card { width: min(400px, calc(100% - 32px)); background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 16px 50px rgba(28,36,48,.12); display: grid; gap: 12px; }
.gate-card h1 { font-size: 22px; }
.top {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px;
  background: var(--nav); color: #fff; position: sticky; top: 0; z-index: 5;
}
.nav { display: flex; gap: 2px; overflow-x: auto; }
.nav-btn, .icon-btn, .who {
  background: transparent; color: #d5dbe3; border: 0; border-radius: 8px; padding: 7px 10px; white-space: nowrap;
}
.nav-btn.is-on, .nav-btn:hover, .icon-btn:hover { background: var(--nav-2); color: #fff; }
.badge { background: #e25555; color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.search { flex: 1; min-width: 120px; }
.search input, .stack input, .stack select, .stack textarea, .filters select, .panel input, .panel textarea, .composer input, .composer select, .composer textarea, label select, .side select {
  width: 100%; border: 1px solid #d5dbe3; border-radius: 8px; padding: 8px 10px; background: #fff;
}
.search input { border: 0; border-radius: 999px; }
input[type="checkbox"] { width: auto; }
.top-actions { position: relative; display: flex; align-items: center; gap: 6px; }
.who, .avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #6b4c9a; color: #fff; font-size: 12px; font-weight: 700;
}
.avatar.lg { width: 42px; height: 42px; }
.menu { position: absolute; right: 0; top: 40px; background: #fff; color: var(--ink); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.16); min-width: 160px; padding: 6px; z-index: 6; }
.add-menu { right: 42px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 8px; }
.menu button:hover { background: #f3f4f6; }
.btn { background: var(--blue); color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; white-space: nowrap; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #d5dbe3; }
.btn.gold { background: var(--gold); color: #3a2a08; }
.btn.small { padding: 6px 10px; }
.btn.wide { width: 100%; }
.layout { display: grid; grid-template-columns: 200px 300px minmax(0,1fr) 300px; height: calc(100vh - 52px); min-height: 0; }
.pane { background: var(--card); border-right: 1px solid var(--line); min-height: 0; overflow: auto; }
.pane h2, .admin-nav { margin: 0; padding: 14px 14px 8px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.folder, .conv { display: flex; width: 100%; gap: 8px; text-align: left; border: 0; background: transparent; padding: 10px 12px; }
.folder { justify-content: space-between; align-items: center; }
.folder small, .people-nav small { color: var(--muted); }
.folder.is-on, .conv.is-on { background: #eaf2ff; color: var(--blue); }
.folder.is-on small { color: inherit; }
.conv { border-bottom: 1px solid var(--line); align-items: flex-start; }
.conv-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-top time, .conv em { color: var(--muted); font-size: 13px; }
.conv em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.unread strong { font-weight: 750; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-top: 6px; flex: none; }
.thread { display: flex; flex-direction: column; padding: 0; min-height: 0; overflow: hidden; }
.side, .page { padding: 16px 18px 40px; }
.side { overflow: auto; min-height: 0; }
.kv button { justify-self: start; text-align: left; }
.thread-head { padding: 16px 18px 0; }
.thread-scroll { overflow: auto; flex: 1; min-height: 0; padding: 0 18px; }
.thread h1, .side h2 { font-size: 22px; }
.thread-head, .cal-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.row, .who-row { display: flex; justify-content: flex-start; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; justify-content: flex-start; }
.tabs, .seg { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.tabs button, .seg button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; }
.tabs button.is-on, .seg button.is-on { background: #eaf2ff; color: var(--blue); border-color: #c5d8fb; }
.mail, .panel, .deal { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.mail.email-in { border-left: 3px solid var(--blue); }
.mail.email-out { border-left: 3px solid var(--green); }
.mail.text-in, .mail.text-out { border-left: 3px solid #6b4c9a; }
.mail.call { border-left: 3px solid var(--gold); }
.mail.note, .mail.change { border-left: 3px solid #c5ccd6; }
.mail header { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; }
.mail p { white-space: pre-wrap; margin-top: 8px; }
.composer { margin-top: 0; display: grid; gap: 8px; padding: 12px 18px 16px; background: #f7f8fa; border-top: 1px solid var(--line); }
.hint { color: var(--muted); font-size: 12px; }
.side label, .stack label, .check { display: grid; gap: 4px; margin: 8px 0; font-size: 13px; }
.stack label.check, .check { display: flex; align-items: center; gap: 8px; }
.kv { display: grid; grid-template-columns: 72px 1fr; gap: 6px 8px; font-size: 14px; margin: 10px 0; }
.tags { margin: 8px 0; }
.tag { display: inline-flex; gap: 4px; align-items: center; background: #eef3f8; border-radius: 99px; padding: 2px 8px; font-size: 12px; margin: 0 4px 4px 0; }
.tag.hot { background: #fde8e8; color: var(--red); }
.tag button { border: 0; background: transparent; padding: 0; }
.pill { font-size: 12px; border-radius: 99px; padding: 2px 8px; background: #e7f6ee; color: var(--green); }
.pill.warn { background: #fff4df; color: #8a5a10; }
.pill.off { background: #f1f2f4; color: var(--muted); }
.mini { list-style: none; padding: 0; margin: 8px 0; }
.mini li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.mini.wide li { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 6px 0; }
.task-done { color: var(--muted); text-decoration: line-through; }
.due { color: var(--red); font-weight: 650; }
.linkish { border: 0; background: transparent; color: var(--blue); padding: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters select { width: auto; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 650; background: #fafbfc; }
tr.click:hover { background: #f6fafd; cursor: pointer; }
.watch { margin-top: auto; padding: 14px; display: grid; gap: 4px; font-size: 13px; border-top: 1px solid var(--line); }
.pane { display: flex; flex-direction: column; }
.list { overflow: auto; flex: 1; }
.board { display: flex; gap: 10px; overflow-x: auto; padding: 12px; min-height: calc(100vh - 52px); }
.col { min-width: 180px; flex: 1; background: #e9edf2; border-radius: 12px; padding: 8px; }
.col h2 { font-size: 13px; margin-bottom: 8px; border-top: 3px solid var(--blue); padding-top: 6px; }
.col:nth-child(2) h2 { border-top-color: #d97706; }
.col:nth-child(3) h2 { border-top-color: #7c3aed; }
.col:nth-child(4) h2 { border-top-color: #0891b2; }
.col:nth-child(5) h2 { border-top-color: #137a4b; }
.col:nth-child(6) h2 { border-top-color: #b43333; }
.col:nth-child(7) h2 { border-top-color: #667085; }
.deal { cursor: grab; }
.cal-head { margin-bottom: 10px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week span { font-size: 12px; color: var(--muted); padding: 4px; }
.cal-day { min-height: 84px; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px; display: grid; align-content: start; gap: 2px; }
.cal-day em { font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-day.mute { background: transparent; border-color: transparent; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.stats div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; }
.stats b { font-size: 28px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 28px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.bar { height: 8px; background: #eef2f6; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); }
.admin, .people { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: calc(100vh - 52px); }
.people-nav { background: #fff; border-right: 1px solid var(--line); padding: 8px; }
.people-nav h2 { margin: 0; padding: 10px 8px 6px; }
.people-nav button { display: flex; justify-content: space-between; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 8px; }
.people-nav button.is-on { background: #eaf2ff; color: var(--blue); }
.admin-nav { background: #fff; border-right: 1px solid var(--line); padding: 12px; }
.admin-nav button { display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 8px; }
.admin-nav button.is-on { background: #eaf2ff; color: var(--blue); }
.step { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.stack { display: grid; gap: 8px; }
.stack.inline, .row { display: flex; gap: 8px; align-items: center; }
.flow { display: flex; flex-wrap: wrap; gap: 8px; }
.modal { position: fixed; inset: 0; background: rgba(20,24,30,.45); display: grid; place-items: center; z-index: 20; }
.dialog { width: min(480px, calc(100% - 24px)); background: #fff; border-radius: 14px; padding: 18px; }
.dialog h2 { margin-bottom: 10px; }
.clock { font-size: 32px; font-variant-numeric: tabular-nums; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: #1c2430; color: #fff; border-radius: 999px; padding: 10px 16px; z-index: 30; }
.empty { padding: 20px; color: var(--muted); }
@media (max-width: 1100px) {
  .layout, .admin, .people, .split, .stats { grid-template-columns: 1fr; height: auto; }
  .layout { height: auto; }
  .thread { height: auto; overflow: visible; }
  .thread-scroll { overflow: visible; }
  .side { border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .top { height: auto; flex-wrap: wrap; padding: 8px 10px; row-gap: 6px; }
  .nav { order: 3; flex: 1 0 100%; }
  .mark.sm { display: none; }
  th:nth-child(n+5), td:nth-child(n+5) { display: none; }
  .cal-day { min-height: 48px; }
  .cal-day em { display: none; }
  .thread-head { align-items: flex-start; }
}
