:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: #263238;
  background: #f4f6f8;
  font-synthesis: none;
  --blue: #2fc6f6;
  --blue-dark: #119bd0;
  --ink: #263238;
  --muted: #77838f;
  --line: #dfe5e9;
  --surface: #ffffff;
  --soft: #f7f9fa;
  --danger: #e95a5a;
  --success: #36b37e;
  --shadow: 0 10px 32px rgba(25, 53, 72, .08);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f4f6f8; }
button, input, select { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; padding: 24px 28px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.brand-row { display: flex; align-items: center; gap: 14px; }
.brand-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; color: #fff; background: linear-gradient(135deg, #38d0fa, #1496d1); font-size: 25px; font-weight: 800; box-shadow: 0 8px 18px rgba(32, 175, 224, .24); }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 3px; }
h1 { margin: 0; font-size: 25px; line-height: 1.2; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.mode-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 999px; color: #755c16; background: #fff5ce; font-size: 12px; font-weight: 700; }
.mode-chip.live { color: #19714f; background: #dff8ed; }
.mode-chip.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.button { border: 0; border-radius: 8px; min-height: 38px; padding: 0 16px; font-weight: 700; font-size: 13px; cursor: pointer; transition: transform .15s, box-shadow .15s, opacity .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; }
.button.primary { color: #fff; background: linear-gradient(180deg, #39c9f4, #18a7dc); box-shadow: 0 5px 12px rgba(20, 157, 209, .2); }
.button.secondary { color: #53616c; background: #fff; border: 1px solid var(--line); }
.button.ghost { color: #687680; background: transparent; }
.button.small { min-height: 32px; padding: 0 12px; }

.tabs { display: flex; align-items: center; min-height: 52px; gap: 2px; border-radius: 12px 12px 0 0; padding: 0 14px; background: #fff; border-bottom: 1px solid var(--line); }
.tab { align-self: stretch; position: relative; border: 0; background: transparent; padding: 0 15px; color: #6e7a84; font-weight: 700; font-size: 13px; cursor: pointer; }
.tab.active { color: #1d97c5; }
.tab.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--blue); }
.counter { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 5px; padding: 0 6px; border-radius: 999px; color: #fff; background: #ef6464; font-size: 11px; }
.counter.muted { color: #60717c; background: #edf1f3; }
.tab-spacer { flex: 1; }
.period-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.period-control select { height: 32px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); padding: 0 24px 0 9px; }
.scope-control { display: inline-flex; gap: 3px; margin-right: 10px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #f5f7fa; }
.scope-button { border: 0; border-radius: 7px; padding: 7px 11px; background: transparent; color: #647183; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.scope-button:hover { color: var(--ink); }
.scope-button.active { color: #137ca4; background: #fff; box-shadow: 0 1px 4px rgba(31, 41, 55, .12); }

.queue-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; background: #fff; }
.queue-toolbar > div { display: flex; flex-direction: column; gap: 4px; }
.queue-toolbar strong { font-size: 14px; }
.queue-toolbar span { color: var(--muted); font-size: 12px; }
.search-box { display: flex; align-items: center; width: min(370px, 42vw); height: 38px; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.search-box span { font-size: 20px; color: #99a4ab; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }

.review-list, .history-list { display: grid; gap: 12px; padding: 14px; background: #edf1f3; border-radius: 0 0 12px 12px; min-height: 260px; }
.review-card { overflow: hidden; border: 1px solid #e0e6ea; border-radius: 10px; background: #fff; box-shadow: 0 2px 6px rgba(32, 55, 70, .03); }
.review-card.expanded { border-color: #b9ddea; box-shadow: var(--shadow); }
.card-summary { display: flex; width: 100%; gap: 14px; align-items: flex-start; text-align: left; padding: 16px 18px; background: #fff; border: 0; cursor: pointer; }
.type-icon { flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; font-size: 19px; }
.type-icon.email { color: #148db8; background: #ddf5fd; }
.type-icon.call { color: #5a8a31; background: #eaf6db; }
.summary-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.summary-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kind-label { color: #75828c; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.created { color: #96a0a7; font-size: 12px; font-weight: 500; }
.summary-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.communication-detail { color: #7b8790; font-size: 12px; line-height: 1.25; }
.event-context { display: flex; flex-wrap: wrap; gap: 6px; }
.employee-label, .review-reason { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 999px; font-size: 11px; line-height: 1.25; }
.employee-label { color: #334155; background: #eef2f7; }
.review-reason { color: #915900; background: #fff2cf; }
.current-binding { color: #697680; font-size: 12px; }
.current-binding > span { color: #9aa4aa; }
.status.danger { color: var(--danger); font-weight: 700; }
.expand-icon { margin-top: 9px; color: #9aa5ad; font-size: 18px; transition: transform .2s; }
.expanded .expand-icon { transform: rotate(180deg); }
.card-body { border-top: 1px solid #e7ecef; padding: 20px 22px 18px 74px; background: #fbfcfd; }
.body-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 15px; }
.body-head h3 { margin: 0 0 4px; font-size: 15px; }
.body-head p { margin: 0; color: var(--muted); font-size: 12px; }
.activity-id { color: #8c98a1; font: 600 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.candidate-list { display: grid; gap: 8px; }
.candidate { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; padding: 12px 13px; border: 1px solid #dce3e7; border-radius: 9px; background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.candidate:hover { border-color: #9fdaf0; }
.candidate:has(input:checked) { border-color: #40bce8; background: #f4fcff; box-shadow: inset 3px 0 #31b7e6; }
.candidate.current { border-style: dashed; }
.candidate input { accent-color: #1bb2e8; }
.candidate-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.candidate-title { font-size: 13px; font-weight: 700; }
.candidate-meta { color: #87929a; font-size: 11px; }
.candidate-reason { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #64737d; font-size: 11px; }
.confidence { display: inline-grid; place-items: center; min-width: 48px; height: 28px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.confidence.strong { color: #15724f; background: #dff7ec; }
.confidence.medium { color: #876715; background: #fff3c7; }
.confidence.weak { color: #7c858b; background: #edf1f3; }
.card-actions { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-top: 17px; }
.check-control { display: flex; align-items: center; gap: 8px; color: #66747d; font-size: 12px; cursor: pointer; }
.check-control input { accent-color: #24b2e4; }
.action-buttons { display: flex; gap: 8px; }

.history-list { background: #fff; }
.history-row { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 9px; }
.history-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #16885d; background: #dff7ec; font-weight: 900; }
.history-icon.undo { color: #7a6a39; background: #fff1c4; }
.history-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.history-main strong { font-size: 13px; }
.history-main span { color: var(--muted); font-size: 11px; }
.history-done { color: #9aa4ab; font-size: 11px; }

.loading-state, .empty-state { display: grid; justify-items: center; align-content: center; min-height: 390px; padding: 50px 20px; text-align: center; background: #fff; border-radius: 0 0 12px 12px; }
.loading-state h2, .empty-state h2 { margin: 18px 0 6px; font-size: 18px; }
.loading-state p, .empty-state p { margin: 0; max-width: 520px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid #dff4fb; border-top-color: #2dbce9; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 17px; color: #73818b; background: #edf2f4; font-size: 25px; font-weight: 800; }
.empty-icon.success { color: #16885d; background: #dff7ec; }
.error-state .empty-icon { color: #b43d3d; background: #ffe4e4; }
.error-state .button { margin-top: 18px; }
.empty-state.compact { min-height: 260px; }
.inline-empty { padding: 28px; border: 1px dashed #cfd9de; border-radius: 8px; text-align: center; color: var(--muted); font-size: 13px; }
.toast { position: fixed; right: 24px; bottom: 22px; z-index: 10; max-width: min(460px, calc(100vw - 48px)); padding: 13px 17px; border-radius: 9px; color: #fff; background: #263b47; box-shadow: 0 12px 35px rgba(20, 39, 50, .28); font-size: 13px; font-weight: 700; }

.install-card { width: min(560px, calc(100% - 32px)); margin: 70px auto; padding: 34px; text-align: center; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.install-mark { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 18px; color: #16885d; background: #dff7ec; font-size: 27px; font-weight: 900; }
.install-card h1 { font-size: 22px; }
.install-card > p { color: var(--muted); font-size: 13px; }
.install-details { display: grid; gap: 9px; margin-top: 24px; text-align: left; }
.install-line { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 9px; background: #f5f8f9; }
.install-line > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 900; }
.install-line.ok > span { color: #16885d; background: #dff7ec; }
.install-line.fail > span { color: #b43d3d; background: #ffe4e4; }
.install-line div { display: flex; flex-direction: column; gap: 2px; }
.install-line strong { font-size: 13px; }
.install-line small { color: var(--muted); }

@media (max-width: 760px) {
  .app-shell { padding: 16px 12px 28px; }
  .topbar, .queue-toolbar, .card-actions { align-items: stretch; flex-direction: column; }
  .top-actions { align-self: flex-start; }
  .tabs { overflow-x: auto; flex-wrap: wrap; padding-bottom: 8px; }
  .scope-control { order: 3; width: 100%; margin-right: 0; }
  .scope-button { flex: 1; }
  .period-control { display: none; }
  .search-box { width: 100%; }
  .card-body { padding: 18px; }
  .summary-topline { align-items: flex-start; flex-direction: column; gap: 2px; }
  .action-buttons { justify-content: flex-end; }
  .candidate { grid-template-columns: 18px 1fr; }
  .confidence { grid-column: 2; justify-self: start; }
}
