/* =====================================================================
   Property System — operational UI design system
   Traceability: PS-UX-010 §5 (design tokens), §26 (responsive), §27 (states)
   Principle (§2): optimise for clarity + actionability, not decoration.
   ===================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfcfd;
  --border: #e3e7ec;
  --border-strong: #cfd6de;
  --text: #16202b;
  --text-2: #5a6775;
  --text-3: #8b97a4;

  --brand: #12557f;
  --brand-2: #17709e;
  --brand-soft: #e7f1f8;

  --ok: #1a7f4b;
  --ok-soft: #e6f5ec;
  --warn: #9a6207;
  --warn-soft: #fdf3e0;
  --danger: #a52323;
  --danger-soft: #fdeaea;
  --info: #2d5aa8;
  --info-soft: #eaf0fb;
  --neutral-soft: #eef1f4;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 32, 43, 0.06), 0 1px 8px rgba(16, 32, 43, 0.04);
  --shadow-lg: 0 12px 40px rgba(16, 32, 43, 0.18);
  --sidebar-w: 244px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }

.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.grow { flex: 1; }

/* ------------------------------- App shell ------------------------------- */

#app { min-height: 100vh; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #0f2233;
  color: #cfdae4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand .name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.sidebar-brand .sub { color: #7d92a5; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }

.nav { padding: 10px 8px 20px; flex: 1; }
.nav-group-label {
  padding: 14px 12px 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #6d8096;
  font-weight: 650;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: #cfdae4;
  font-size: 13.5px;
  cursor: pointer;
  margin-bottom: 1px;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); text-decoration: none; color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-item i { width: 16px; text-align: center; font-size: 13px; opacity: 0.9; }
.nav-item .badge-count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.nav-item .badge-count.alert { background: #c0392b; }

.sidebar-user {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-2); color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; flex: 0 0 30px;
}
.sidebar-user .who { min-width: 0; }
.sidebar-user .who .n { color: #fff; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .who .r { color: #7d92a5; font-size: 11px; }
.sidebar-user button {
  margin-left: auto; background: none; border: none; color: #9fb1c2; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.sidebar-user button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .title-block { min-width: 0; }
.topbar .subtitle { color: var(--text-2); font-size: 12.5px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hamburger { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; cursor: pointer; }

.content { padding: 20px 22px 80px; flex: 1; }

/* --------------------------------- Cards -------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-head .actions { margin-left: auto; display: flex; gap: 7px; flex-wrap: wrap; }
.card-body { padding: 16px; }
.card-body.tight { padding: 10px 12px; }
.card-foot { padding: 11px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row.between { justify-content: space-between; }

/* --------------------------------- KPIs --------------------------------- */

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; box-shadow: var(--shadow); }
.kpi .k-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); font-weight: 650; }
.kpi .k-value { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; margin-top: 3px; }
.kpi .k-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ------------------------------ Action center --------------------------- */

.action-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; background: var(--surface);
}
.action-item:last-child { border-bottom: none; }
.action-item:hover { background: var(--surface-2); }
.action-item .sev { width: 4px; align-self: stretch; border-radius: 4px; flex: 0 0 4px; }
.action-item .sev.CRITICAL { background: var(--danger); }
.action-item .sev.WARNING { background: #d99518; }
.action-item .sev.INFO { background: var(--info); }
.action-item .a-count { font-size: 20px; font-weight: 700; min-width: 34px; }
.action-item .a-label { font-weight: 550; }

/* -------------------------------- Buttons ------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 550; font-family: inherit;
  cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-3); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-2); border-color: var(--brand-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--neutral-soft); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 7px; flex-wrap: wrap; }

/* -------------------------------- Badges -------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.01em;
  background: var(--neutral-soft); color: var(--text-2);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.score-pill {
  display: inline-flex; align-items: baseline; gap: 2px;
  font-weight: 700; font-size: 12.5px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--neutral-soft); color: var(--text-2);
}
.score-pill.high { background: var(--ok-soft); color: var(--ok); }
.score-pill.mid { background: var(--warn-soft); color: var(--warn); }
.score-pill.low { background: var(--danger-soft); color: var(--danger); }

/* -------------------------------- Tables -------------------------------- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; padding: 9px 14px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-2); font-weight: 650;
  border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: var(--surface-2); }
table.data td .cell-main { font-weight: 550; }
table.data td .cell-sub { font-size: 12px; color: var(--text-2); }

/* --------------------------------- Forms -------------------------------- */

.field { margin-bottom: 13px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.field .hint { font-size: 11.5px; color: var(--text-2); margin-top: 4px; }
.field .err { font-size: 11.5px; color: var(--danger); margin-top: 4px; font-weight: 550; }
.req::after { content: ' *'; color: var(--danger); }

input[type='text'], input[type='email'], input[type='password'], input[type='number'],
input[type='date'], input[type='datetime-local'], input[type='tel'], select, textarea {
  width: 100%; padding: 8px 11px; font-size: 13.5px; font-family: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); }
textarea { resize: vertical; min-height: 68px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%235a6775' d='M0 0h10L5 6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: none; margin: 0 0 6px; padding: 0; }
fieldset > legend { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-2); font-weight: 650; padding: 0 0 8px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
.check input { width: auto; margin-top: 2px; }

/* -------------------------------- Filters ------------------------------- */

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 140px; }
.filters .search { min-width: 220px; }

/* ------------------------------ Pipeline/Kanban -------------------------- */

.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col { flex: 0 0 268px; background: #eff2f5; border-radius: var(--radius); border: 1px solid var(--border); }
.kanban-col-head { padding: 10px 12px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.kanban-col-head .k-name { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.kanban-col-head .k-num { margin-left: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; font-size: 11.5px; font-weight: 650; }
.kanban-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; max-height: 62vh; overflow-y: auto; }
.lead-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 11px; cursor: pointer; box-shadow: var(--shadow); }
.lead-card:hover { border-color: var(--brand); }
.lead-card .lc-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.lead-card .lc-name { font-weight: 650; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-card .lc-prop { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-card .lc-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }

/* ------------------------------- Timeline ------------------------------- */

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 15px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -22px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--brand);
}
.tl-item .tl-when { font-size: 11.5px; color: var(--text-3); }
.tl-item .tl-what { font-weight: 600; font-size: 13.5px; }
.tl-item .tl-desc { font-size: 12.5px; color: var(--text-2); }

/* ------------------------------ Reason list ----------------------------- */

.reasons { list-style: none; margin: 0; padding: 0; }
.reasons li { display: flex; gap: 8px; font-size: 13px; padding: 3px 0; align-items: flex-start; }
.reasons li i { margin-top: 3px; font-size: 11px; }
.reasons li.pro i { color: var(--ok); }
.reasons li.con i { color: var(--danger); }
.reasons li.risk i { color: var(--warn); }

/* --------------------------------- Meter -------------------------------- */

.meter { height: 7px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.meter.high > span { background: var(--ok); }
.meter.mid > span { background: #d99518; }
.meter.low > span { background: var(--danger); }

/* -------------------------------- Funnel -------------------------------- */

.funnel-step { display: grid; grid-template-columns: 150px 1fr 118px; gap: 12px; align-items: center; padding: 6px 0; }
.funnel-step .f-label { font-size: 13px; font-weight: 550; }
.funnel-step .f-bar { height: 22px; background: var(--neutral-soft); border-radius: 5px; overflow: hidden; }
.funnel-step .f-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.funnel-step .f-nums { font-size: 12.5px; text-align: right; color: var(--text-2); }
.funnel-step .f-nums b { color: var(--text); }

/* --------------------------------- States ------------------------------- */

.state { padding: 42px 20px; text-align: center; }
.state i.state-icon { font-size: 28px; color: var(--text-3); margin-bottom: 12px; display: block; }
.state .state-title { font-weight: 650; font-size: 15px; margin-bottom: 4px; }
.state .state-msg { color: var(--text-2); font-size: 13px; max-width: 420px; margin: 0 auto 14px; }
.state.error i.state-icon { color: var(--danger); }
.state.denied i.state-icon { color: var(--warn); }

.skeleton { background: linear-gradient(90deg, #eceff2 25%, #f5f7f9 37%, #eceff2 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-line { height: 12px; margin-bottom: 9px; }
.sk-card { height: 74px; }

.inline-error { background: var(--danger-soft); border: 1px solid #f2c7c7; color: var(--danger); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }
.inline-warn { background: var(--warn-soft); border: 1px solid #f0dcb4; color: var(--warn); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }
.inline-info { background: var(--info-soft); border: 1px solid #cfdcf5; color: var(--info); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }
.inline-ok { background: var(--ok-soft); border: 1px solid #c3e5d1; color: var(--ok); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }

/* --------------------------------- Modal -------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 32, 43, 0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; margin: auto 0;
}
.modal.wide { max-width: 820px; }
.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-head .x { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--text-2); font-size: 16px; padding: 3px 7px; border-radius: 6px; }
.modal-head .x:hover { background: var(--neutral-soft); }
.modal-body { padding: 18px; max-height: 66vh; overflow-y: auto; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 12px 12px; }
.consequence { background: var(--warn-soft); border: 1px solid #f0dcb4; border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13px; color: #7a4e06; }

/* --------------------------------- Toast -------------------------------- */

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: 380px; }
.toast { background: #16202b; color: #fff; border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; box-shadow: var(--shadow-lg); display: flex; gap: 9px; align-items: flex-start; animation: slidein 0.18s ease; }
.toast.ok { background: #14663d; }
.toast.err { background: #8f1f1f; }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --------------------------------- Login -------------------------------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #0f2233, #14384f); }
.login-card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; padding: 26px; }
.login-card .lc-brand { text-align: center; margin-bottom: 20px; }
.login-card .lc-brand .n { font-size: 19px; font-weight: 700; }
.login-card .lc-brand .s { color: var(--text-2); font-size: 12.5px; }
.demo-users { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 13px; }
.demo-user { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.demo-user:hover { background: var(--surface-2); }

/* ------------------------------- Detail page ---------------------------- */

.detail-hero { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.detail-hero .dh-main { min-width: 0; flex: 1; }
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 7px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 550; }
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 9px 14px; font-size: 13.5px; font-weight: 550; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }

.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; font-size: 13px; }

.bottom-nav { display: none; }

/* --------------------------------- Boot --------------------------------- */

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 6px; background: linear-gradient(160deg, #0f2233, #14384f); color: #cfdae4; }
.boot-mark { width: 46px; height: 46px; border-radius: 11px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 20px; margin-bottom: 8px; }
.boot-title { color: #fff; font-weight: 700; font-size: 17px; }
.boot-sub { font-size: 12.5px; opacity: 0.75; }

/* ------------------------- Additional components ------------------------ */

/* Chips: compact inline facts / filter pills */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--neutral-soft); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--text-2); }
.chip.ok { background: var(--ok-soft); border-color: #c3e5d1; color: var(--ok); }
.chip.warn { background: var(--warn-soft); border-color: #f0dcb4; color: var(--warn); }
.chip.danger { background: var(--danger-soft); border-color: #f2c7c7; color: var(--danger); }
.chip.brand { background: var(--brand-soft); border-color: #c9e0ef; color: var(--brand); }
.chip button, .chip .x { background: none; border: none; cursor: pointer; color: inherit; padding: 0 0 0 2px; font-size: 11px; }
.chip.selectable { cursor: pointer; background: var(--surface); }
.chip.selectable:hover { border-color: var(--border-strong); }
.chip.selectable.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }

/* Generic clickable list row (used by work queue, agenda, panels) */
.list-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: var(--surface-2); }
.list-item .li-main { min-width: 0; flex: 1; }
.list-item .li-title { font-weight: 600; font-size: 13.5px; }
.list-item .li-sub { color: var(--text-2); font-size: 12.5px; }
.list-item .li-side { text-align: right; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.list-item .li-icon { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--neutral-soft); color: var(--text-2); font-size: 12px; flex: 0 0 28px; }
.list-item .li-icon.ok { background: var(--ok-soft); color: var(--ok); }
.list-item .li-icon.warn { background: var(--warn-soft); color: var(--warn); }
.list-item .li-icon.danger { background: var(--danger-soft); color: var(--danger); }
.list-item .li-icon.brand { background: var(--brand-soft); color: var(--brand); }

/* Section divider inside a card */
.sub-head { padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 650; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.sub-head .count { background: var(--neutral-soft); border-radius: 999px; padding: 0 7px; font-size: 11px; letter-spacing: 0; }
.sub-head.alert { background: var(--danger-soft); color: var(--danger); }
.sub-head.warn { background: var(--warn-soft); color: var(--warn); }

/* Next-best-action strip (§24 "next action must be obvious") */
.next-action { display: flex; align-items: center; gap: 12px; background: var(--brand-soft); border: 1px solid #c9e0ef; border-radius: var(--radius); padding: 13px 15px; }
.next-action .na-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: 0 0 34px; }
.next-action .na-body { min-width: 0; flex: 1; }
.next-action .na-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--brand); font-weight: 650; }
.next-action .na-text { font-weight: 600; font-size: 14px; }
.next-action .na-why { color: var(--text-2); font-size: 12.5px; }

/* Match explanation block (§25) */
.match-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; background: var(--surface-2); }
.match-box .mb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.match-box .mb-score { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.reason { display: flex; gap: 8px; font-size: 13px; align-items: flex-start; padding: 3px 0; }
.reason i { margin-top: 3px; font-size: 11px; }
.reason.pro i { color: var(--ok); }
.reason.con i { color: var(--danger); }
.reason.risk i { color: var(--warn); }

/* Two-column detail layout */
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* Photo/none placeholder */
.thumb { width: 44px; height: 44px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 15px; flex: 0 0 44px; }

/* Bar chart rows for analytics */
.bar-row { display: grid; grid-template-columns: minmax(90px, 1.2fr) minmax(0, 3fr) 62px; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.bar-track { background: var(--neutral-soft); border-radius: 999px; height: 9px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.bar-fill.ok { background: var(--ok); }
.bar-fill.warn { background: #c98a12; }
.bar-fill.danger { background: var(--danger); }

/* ------------------------------ Responsive ------------------------------ */

@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  /* Tablet: collapsible sidebar (§26) */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
    transform: translateX(-100%); transition: transform 0.18s ease;
  }
  .sidebar.open { transform: none; }
  .hamburger { display: inline-flex; }
  .scrim { position: fixed; inset: 0; background: rgba(16, 32, 43, 0.45); z-index: 55; }
  .content { padding: 16px 14px 96px; }
  .topbar { padding: 11px 14px; }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  /* Mobile: top bar + content + primary action + bottom nav (§26) */
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 17px; }
  .kpi .k-value { font-size: 21px; }
  .funnel-step { grid-template-columns: 96px 1fr; }
  .funnel-step .f-nums { grid-column: 1 / -1; text-align: left; }
  .kanban-col { flex-basis: 84vw; }
  .modal-backdrop { padding: 0; }
  .modal { border-radius: 0; max-width: none; min-height: 100vh; }
  .modal-foot { border-radius: 0; position: sticky; bottom: 0; }
  .modal-body { max-height: none; }
  .content { padding-bottom: 108px; }

  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 4px 7px; justify-content: space-around;
  }
  .bottom-nav .bn-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10.5px; color: var(--text-2); padding: 3px 8px; border-radius: 7px; cursor: pointer; flex: 1;
  }
  .bottom-nav .bn-item i { font-size: 15px; }
  .bottom-nav .bn-item.active { color: var(--brand); font-weight: 650; }
  .bottom-nav .bn-item:hover { text-decoration: none; }
  .mobile-primary { position: fixed; bottom: 66px; right: 14px; z-index: 51; box-shadow: var(--shadow-lg); border-radius: 999px; padding: 11px 17px; }
  table.data th:nth-child(n + 4), table.data td:nth-child(n + 4) { display: none; }
}

@media print {
  .sidebar, .topbar-actions, .bottom-nav, .mobile-primary { display: none !important; }
}
