:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  color: #17201d;
  background: #f3f5f4;
  --bg: #f3f5f4;
  --panel: #ffffff;
  --panel-muted: #f8faf9;
  --ink: #17201d;
  --muted: #68736f;
  --line: #dce2df;
  --line-strong: #c7d0cc;
  --green: #187153;
  --green-soft: #e7f3ed;
  --blue: #2c6689;
  --blue-soft: #eaf2f7;
  --amber: #a86b0c;
  --amber-soft: #fff4da;
  --red: #b53c3c;
  --red-soft: #fdecec;
  --dark: #16201d;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 14px; display: flex; flex-direction: column; background: var(--dark); color: #eef4f1; }
.brand { display: flex; align-items: center; gap: 11px; min-height: 48px; padding: 0 8px 16px; border-bottom: 1px solid #30403a; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; background: #e8f3ee; color: #185f48; font-weight: 800; font-size: 17px; }
.brand-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-copy strong { font-size: 15px; }
.brand-copy small { color: #9fb0aa; font-size: 11px; }
.side-nav { flex: 1 1 auto; min-height: 0; margin-top: 14px; overflow-y: auto; }
.nav-group + .nav-group { margin-top: 3px; }
.nav-group-toggle { width: 100%; min-height: 36px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 5px; background: transparent; color: #91a39c; text-align: left; font-size: 12px; font-weight: 750; }
.nav-group-toggle:hover { background: #1d2a26; color: #dfe8e4; }
.nav-group.has-active > .nav-group-toggle { color: #fff; }
.nav-chevron { width: 7px; height: 7px; margin-right: 3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .16s ease; }
.nav-group-toggle[aria-expanded="true"] .nav-chevron { transform: rotate(45deg); }
.nav-group-items { display: grid; gap: 3px; margin: 1px 0 4px; padding-left: 8px; }
.nav-group-items[hidden] { display: none; }
.nav-item { width: 100%; min-height: 36px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 5px; background: transparent; color: #bcc9c4; text-align: left; }
.nav-item:hover { background: #23312c; color: #fff; }
.nav-item.active { background: #e8f3ee; color: #185f48; font-weight: 700; }
.nav-count { min-width: 22px; padding: 2px 6px; border-radius: 10px; background: #344740; color: #dce7e3; font-size: 11px; text-align: center; }
.nav-item.active .nav-count { background: #cde5da; color: #15563f; }
.nav-count.danger { background: #713536; color: #ffe9e9; }
.sidebar-session { margin-top: auto; display: grid; gap: 4px; }
.sidebar-logout { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid #3a4b45; border-radius: 5px; background: transparent; color: #d6e0dc; text-align: left; }
.sidebar-logout:hover { background: #23312c; border-color: #52645d; color: #fff; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 8px 8px 2px; color: #9fb0aa; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #86928e; flex: 0 0 auto; }
.status-dot.online { background: #45b585; box-shadow: 0 0 0 3px rgba(69, 181, 133, .13); }
.status-dot.attention { background: #d89a30; }
.status-dot.error, .status-dot.stopped { background: #d45a5a; }
.status-dot.critical { background: #a83232; }
.status-dot.warning { background: #d89a30; }
.status-dot.info { background: #4381a8; }

.main-area { min-width: 0; padding: 0 30px 42px; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.topbar p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; gap: 8px; }
.button { min-height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: 5px; background: var(--panel); color: var(--ink); font-weight: 650; }
.button.compact { min-height: 32px; padding: 0 11px; font-size: 12px; }
.button.primary { background: var(--green); color: white; border-color: var(--green); }
.button.primary:hover { background: #125e45; }
.button.secondary { background: var(--panel); border-color: var(--line-strong); }
.button.secondary:hover { background: var(--panel-muted); border-color: #aebbb6; }
.button.danger { background: var(--red); color: white; border-color: var(--red); }
.button.danger:hover { background: #963232; }
.button.light { background: white; color: var(--red); }
.text-button { border: 0; background: transparent; color: var(--green); font-weight: 700; padding: 4px 0; }
.icon-button { width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; border-radius: 5px; }
.icon-button:hover { background: var(--panel-muted); color: var(--ink); }

.stop-banner { margin: 16px 0 0; min-height: 54px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--red); color: white; border-radius: 6px; }
.stop-banner div { display: flex; flex-direction: column; gap: 3px; }
.stop-banner span { font-size: 12px; color: #ffe0e0; }
.hidden { display: none !important; }
.view { display: none; padding-top: 24px; }
.view.active { display: block; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { min-height: 104px; padding: 17px 18px; display: flex; flex-direction: column; justify-content: space-between; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { font-size: 28px; line-height: 1; }
.stat-card small { color: var(--muted); }
.stat-card.warning strong { color: var(--amber); }
.stat-card.danger strong { color: var(--red); }

.section-block { margin-top: 26px; }
.section-heading { min-height: 42px; margin-bottom: 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-heading h2 { margin: 0; font-size: 16px; line-height: 1.3; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.account-strip { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 10px; }
.account-card { min-height: 126px; padding: 15px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.account-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.account-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.device-glyph { width: 28px; height: 38px; display: grid; place-items: center; border: 2px solid #73817c; border-radius: 5px; color: #73817c; font-size: 10px; flex: 0 0 auto; }
.account-name strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-name small { display: block; margin-top: 2px; color: var(--muted); }
.account-meta { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; font-size: 12px; }
.account-meta span { color: var(--muted); }
.account-meta strong { display: block; margin-top: 2px; color: var(--ink); font-size: 12px; }
.status-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 26px; align-items: start; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { height: 42px; padding: 0 14px; background: var(--panel-muted); color: var(--muted); font-size: 11px; font-weight: 700; text-align: left; border-bottom: 1px solid var(--line); }
td { min-height: 54px; padding: 12px 14px; border-bottom: 1px solid #e8ecea; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfb; }
.compact-table th:nth-child(1) { width: 44%; }
.compact-table th:nth-child(2) { width: 24%; }
.compact-table th:nth-child(3) { width: 20%; }
.task-summary { min-width: 0; }
.task-summary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-summary small { display: block; margin-top: 4px; color: var(--muted); }
.row-action { border: 0; background: transparent; color: var(--green); font-weight: 700; padding: 4px; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 7px; border-radius: 4px; background: #edf1ef; color: #50605a; font-size: 11px; font-weight: 800; }
.badge.p0 { background: var(--red-soft); color: var(--red); }
.badge.p1 { background: var(--amber-soft); color: var(--amber); }
.badge.p2 { background: var(--blue-soft); color: var(--blue); }
.badge.online, .badge.success { background: var(--green-soft); color: var(--green); }
.badge.attention, .badge.failed, .badge.manual { background: var(--red-soft); color: var(--red); }
.badge.pending_review { background: var(--amber-soft); color: var(--amber); }
.badge.queued, .badge.running, .badge.processing { background: var(--blue-soft); color: var(--blue); }
.badge.rejected, .badge.cancelled, .badge.resolved, .badge.closed { background: #edf1ef; color: #65716c; }
.badge.pending_approval, .badge.major, .badge.supervisor { background: var(--amber-soft); color: var(--amber); }
.badge.approved, .badge.active, .badge.admin, .badge.healthy { background: var(--green-soft); color: var(--green); }
.badge.testing, .badge.sending { background: var(--blue-soft); color: var(--blue); }
.badge.test_completed, .badge.completed { background: var(--green-soft); color: var(--green); }
.badge.test_failed, .badge.partial { background: var(--red-soft); color: var(--red); }
.badge.critical, .badge.disabled, .badge.paused { background: var(--red-soft); color: var(--red); }
.badge.warning, .badge.maintenance { background: var(--amber-soft); color: var(--amber); }
.badge.operator { background: var(--blue-soft); color: var(--blue); }
.badge.viewer { background: #edf1ef; color: #58645f; }

.ticket-list { display: grid; gap: 8px; }
.ticket-item { width: 100%; min-height: 76px; padding: 12px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); text-align: left; }
.ticket-item:hover { border-color: var(--line-strong); }
.ticket-item strong { display: block; }
.ticket-item p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.ticket-item small { display: block; margin-top: 6px; color: var(--muted); }
.audit-list { background: var(--panel); border-top: 1px solid var(--line); }
.audit-row { min-height: 42px; display: grid; grid-template-columns: 110px minmax(0, 1fr) 100px; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.audit-row time, .audit-row span:last-child { color: var(--muted); }

.toolbar { min-height: 46px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.segmented { display: inline-flex; min-height: 36px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel); }
.segmented button { min-width: 76px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); }
.segmented button.active { background: var(--dark); color: white; font-weight: 700; }
select, input, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 5px; background: white; color: var(--ink); outline: none; }
select, input { height: 36px; padding: 0 10px; }
textarea { padding: 9px 10px; resize: vertical; line-height: 1.5; }
select:focus, input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(24, 113, 83, .1); }
#task-type-filter { width: 140px; }
.task-table-wrap th:nth-child(1) { width: 42px; }
.task-table-wrap th:nth-child(2) { width: 72px; }
.task-table-wrap th:nth-child(3) { width: 29%; }
.task-table-wrap th:nth-child(4) { width: 17%; }
.task-table-wrap th:nth-child(5) { width: 14%; }
.task-table-wrap th:nth-child(6) { width: 110px; }
.task-table-wrap th:nth-child(7) { width: 140px; }
.review-select-column, .task-review-check { text-align: center; }
.task-review-check, .bulk-review-bar input { width: 16px; height: 16px; }
.bulk-review-bar { min-height: 52px; margin-bottom: 10px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.bulk-review-bar > label, .bulk-review-bar > div { display: flex; align-items: center; gap: 8px; }
.bulk-review-bar > label { color: var(--muted); font-size: 12px; }

.ticket-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ticket-card { min-height: 160px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 6px; }
.ticket-card.urgent { border-left-color: var(--red); }
.ticket-card-head { display: flex; justify-content: space-between; gap: 12px; }
.ticket-card h3 { margin: 13px 0 0; font-size: 15px; }
.ticket-card p { min-height: 40px; margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
.ticket-card-footer { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }

.accounts-heading { margin-bottom: 16px; }
.heading-actions { display: flex; gap: 8px; }
.gateway-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.gateway-card { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.gateway-head { min-height: 64px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.gateway-head div { min-width: 0; }
.gateway-head strong, .gateway-head span { display: block; overflow-wrap: anywhere; }
.gateway-head span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.gateway-meta { min-height: 38px; padding: 8px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; background: var(--panel-muted); color: var(--muted); font-size: 11px; }
.gateway-devices { padding: 0 16px; }
.gateway-device-row { min-height: 72px; display: grid; grid-template-columns: minmax(130px, 1.2fr) minmax(86px, .75fr) minmax(100px, .85fr) auto auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.gateway-device-row:last-child { border-bottom: 0; }
.gateway-device-row div { min-width: 0; }
.gateway-device-row strong, .gateway-device-row small { display: block; overflow-wrap: anywhere; }
.gateway-device-row small { margin-top: 3px; color: var(--muted); }
.gateway-device-row > span:not(.status-label) { color: var(--muted); }
.device-binding { padding: 4px 7px; border-radius: 4px; background: var(--green-soft); color: var(--green) !important; font-weight: 700; text-align: center; }
.gateway-empty { min-height: 76px; display: grid; place-items: center; color: var(--muted); }
.account-list-heading { margin-top: 28px; }
.device-probe-panel { margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.probe-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.probe-header strong { font-size: 14px; }
.probe-header span { color: var(--muted); font-size: 12px; }
.probe-list { display: grid; gap: 8px; margin-top: 12px; }
.probe-device { min-height: 66px; padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(90px, .7fr)) auto; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.probe-device:first-child { border-top: 0; }
.probe-device strong, .probe-device span { overflow-wrap: anywhere; }
.probe-device small { display: block; margin-top: 3px; color: var(--muted); }
.probe-registered { min-width: 108px; padding: 6px 9px; border-radius: 4px; background: var(--green-soft); color: var(--green); text-align: center; }
.probe-registered strong, .probe-registered small { display: block; }
.probe-registered small { color: inherit; font-size: 10px; }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.account-detail { min-height: 220px; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.account-detail .account-card-head { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.detail-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.detail-grid span { color: var(--muted); font-size: 11px; }
.detail-grid strong { display: block; margin-top: 4px; font-size: 13px; overflow-wrap: anywhere; }
.account-warning { margin-top: 14px; padding: 9px 10px; border-radius: 5px; background: var(--amber-soft); color: #79500d; font-size: 12px; }
.account-warning strong, .account-warning span { display: block; }
.account-warning span { margin-top: 3px; }
.account-manual { margin-top: 14px; padding: 9px 10px; border-left: 3px solid var(--blue); background: var(--blue-soft); color: #244d65; font-size: 12px; }
.account-manual.waiting { border-left-color: var(--amber); background: var(--amber-soft); color: #79500d; }
.account-manual strong, .account-manual span { display: block; }
.account-manual span { margin-top: 3px; }
.account-control { margin-top: 14px; display: flex; justify-content: flex-end; gap: 8px; }
.account-mode-control { margin-top: 14px; padding-top: 14px; display: grid; grid-template-columns: minmax(100px, 1fr) minmax(150px, 210px); align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.account-mode-control span { color: var(--muted); font-size: 12px; }

.customer-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 190px 150px auto auto; }
.customer-toolbar input[type="search"] { min-width: 0; }
.filter-check { min-height: 36px; padding: 0 10px; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.filter-check input, .customer-flags input { width: 16px; height: 16px; }
.customer-heading { margin-top: 18px; }
.customer-table-wrap th:nth-child(1) { width: 42px; }
.customer-table-wrap th:nth-child(2) { width: 20%; }
.customer-table-wrap th:nth-child(3) { width: 18%; }
.customer-table-wrap th:nth-child(4) { width: 72px; }
.customer-table-wrap th:nth-child(5) { width: 22%; }
.customer-table-wrap th:nth-child(6) { width: 120px; }
.customer-table-wrap th:nth-child(7) { width: 80px; }
.customer-check { width: 16px; height: 16px; }
.customer-tag-cell { display: grid; justify-items: start; gap: 5px; }
.customer-tag-change { padding: 2px 0; font-size: 11px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-list span { padding: 3px 6px; border-radius: 4px; background: var(--blue-soft); color: var(--blue); font-size: 10px; white-space: nowrap; }
.customer-flags { margin-top: 15px; display: flex; gap: 22px; }
.customer-flags label { display: flex; align-items: center; gap: 7px; }

.lead-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.lead-summary article { min-height: 78px; padding: 13px 15px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.lead-summary span { color: var(--muted); font-size: 12px; }
.lead-summary strong { font-size: 23px; }
.lead-toolbar { display: grid; grid-template-columns: minmax(180px, 1fr) 150px 190px repeat(4, auto); }
.lead-table-wrap th:nth-child(1) { width: 42px; }
.lead-table-wrap th:nth-child(2) { width: 130px; }
.lead-table-wrap th:nth-child(3) { width: 19%; }
.lead-table-wrap th:nth-child(4) { width: 18%; }
.lead-table-wrap th:nth-child(5) { width: 19%; }
.lead-table-wrap th:nth-child(6) { width: 100px; }
.lead-table-wrap th:nth-child(7) { width: 110px; }
.lead-table-wrap td strong, .lead-table-wrap td small { display: block; }
.lead-table-wrap td small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.lead-check { width: 16px; height: 16px; }
.lead-release { white-space: nowrap; }
.import-result { margin-top: 14px; padding: 12px; border-left: 3px solid var(--green); background: var(--green-soft); color: #135640; }
.import-result strong, .import-result span { display: block; }
.import-result span { margin-top: 5px; font-size: 11px; }
.lead-template-list { max-height: 210px; margin-top: 14px; overflow-y: auto; border-top: 1px solid var(--line); }
.lead-template-list article { min-height: 62px; padding: 9px 2px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.lead-template-list article div { min-width: 0; }
.lead-template-list strong, .lead-template-list small { display: block; overflow-wrap: anywhere; }
.lead-template-list small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.identity-review-item { align-items: flex-end !important; }
.identity-review-item > div:first-child { flex: 1; }
.identity-review-item .field { margin-top: 10px; }
.identity-review-item .heading-actions { flex: 0 0 auto; }
#lead-identity-review-dialog { width: min(760px, calc(100vw - 28px)); }
#lead-identity-review-dialog .dialog-card { width: auto; max-height: calc(100vh - 28px); overflow-y: auto; }
#lead-identity-review-dialog .lead-template-list { max-height: min(520px, calc(100vh - 150px)); }
.policy-usage { min-height: 58px; margin-top: 14px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-muted); }
.policy-usage strong, .policy-usage span { display: block; }
.policy-usage span { color: var(--muted); font-size: 11px; }
.time-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.policy-stops { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 10px 20px; }
.policy-stops label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.policy-stops input { width: 16px; height: 16px; }
.customer-360-dialog { width: min(1080px, calc(100vw - 28px)); }
.customer-360-card { height: min(860px, calc(100vh - 40px)); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.customer-360-header { flex: 0 0 auto; padding: 18px 20px 14px; }
.customer-360-alert { flex: 0 0 auto; min-height: 40px; padding: 10px 20px; border-bottom: 1px solid #f2caca; background: var(--red-soft); color: var(--red); font-size: 12px; }
.customer-360-alert.warning { border-color: #ecd59d; background: var(--amber-soft); color: #79500d; }
.customer-360-metrics { flex: 0 0 auto; padding: 12px 20px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; border-bottom: 1px solid var(--line); background: var(--panel-muted); }
.customer-360-metrics article { min-height: 68px; padding: 9px 11px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; border-left: 3px solid var(--green); background: var(--panel); }
.customer-360-metrics span, .customer-360-metrics small { color: var(--muted); font-size: 10px; }
.customer-360-metrics strong { grid-row: 1 / 3; grid-column: 2; font-size: 22px; }
.customer-360-layout { min-height: 0; flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .8fr); }
.customer-timeline-panel { min-width: 0; min-height: 0; padding: 18px 20px; overflow-y: auto; }
.customer-followup-panel { min-width: 0; min-height: 0; padding: 18px; overflow-y: auto; border-left: 1px solid var(--line); background: var(--panel-muted); }
.customer-followup-panel > section + section { margin-top: 24px; }
.customer-panel-heading { min-height: 38px; margin-bottom: 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.customer-panel-heading h3 { margin: 0; font-size: 14px; }
.customer-panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.customer-panel-heading select { width: 150px; }
.customer-profile-list { margin: 0; border-top: 1px solid var(--line); }
.customer-profile-list > div { min-height: 38px; padding: 7px 0; display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 10px; border-bottom: 1px solid var(--line); }
.customer-profile-list dt { color: var(--muted); font-size: 11px; }
.customer-profile-list dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.customer-360-tags { margin-top: 10px; }
.customer-followup-list { display: grid; gap: 8px; }
.customer-followup-item { padding: 10px 11px; border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 5px; background: var(--panel); }
.customer-followup-item.completed, .customer-followup-item.cancelled { border-left-color: var(--line-strong); opacity: .72; }
.customer-followup-item > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.customer-followup-item time, .customer-followup-item small { color: var(--muted); font-size: 10px; }
.customer-followup-item strong { display: block; margin-top: 8px; }
.customer-followup-item p { margin: 5px 0; color: var(--muted); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.followup-actions { margin-top: 8px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.customer-followup-form { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-strong); }
.customer-followup-form .dialog-actions { margin-top: 12px; }
.customer-followup-form .button { width: 100%; }
.customer-timeline { position: relative; }
.customer-timeline::before { content: ""; position: absolute; top: 10px; bottom: 10px; left: 7px; width: 1px; background: var(--line); }
.customer-timeline-item { position: relative; min-height: 84px; padding: 0 0 18px 30px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px; }
.timeline-marker { position: absolute; z-index: 1; top: 7px; left: 2px; width: 11px; height: 11px; border: 2px solid var(--panel); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.customer-timeline-item.message_in .timeline-marker { background: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.customer-timeline-item.ticket .timeline-marker { background: var(--red); box-shadow: 0 0 0 1px var(--red); }
.customer-timeline-item.followup .timeline-marker { background: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.customer-timeline-item header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.customer-timeline-item header strong { color: var(--muted); font-size: 10px; }
.customer-timeline-item time { color: var(--muted); font-size: 10px; }
.customer-timeline-item h4 { margin: 6px 0 0; font-size: 13px; }
.customer-timeline-item p { margin: 5px 0 0; color: #4f5d58; line-height: 1.5; overflow-wrap: anywhere; }
.customer-360-empty { min-height: 90px; display: grid; place-items: center; color: var(--muted); font-size: 11px; }

.heading-actions { display: flex; align-items: center; gap: 8px; }
.health-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.health-summary article { min-height: 84px; padding: 14px 16px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.health-summary span { color: var(--muted); font-size: 12px; }
.health-summary strong { font-size: 24px; }
.error-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.error-summary article { min-height: 76px; padding: 13px 15px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.error-summary span { color: var(--muted); font-size: 12px; }
.error-summary strong { font-size: 22px; }
.error-toolbar { display: grid; grid-template-columns: repeat(4, minmax(130px, .65fr)) minmax(190px, 1fr); }
.error-table-wrap th:nth-child(1) { width: 105px; }
.error-table-wrap th:nth-child(2) { width: 76px; }
.error-table-wrap th:nth-child(3) { width: 17%; }
.error-table-wrap th:nth-child(4) { width: 25%; }
.error-table-wrap th:nth-child(5) { width: 20%; }
.error-table-wrap th:nth-child(6) { width: 90px; }
.error-table-wrap th:nth-child(7) { width: 64px; }
.trace-link { max-width: 100%; padding: 3px 0; overflow: hidden; border: 0; background: transparent; color: var(--blue); text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.error-dialog { width: min(760px, calc(100vw - 28px)); }
.error-context-section, .error-timeline-section { margin-top: 18px; }
.error-context-section h3, .error-timeline-section h3 { margin: 0 0 9px; font-size: 13px; }
.error-context { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.error-context div { min-height: 42px; padding: 7px 0; display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.error-context div:nth-child(odd) { padding-right: 12px; }
.error-context span, .error-timeline small { color: var(--muted); font-size: 11px; }
.error-context strong { overflow-wrap: anywhere; font-size: 12px; }
.error-timeline { max-height: 220px; overflow-y: auto; border-top: 1px solid var(--line); }
.error-timeline-row { min-height: 52px; display: grid; grid-template-columns: 105px 10px minmax(0, 1fr); align-items: center; gap: 9px; border-bottom: 1px solid var(--line); }
.error-timeline-row time { color: var(--muted); font-size: 11px; }
.error-timeline-row strong, .error-timeline-row small { display: block; }
.error-timeline-row small { margin-top: 3px; }
.activity-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.activity-summary article { min-height: 84px; padding: 14px 16px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.activity-summary span { color: var(--muted); font-size: 12px; }
.activity-summary strong { font-size: 24px; }
.ai-model-center { display: grid; gap: 14px; }
.ai-model-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ai-model-summary article { min-height: 76px; padding: 12px 14px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.ai-model-summary span { color: var(--muted); font-size: 12px; }
.ai-model-summary strong { font-size: 22px; }
.ai-model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ai-model-card { min-width: 0; padding: 14px; display: grid; gap: 12px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 6px; background: var(--panel); }
.ai-model-card.disabled { border-left-color: var(--line-strong); }
.ai-model-card-header, .ai-model-card-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ai-model-card h3 { margin: 0; font-size: 15px; }
.ai-model-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ai-model-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.ai-capability { padding: 3px 7px; border-radius: 4px; background: var(--blue-soft); color: #244d65; font-size: 11px; }
.ai-model-card-footer { align-items: center; padding-top: 10px; border-top: 1px solid var(--line); }
.ai-model-test-state { min-width: 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.ai-model-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.ai-model-dialog { width: min(660px, calc(100vw - 28px)); }
.ai-capability-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rule-strip { min-height: 48px; margin-top: 12px; padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-muted); font-size: 12px; }
.rule-strip span { color: var(--muted); }
.activity-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 24px; align-items: start; }
.activity-table-wrap th:nth-child(1) { width: 18%; }
.activity-table-wrap th:nth-child(2) { width: 20%; }
.activity-table-wrap th:nth-child(3) { width: 30%; }
.activity-table-wrap th:nth-child(4) { width: 86px; }
.activity-table-wrap th:nth-child(5) { width: 120px; }
.activity-table-wrap th:nth-child(6) { width: 62px; }
.moment-digest { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-type-notice { display: grid; gap: 4px; padding: 10px 12px; border-left: 3px solid var(--warning, #b7791f); background: #fff8e8; }
.message-type-notice span { color: var(--muted); font-size: 13px; }
.incident-section { margin: 18px 0 22px; }
.incident-section .section-heading { margin-bottom: 10px; }
.incident-section table { min-width: 760px; }
.incident-dialog { width: min(760px, calc(100vw - 28px)); }
.incident-dialog .dialog-card { max-height: calc(100vh - 28px); overflow-y: auto; }
.risk-list { display: grid; gap: 8px; }
.risk-row { min-height: 72px; padding: 11px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 6px; background: var(--panel); }
.risk-row.yellow { border-left-color: var(--amber); }
.risk-row.red { border-left-color: var(--red); }
.risk-row strong, .risk-row small { display: block; overflow-wrap: anywhere; }
.risk-row small, .risk-row time { margin-top: 4px; color: var(--muted); font-size: 11px; }
.risk-row time { grid-column: 1 / -1; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.yellow { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.action-table-wrap th:nth-child(1), .action-table-wrap th:nth-child(4) { width: 110px; }
.action-table-wrap th:nth-child(5) { width: 140px; }
.moment-dialog { width: min(680px, calc(100vw - 28px)); }
.moment-detail-summary { margin-top: 16px; padding: 13px 14px; border-left: 3px solid var(--blue); background: var(--blue-soft); }
.moment-detail-summary strong, .moment-detail-summary small { display: block; }
.moment-detail-summary p { margin: 6px 0; line-height: 1.55; overflow-wrap: anywhere; }
.moment-detail-summary small { color: var(--muted); }
.generation-note { min-height: 48px; margin: 14px 0 10px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 5px; }
.generation-note strong, .generation-note span { font-size: 12px; }
.generation-note span { color: var(--muted); text-align: right; }
.moment-candidate-list .candidate-option label { justify-content: space-between; gap: 12px; }
.moment-candidate-list .candidate-option label span { overflow-wrap: anywhere; }
.moment-candidate-list .candidate-option label small { flex: 0 0 auto; color: var(--muted); }
.ai-action-row { display: flex; justify-content: flex-end; }
.field-hint { color: var(--muted); font-size: 11px; text-align: right; }
.ai-media-prompt-hint { text-align: left; }
.health-list { margin-top: 18px; display: grid; gap: 8px; }
.health-row { min-height: 68px; padding: 12px 14px; display: grid; grid-template-columns: minmax(180px, 1fr) 90px minmax(220px, 1fr) 100px; align-items: center; gap: 12px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 6px; background: var(--panel); }
.health-row.warning, .health-row.maintenance { border-left-color: var(--amber); }
.health-row.critical { border-left-color: var(--red); }
.health-row strong, .health-row small { display: block; }
.health-row small, .health-row span, .health-row time { margin-top: 3px; color: var(--muted); font-size: 12px; }

.content-toolbar { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calendar-arrow { width: 34px; height: 34px; font-size: 24px; }
.content-mix-summary { margin-top: 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.content-mix-summary article { min-height: 76px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.content-mix-summary article span, .content-mix-summary article small { color: var(--muted); font-size: 11px; }
.content-mix-summary article strong { grid-row: 1 / 3; grid-column: 2; font-size: 24px; }
.content-unscheduled { margin-top: 20px; }
.unscheduled-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.content-calendar-grid { margin-top: 22px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.calendar-day { min-width: 0; min-height: 300px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); }
.calendar-day > header { min-height: 52px; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--panel-muted); }
.calendar-day > header span { color: var(--muted); font-size: 11px; }
.calendar-day > header strong { font-size: 18px; }
.calendar-day.today > header { box-shadow: inset 0 3px var(--green); }
.calendar-context { min-height: 92px; padding: 10px; display: grid; align-content: start; gap: 5px; border-bottom: 1px solid var(--line); background: #f8faf8; }
.calendar-context strong { color: var(--green); font-size: 12px; }
.calendar-context span { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.calendar-day > div { padding: 7px; display: grid; gap: 7px; }
.calendar-empty { padding: 12px 3px; color: var(--muted); font-size: 11px; text-align: center; }
.content-draft-item { width: 100%; min-width: 0; min-height: 88px; padding: 9px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 6px; border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 5px; background: white; color: var(--ink); text-align: left; }
.content-draft-item.professional { border-left-color: var(--blue); }
.content-draft-item.product { border-left-color: var(--amber); }
.content-draft-item.customer_story { border-left-color: #7a5b9d; }
.content-draft-item strong, .content-draft-item small { display: block; overflow: hidden; text-overflow: ellipsis; }
.content-draft-item strong { line-height: 1.4; }
.content-draft-item small, .content-draft-item time { margin-top: 4px; color: var(--muted); font-size: 10px; }
.content-draft-item time { grid-column: 1 / -1; }
.content-draft-dialog { width: min(760px, calc(100vw - 28px)); overflow: hidden; }
.content-draft-dialog .dialog-card { max-height: calc(100vh - 28px); overflow-y: auto; scrollbar-gutter: stable; }
.content-draft-primary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.draft-editor-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.draft-section-heading { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.draft-section-heading > strong, .draft-section-heading > div > strong, .draft-section-heading > div > small { display: block; }
.draft-section-heading > div > small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.compact-segmented { min-height: 34px; }
.compact-segmented button { min-width: 84px; }
.ai-compose-panel { margin-top: 12px; padding: 12px 14px 14px; display: grid; gap: 12px; border-left: 3px solid var(--green); background: var(--panel-muted); }
.ai-compose-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ai-compose-heading strong, .ai-compose-heading small { display: block; }
.ai-compose-heading small { margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ai-prompt-grid { margin: 0; }
.ai-candidate-list { display: grid; gap: 8px; }
.ai-candidate { width: 100%; padding: 11px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); text-align: left; cursor: pointer; }
.ai-candidate:hover { border-color: var(--accent); }
.ai-candidate strong, .ai-candidate span { min-width: 0; overflow-wrap: anywhere; }
.ai-candidate span { grid-column: 1; color: var(--muted); font-size: 12px; line-height: 1.6; }
.ai-candidate small { grid-column: 2; grid-row: 1 / span 2; color: var(--accent); white-space: nowrap; }
.content-copy-field { margin-top: 12px; }
.draft-media-actions { display: flex; gap: 8px; }
.draft-media-list { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.draft-media-empty { min-height: 72px; padding: 16px; display: grid; place-items: center; grid-column: 1 / -1; border: 1px dashed var(--line-strong); border-radius: 5px; color: var(--muted); font-size: 12px; text-align: center; }
.draft-media-item { min-width: 0; min-height: 68px; padding: 7px; display: grid; grid-template-columns: 68px minmax(0, 1fr) 30px; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.draft-media-preview { width: 68px; height: 52px; overflow: hidden; display: grid; place-items: center; border-radius: 4px; background: var(--panel-muted); color: var(--muted); font-size: 11px; }
.draft-media-preview img, .draft-media-preview video { width: 100%; height: 100%; display: block; object-fit: cover; }
.draft-media-item strong, .draft-media-item small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-media-item small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.draft-media-remove { width: 30px; height: 30px; }
#content-draft-form.automatic-daily-view .compact-segmented,
#content-draft-form.automatic-daily-view #content-media-picker-btn,
#content-draft-form.automatic-daily-view .draft-media-remove { display: none; }
.content-media-picker-dialog { width: min(860px, calc(100vw - 28px)); }
.content-media-picker-dialog .dialog-card { max-height: calc(100vh - 28px); display: flex; flex-direction: column; overflow: hidden; }
.content-media-picker-toolbar { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(220px, 1.3fr); gap: 0 14px; }
.content-media-picker-grid { min-height: 260px; max-height: 52vh; margin-top: 14px; padding: 1px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 8px; overflow-y: auto; }
.content-media-picker-item { position: relative; min-width: 0; padding: 7px; display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); text-align: left; }
.content-media-picker-item:hover { border-color: var(--line-strong); }
.content-media-picker-item.selected { border-color: var(--green); background: var(--green-soft); }
.content-media-picker-preview { width: 76px; height: 60px; overflow: hidden; display: grid; place-items: center; border-radius: 4px; background: #eef1ef; color: var(--muted); }
.content-media-picker-preview img, .content-media-picker-preview video { width: 100%; height: 100%; display: block; object-fit: cover; }
.content-media-picker-name strong, .content-media-picker-name small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-media-picker-name small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.content-media-picker-check { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: white; color: white; font-size: 12px; font-weight: 700; }
.content-media-picker-item.selected .content-media-picker-check { border-color: var(--green); background: var(--green); }
.content-issues { margin-top: 12px; padding: 10px 12px; display: grid; gap: 4px; border-left: 3px solid var(--red); background: var(--red-soft); color: var(--red); font-size: 12px; }
.member-table th:nth-child(1) { width: 28%; }
.member-table th:nth-child(2) { width: 18%; }
.member-table th:nth-child(3) { width: 24%; }
.member-table th:nth-child(4) { width: 15%; }
.scope-field { margin: 16px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 5px; }
.scope-field legend { padding: 0 5px; color: var(--muted); font-size: 12px; font-weight: 650; }
.scope-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.scope-options label { min-height: 36px; display: flex; align-items: center; gap: 8px; }
.scope-options input { width: 16px; height: 16px; }
.scope-options span { overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.auth-dialog { width: min(430px, calc(100vw - 28px)); }

.dialog { width: min(620px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 7px; box-shadow: 0 24px 70px rgba(16, 25, 22, .24); }
.dialog::backdrop { background: rgba(15, 22, 20, .45); }
.dialog-card { padding: 20px; }
#lead-bulk-dialog .dialog-card,
#customer-dialog .dialog-card,
#customer-tags-dialog .dialog-card { max-height: calc(100vh - 28px); overflow-y: auto; scrollbar-gutter: stable; }
.dialog-header { min-height: 42px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.dialog-header div > h2 { display: inline-block; margin: 0 0 0 8px; font-size: 18px; vertical-align: middle; }
.dialog-header div > p { margin: 5px 0 0; color: var(--muted); }
.dialog-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 15px; color: var(--muted); font-size: 12px; }
.dialog-content { margin-top: 18px; }
.candidate-list { display: grid; gap: 8px; }
.candidate-option { position: relative; }
.candidate-option input { position: absolute; opacity: 0; pointer-events: none; }
.candidate-option label { min-height: 46px; padding: 12px 14px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 5px; background: white; cursor: pointer; }
.candidate-option input:checked + label { border-color: var(--green); background: var(--green-soft); color: #135640; font-weight: 650; }
.task-copy { padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-muted); line-height: 1.55; }
.dialog-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 8px; }
.evidence-block { margin: 16px 0; padding: 12px; border-left: 3px solid var(--blue); background: var(--blue-soft); color: #244d65; line-height: 1.55; }
.field { display: grid; gap: 6px; margin-top: 13px; }
.field span { color: var(--muted); font-size: 12px; font-weight: 650; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 360px; min-height: 42px; padding: 11px 14px; display: flex; align-items: center; border-radius: 5px; background: var(--dark); color: white; box-shadow: 0 8px 28px rgba(20, 30, 26, .24); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; z-index: 20; }
.toast.show { opacity: 1; transform: translateY(0); }
.empty-state { min-height: 120px; display: grid; place-items: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 6px; }
.asset-library-layout { min-height: 560px; margin-top: 16px; display: grid; grid-template-columns: 260px minmax(0, 1fr); border: 1px solid var(--line); background: var(--panel); }
.asset-folder-panel { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel-muted); }
.asset-folder-heading { min-height: 48px; padding: 0 13px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.asset-folder-heading span { color: var(--muted); font-size: 11px; }
.asset-folder-tree { flex: 1; padding: 5px 0; overflow: auto; }
.asset-folder-node, .asset-folder-children { min-width: 0; }
.asset-folder-line { min-width: 0; padding-left: calc(var(--folder-depth, 0) * 14px); display: flex; align-items: center; }
.asset-folder-toggle, .asset-folder-spacer { width: 24px; height: 36px; flex: 0 0 24px; }
.asset-folder-toggle { position: relative; border: 0; background: transparent; cursor: pointer; }
.asset-folder-toggle::after { content: ""; position: absolute; left: 8px; top: 14px; width: 6px; height: 6px; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted); transform: rotate(-45deg); }
.asset-folder-node:has(> .asset-folder-children) > .asset-folder-line > .asset-folder-toggle::after { top: 12px; transform: rotate(45deg); }
.asset-folder-row { width: 100%; min-width: 0; min-height: 38px; padding: 0 11px; display: grid; grid-template-columns: 17px minmax(0, 1fr) auto; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.asset-folder-panel > .asset-folder-row { border-bottom: 1px solid var(--line); }
.asset-folder-row:hover { background: #eef4f1; }
.asset-folder-row.active { background: var(--green-soft); color: #135640; font-weight: 700; }
.asset-folder-row span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-folder-row small { color: var(--muted); font-size: 10px; }
.asset-folder-icon { position: relative; width: 15px; height: 11px; border: 1px solid #8b9a92; border-radius: 2px; background: white; }
.asset-folder-icon::before { content: ""; position: absolute; left: 1px; top: -4px; width: 7px; height: 4px; border: 1px solid #8b9a92; border-bottom: 0; border-radius: 2px 2px 0 0; background: white; }
.asset-folder-empty { padding: 18px 12px; color: var(--muted); font-size: 12px; text-align: center; }
.asset-folder-actions { min-height: 54px; padding: 8px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; border-top: 1px solid var(--line); }
.asset-folder-actions .button { min-width: 0; padding: 0 6px; }
.asset-browser-panel { min-width: 0; }
.asset-browser-toolbar { min-height: 54px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.asset-browser-toolbar strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-browser-toolbar input { width: min(320px, 48%); }
.asset-table-wrap { margin: 0; border: 0; border-radius: 0; }
.asset-table { min-width: 780px; }
.asset-table th:nth-child(1) { width: 25%; }
.asset-table th:nth-child(2) { width: 90px; }
.asset-table th:nth-child(3) { width: 22%; }
.asset-table th:nth-child(4) { width: 14%; }
.asset-table th:nth-child(5) { width: 170px; }
.asset-table th:nth-child(6) { width: 112px; }
.asset-table tr.inactive { opacity: .58; }
.asset-file-name { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-table-preview { width: 56px; height: 44px; padding: 0; overflow: hidden; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; background: #eef1ef; color: inherit; cursor: zoom-in; }
.asset-table-preview img, .asset-table-preview video { width: 100%; height: 100%; display: block; object-fit: cover; }
.asset-preview-state { color: var(--muted); font-size: 12px; }
.asset-table-preview.unavailable { background: #f5f6f5; }
.asset-preview-dialog { width: min(1100px, calc(100vw - 28px)); max-width: none; }
.asset-preview-dialog .dialog-card { height: min(820px, calc(100vh - 28px)); display: flex; flex-direction: column; overflow: hidden; }
.asset-preview-stage { min-height: 280px; flex: 1; margin-top: 14px; overflow: hidden; display: grid; place-items: center; border-radius: 5px; background: #17201d; color: #dce5e1; }
.asset-preview-stage img, .asset-preview-stage video { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; object-fit: contain; }
.asset-preview-stage video { width: 100%; height: 100%; }
.asset-preview-loading, .asset-preview-error { padding: 24px; color: #dce5e1; text-align: center; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .account-strip { grid-template-columns: repeat(2, 1fr); }
  .asset-library-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .overview-grid { grid-template-columns: 1fr; gap: 8px; }
  .activity-layout { grid-template-columns: 1fr; gap: 8px; }
  .content-calendar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .asset-preview-dialog .dialog-card { height: calc(100vh - 28px); }
  .asset-preview-stage { min-height: 180px; }
  .sidebar { position: static; width: 100%; height: auto; padding: 10px 12px; }
  .brand { min-height: 40px; padding: 0 2px 10px; }
  .side-nav { flex: none; min-height: auto; max-height: 310px; margin-top: 8px; overflow-y: auto; }
  .nav-group-toggle { min-height: 34px; }
  .nav-group-items { padding-left: 10px; }
  .nav-item { min-height: 34px; padding: 0 10px; font-size: 12px; }
  .sidebar-session { margin-top: 8px; display: flex; justify-content: flex-end; }
  .sidebar-logout { width: auto; min-height: 34px; padding: 0 12px; }
  .sidebar-footer { display: none; }
  .main-area { padding: 0 14px 30px; }
  .topbar { min-height: 76px; }
  .topbar h1 { font-size: 19px; }
  .topbar p { display: none; }
  .button { min-height: 34px; padding: 0 10px; }
  .stats-grid, .account-strip, .account-grid, .ticket-board, .gateway-grid { grid-template-columns: 1fr; }
  .lead-summary { grid-template-columns: 1fr 1fr; }
  .lead-toolbar { grid-template-columns: 1fr 1fr; }
  .lead-toolbar input[type="search"] { grid-column: 1 / -1; }
  .lead-toolbar .button { min-width: 0; }
  .lead-table-wrap th:nth-child(3), .lead-table-wrap td:nth-child(3),
  .lead-table-wrap th:nth-child(4), .lead-table-wrap td:nth-child(4),
  .lead-table-wrap th:nth-child(5), .lead-table-wrap td:nth-child(5),
  .lead-table-wrap th:nth-child(7), .lead-table-wrap td:nth-child(7) { display: none; }
  .lead-table-wrap th:nth-child(1) { width: 40px; }
  .lead-table-wrap th:nth-child(2) { width: auto; }
  .lead-table-wrap th:nth-child(6) { width: 78px; }
  .lead-table-wrap th:nth-child(8) { width: 52px; }
  .lead-table-wrap td { overflow-wrap: normal; }
  .view { padding-top: 18px; }
  .section-block { margin-top: 22px; }
  .audit-row { grid-template-columns: 88px minmax(0, 1fr); }
  .audit-row span:last-child { display: none; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .bulk-review-bar { align-items: stretch; flex-direction: column; }
  .bulk-review-bar > div { display: grid; grid-template-columns: 1fr 1fr; }
  .segmented { width: 100%; }
  .segmented button { min-width: 0; flex: 1; }
  #task-type-filter { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .content-draft-primary-grid { grid-template-columns: 1fr; }
  .draft-section-heading { align-items: stretch; flex-direction: column; }
  .draft-media-actions { display: grid; grid-template-columns: 1fr; }
  .draft-media-actions .button { width: 100%; }
  .draft-media-list { grid-template-columns: 1fr; }
  .ai-compose-heading { align-items: stretch; flex-direction: column; }
  .ai-compose-heading .button { width: 100%; }
  .ai-candidate { grid-template-columns: minmax(0, 1fr); }
  .ai-candidate small { grid-column: 1; grid-row: auto; }
  .content-media-picker-toolbar { grid-template-columns: 1fr; }
  .content-media-picker-grid { min-height: 220px; grid-template-columns: 1fr; }
  .dialog-card { padding: 16px; }
  .dialog-actions { flex-wrap: wrap; }
  .compact-table th:nth-child(2), .compact-table td:nth-child(2) { display: none; }
  .compact-table th:nth-child(1) { width: 58%; }
  .compact-table th:nth-child(3) { width: 27%; }
  .compact-table th:nth-child(4) { width: 15%; }
  .row-action { white-space: nowrap; }
  .probe-device { grid-template-columns: 1fr 1fr; }
  .probe-device .button { grid-column: 1 / -1; }
  .gateway-device-row { grid-template-columns: 1fr 1fr; padding: 12px 0; }
  .gateway-device-row .button, .gateway-device-row .device-binding { grid-column: 1 / -1; }
  .scope-options { grid-template-columns: 1fr; }
  .customer-toolbar { grid-template-columns: 1fr 1fr; }
  .customer-toolbar input[type="search"] { grid-column: 1 / -1; }
  .customer-toolbar .button { grid-column: 1 / -1; }
  .customer-360-card { height: auto; max-height: calc(100vh - 28px); overflow-y: auto; }
  .customer-360-header { align-items: flex-start; }
  .customer-360-header .heading-actions { flex-wrap: wrap; justify-content: flex-end; }
  .customer-360-metrics { grid-template-columns: 1fr 1fr; }
  .customer-360-layout { min-height: auto; flex: 0 0 auto; display: block; }
  .customer-timeline-panel, .customer-followup-panel { min-height: auto; overflow: visible; }
  .customer-timeline { max-height: 420px; padding-right: 4px; overflow-y: auto; }
  .customer-followup-panel { border-top: 1px solid var(--line); border-left: 0; }
  .health-summary, .activity-summary, .error-summary { grid-template-columns: 1fr 1fr; }
  .error-toolbar { grid-template-columns: 1fr 1fr; }
  .error-toolbar input { grid-column: 1 / -1; }
  .error-context { grid-template-columns: 1fr; }
  .ai-model-summary { grid-template-columns: 1fr 1fr; }
  .ai-model-grid { grid-template-columns: 1fr; }
  .ai-model-card-header, .ai-model-card-footer { align-items: stretch; flex-direction: column; }
  .ai-model-actions { width: 100%; }
  .ai-model-actions .button { flex: 1; }
  .content-mix-summary { grid-template-columns: 1fr 1fr; }
  .asset-library-layout { min-height: 0; grid-template-columns: 1fr; }
  .asset-folder-panel { max-height: 340px; border-right: 0; border-bottom: 1px solid var(--line); }
  .asset-folder-tree { max-height: 220px; }
  .asset-browser-toolbar { align-items: stretch; flex-direction: column; gap: 8px; }
  .asset-browser-toolbar input { width: 100%; }
  .content-calendar-grid, .unscheduled-list { grid-template-columns: 1fr; border: 0; }
  .calendar-day { min-height: 150px; border: 1px solid var(--line); border-radius: 6px; }
  .health-row { grid-template-columns: 1fr auto; }
  .health-row > span, .health-row > time { grid-column: 1 / -1; }
  .activity-table-wrap th:nth-child(2), .activity-table-wrap td:nth-child(2),
  .activity-table-wrap th:nth-child(5), .activity-table-wrap td:nth-child(5),
  .action-table-wrap th:nth-child(3), .action-table-wrap td:nth-child(3) { display: none; }
  .activity-table-wrap th:nth-child(1) { width: 28%; }
  .activity-table-wrap th:nth-child(3) { width: auto; }
  .action-table-wrap th:nth-child(1), .action-table-wrap th:nth-child(4) { width: 82px; }
  .generation-note { align-items: flex-start; flex-direction: column; }
  .generation-note span { text-align: left; }
}

@media (max-width: 430px) {
  #refresh-btn { display: none; }
  #member-menu-btn { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .stats-grid { gap: 8px; }
  .stat-card { min-height: 92px; }
  .side-nav { grid-template-columns: repeat(14, 94px); justify-content: start; }
  .stop-banner { align-items: flex-start; }
  .identity-review-item { align-items: stretch !important; flex-direction: column; }
  .identity-review-item .heading-actions { width: 100%; }
  .identity-review-item .heading-actions .button { flex: 1; }
}

.tag-library-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(420px, 1.7fr);
  gap: 20px;
  align-items: start;
}

.compact-heading { margin-bottom: 10px; }
.compact-heading h3 { margin: 0; font-size: 15px; }
.table-subline { display: block; margin-top: 3px; color: var(--muted); }

@media (max-width: 900px) {
  .tag-library-layout { grid-template-columns: 1fr; }
}
