/* ═══════════════════════════════════════════════════════════════════════════
   SRIDIRA CMS · Sales & Super Admin portal
   ═══════════════════════════════════════════════════════════════════════════ */

:root { --side-w: 244px; --topbar-h: 64px; }

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px; gap: 18px;
}
.login-card { width: 100%; max-width: 430px; padding: 34px 30px; border-radius: 20px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-title { font-family: var(--font-display); font-size: 2rem; font-weight: 600; color: var(--green-900); }
.login-sub { font-size: .82rem; color: var(--muted); margin-bottom: 20px; }
.login-foot {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: .65rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
.login-foot a { color: var(--gold-500); text-decoration: none; letter-spacing: .1em; }
.login-foot a:hover { text-decoration: underline; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 66px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: .7rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--gold-500); padding: 6px 8px;
}

.demo-creds {
  margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line-solid);
  display: flex; flex-direction: column; gap: 7px;
}
.demo-title {
  font-size: .64rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold-500); margin-bottom: 4px;
}
.demo-creds button {
  text-align: left; padding: 9px 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-solid); background: var(--surface);
  font-family: var(--font-body); font-size: .76rem; color: var(--green-800); transition: all .18s;
}
.demo-creds button:hover { border-color: var(--gold-500); background: var(--surface); }

/* ── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 60; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 clamp(14px, 3vw, 26px);
  background: var(--surface);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-solid);
}
.brand.mini { min-width: 0; }
.menu-toggle { display: none; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line-solid); background: var(--surface-secondary);
  color: var(--green-800); cursor: pointer; font-size: 1.05rem;
}
.icon-btn:hover { border-color: var(--gold-500); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.role-chip { flex-shrink: 0; }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--line-solid); border-radius: 999px;
  padding: 5px 13px 5px 5px; cursor: pointer;
  font-family: var(--font-body); font-size: .8rem; color: var(--green-900);
}
.user-btn:hover { border-color: var(--gold-500); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: var(--chrome); color: var(--on-chrome);
  display: grid; place-items: center; font-size: .76rem; font-weight: 600;
}
.user-dropdown {
  position: absolute; right: 0; top: 46px; min-width: 216px; z-index: 70;
  background: var(--surface); border: 1px solid var(--line-solid); border-radius: 12px;
  box-shadow: var(--shadow-lift); overflow: hidden;
}
.user-dropdown .ud-head { padding: 13px 16px; border-bottom: 1px solid var(--line-solid); background: var(--ivory); }
.user-dropdown .ud-head b { display: block; font-size: .84rem; color: var(--green-900); }
.user-dropdown .ud-head small { font-size: .7rem; color: var(--muted); }
.user-dropdown button, .user-dropdown a {
  display: block; width: 100%; text-align: left; padding: 12px 16px;
  background: none; border: none; text-decoration: none;
  font-family: var(--font-body); font-size: .82rem; color: var(--ink); cursor: pointer;
}
.user-dropdown button:hover, .user-dropdown a:hover { background: var(--ivory); }
.user-dropdown button.danger { color: var(--danger); border-top: 1px solid var(--line-solid); }

/* ── Layout ────────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: calc(100dvh - var(--topbar-h)); }
.sidebar {
  width: var(--side-w); flex-shrink: 0;
  background: linear-gradient(180deg, var(--chrome), var(--chrome-2));
  padding: 16px 12px; display: flex; flex-direction: column;
  position: sticky; top: var(--topbar-h);
  height: calc(100dvh - var(--topbar-h)); overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.nav-group {
  font-size: .6rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--on-chrome-muted); padding: 14px 13px 6px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 13px; border-radius: 10px;
  color: var(--on-chrome-muted); font-family: var(--font-body); font-size: .84rem; font-weight: 500;
  cursor: pointer; border: none; background: none; text-align: left; transition: all .18s;
}
.nav-item .nav-ic { width: 18px; text-align: center; opacity: .85; font-size: .9rem; }
.nav-item .nav-count {
  margin-left: auto; font-size: .64rem; font-weight: 700; padding: 2px 7px;
  border-radius: 999px; background: rgba(255, 255, 255, .14);
}
.nav-item:hover { background: rgba(255, 255, 255, .08); color: var(--surface); }
.nav-item.active { background: var(--gold-grad); color: var(--green-950); font-weight: 600; }
.nav-item.active .nav-count { background: rgba(255,255,255,.14); color: var(--green-950); }
.sidebar-foot {
  margin-top: auto; padding: 14px 10px 4px; font-size: .64rem; line-height: 1.7;
  color: var(--on-chrome-muted); display: flex; flex-direction: column; gap: 4px;
}
.sidebar-backdrop { display: none; }

.content { flex: 1; min-width: 0; padding: clamp(16px, 3vw, 30px); max-width: 1400px; width: 100%; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: viewIn .4s var(--ease); }
.view-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 20px; flex-wrap: wrap;
}
.view-head h2 { font-family: var(--font-display); font-size: 1.85rem; font-weight: 600; color: var(--green-900); line-height: 1.2; }
.view-sub { font-size: .8rem; color: var(--muted); margin-top: 3px; max-width: 68ch; line-height: 1.55; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Callouts ──────────────────────────────────────────────────────────── */
.callout {
  padding: 14px 17px; border-radius: 13px; margin-bottom: 18px;
  font-size: .82rem; line-height: 1.65;
}
.callout.warn { background: var(--primary-tint); border: 1px solid var(--primary); color: var(--warning-text); }
.callout.warn strong { color: var(--green-900); }
.callout.info { background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info-text); }
.callout.lock { background: var(--chrome); color: var(--on-chrome-muted); border: 1px solid var(--chrome-2); }
.callout.lock strong { color: var(--on-chrome); }

/* ── KPI cards ─────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 13px; margin-bottom: 20px;
}
.kpi-grid.tight { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 18px; }
.kpi {
  padding: 17px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line-solid); box-shadow: var(--shadow-soft);
  position: relative; overflow: hidden;
}
.kpi.hero { background: var(--brand-gradient); border-color: transparent; }
.kpi.hero .kpi-val { color: #FFFFFF; }
.kpi.hero .kpi-label { color: rgba(255,255,255,.82); }
.kpi.alert { border-color: var(--danger-border); background: var(--danger-bg); }
.kpi.alert .kpi-val { color: var(--danger); }
.kpi-val { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--green-900); line-height: 1; }
.kpi-label {
  font-size: .64rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-top: 6px; line-height: 1.4;
}

.stat-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.stat-pill {
  padding: 9px 15px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line-solid); font-size: .78rem; color: var(--muted);
}
.stat-pill b { color: var(--green-900); font-weight: 700; font-size: .9rem; margin-right: 5px; }

/* ── Panels & charts ───────────────────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--line-solid); border-radius: 14px;
  padding: 18px; box-shadow: var(--shadow-soft); margin-bottom: 18px;
}
.panel.inner { box-shadow: none; margin-bottom: 0; }
.panel h3 {
  font-size: .78rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--green-800); margin-bottom: 13px;
}
.muted-count { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.panel-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px; margin-bottom: 18px;
}
.panel-grid .panel { margin-bottom: 0; }
.panel-grid .panel.wide { grid-column: 1 / -1; }
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 300px; }

/* ── Toolbar ───────────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 9px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.search-input { flex: 1 1 220px; min-width: 180px; padding: 11px 14px; font-size: .88rem; }
.filter-select { flex: 0 1 auto; width: auto; min-width: 134px; max-width: 260px; padding: 11px 38px 11px 14px; font-size: .82rem; }
input[type="date"].filter-select { min-width: 150px; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll.capped { max-height: 620px; overflow-y: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.data-table.sm { font-size: .76rem; }
.data-table thead th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; padding: 11px 12px; white-space: nowrap;
  font-size: .64rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--green-800); background: var(--ivory);
  border-bottom: 2px solid var(--line-solid);
}
.data-table tbody td {
  padding: 11px 12px; border-bottom: 1px solid var(--line-solid);
  color: var(--ink); vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--primary-tint); }
.data-table.clickable-rows tbody tr { cursor: pointer; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.nowrap { white-space: nowrap; }
.data-table td.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92em; letter-spacing: -.01em; }
.data-table td.empty, .data-table td.loading {
  text-align: center; padding: 34px 12px; color: var(--muted); font-style: italic;
}
.data-table .cell-strong { font-weight: 600; color: var(--green-900); }
.data-table .cell-sub { display: block; font-size: .92em; color: var(--muted); margin-top: 2px; }
.data-table .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.data-table input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

.pager {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding-top: 15px; margin-top: 5px; border-top: 1px solid var(--line-solid);
}
.pager button {
  padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line-solid);
  background: var(--surface); font-family: var(--font-body); font-size: .76rem; font-weight: 600;
  color: var(--green-800); cursor: pointer;
}
.pager button:hover:not(:disabled) { border-color: var(--gold-500); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager .pinfo { font-size: .76rem; color: var(--muted); }

/* ── Reports ───────────────────────────────────────────────────────────── */
.report-presets { display: flex; gap: 9px; flex-wrap: wrap; }
.report-presets .btn-outline.active { background: var(--chrome); color: var(--on-chrome); }
.report-filters {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0 14px; margin-bottom: 6px;
}
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.export-actions { display: flex; gap: 7px; }

/* ── Settings ──────────────────────────────────────────────────────────── */
.settings-form { max-width: 620px; }

/* ── Sheets ────────────────────────────────────────────────────────────── */
.sheet-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.sheet-meta .sm-item {
  padding: 13px 15px; border-radius: 11px; background: var(--ivory); border: 1px solid var(--line-solid);
}
.sheet-meta .sm-item small {
  display: block; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 5px;
}
.sheet-meta .sm-item b { font-size: .85rem; color: var(--green-900); word-break: break-all; font-weight: 600; }

/* ── Modals ────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(14px, 4vh, 48px) 16px;
  background: var(--overlay); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  overflow-y: auto; animation: viewIn .25s var(--ease);
}
.modal-card {
  position: relative; width: 100%; max-width: 460px;
  padding: 30px 28px; border-radius: 18px; background: var(--surface);
  box-shadow: var(--shadow-lift); margin: auto 0;
}
.modal-card.lg { max-width: 800px; }
.modal-card h3 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: var(--green-900); margin-bottom: 18px; }
.modal-close {
  position: absolute; right: 14px; top: 14px; width: 32px; height: 32px;
  border-radius: 50%; border: 1px solid var(--line-solid); background: var(--surface);
  color: var(--muted); cursor: pointer; font-size: .85rem; line-height: 1;
}
.modal-close:hover { border-color: var(--danger); color: var(--danger); }

/* ── Customer profile ──────────────────────────────────────────────────── */
.profile-head { border-bottom: 1px solid var(--line-solid); padding-bottom: 16px; margin-bottom: 18px; padding-right: 34px; }
.profile-name { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; color: var(--green-900); line-height: 1.15; }
.profile-id { font-size: .76rem; color: var(--muted); margin-top: 4px; display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.profile-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
@media (min-width: 560px) { .profile-stats { grid-template-columns: repeat(4, 1fr); } }
.profile-stats .ps { padding: 13px 10px; text-align: center; border-radius: 11px; background: var(--ivory); border: 1px solid var(--line-solid); }
.profile-stats .ps b { display: block; font-size: .96rem; color: var(--green-900); font-weight: 700; line-height: 1.3; }
.profile-stats .ps span { font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.profile-section-title {
  font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold-500); margin: 22px 0 11px;
}
.detail-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.detail-list .d { padding: 11px 13px; border-radius: 10px; background: var(--ivory); border: 1px solid var(--line-solid); }
.detail-list .d small { display: block; font-size: .61rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.detail-list .d span { font-size: .84rem; color: var(--green-900); font-weight: 500; word-break: break-word; }

.hist-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 13px; margin-bottom: 7px; border-radius: 10px;
  background: var(--ivory); border: 1px solid var(--line-solid); font-size: .8rem;
}
.hist-row .hr-when { font-weight: 600; color: var(--green-900); }
.hist-row .hr-meta { color: var(--muted); font-size: .92em; }

.lead-form { padding: 18px; border-radius: 13px; background: var(--success-bg); border: 1px solid var(--success-border); }
.lead-form .field-row { grid-template-columns: 1fr; }
@media (min-width: 560px) { .lead-form .field-row { grid-template-columns: 1fr 1fr; } }

.readonly-note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; margin-bottom: 16px; border-radius: 11px;
  background: var(--green-900); color: var(--text-on-inverse-2); font-size: .78rem; line-height: 1.6;
}
.readonly-note b { color: var(--gold-300); }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .menu-toggle { display: grid; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); z-index: 90;
    transform: translateX(-100%); transition: transform .3s var(--ease);
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: none; }
  .sidebar-backdrop {
    display: block; position: fixed; inset: var(--topbar-h) 0 0; z-index: 80;
    background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity .3s;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .brand.mini .brand-text { display: none; }
}
@media (max-width: 560px) {
  .view-head h2 { font-size: 1.5rem; }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .kpi-val { font-size: 1.6rem; }
  .user-btn span:not(.user-avatar) { display: none; }
  .user-btn { padding: 5px; border: none; }
  .role-chip { display: none; }
  .filter-select { max-width: none; flex: 1 1 130px; }
}

/* ═══════════════════ v2 · assignment, team & timeline ═══════════════════ */

.project-chip { flex-shrink: 0; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-count.gold  { background: var(--gold-grad); color: var(--green-950); }
.nav-count.alert { background: var(--danger-solid); color: var(--surface); }
.nav-item.active .nav-count.gold,
.nav-item.active .nav-count.alert { background: rgba(255,255,255,.16); color: var(--green-950); }

.stat-pill.warn { border-color: var(--primary); background: var(--primary-tint); }
.stat-pill.warn b { color: var(--warning-text); }

.claimed-note { font-size: .72rem; color: var(--muted); font-style: italic; }

.callout.info a { color: var(--green-800); font-weight: 600; }
.callout a { color: inherit; }

/* ── Read-only visit timeline (oldest first, numbered) ─────────────────── */
.timeline { position: relative; padding-left: 6px; }
.timeline::before {
  content: ""; position: absolute; left: 20px; top: 12px; bottom: 12px;
  width: 2px; background: linear-gradient(180deg, var(--primary), rgba(255,255,255,.10));
}
.tl-row { position: relative; display: flex; gap: 14px; padding: 0 0 14px 0; }
.tl-row:last-child { padding-bottom: 0; }
.tl-no {
  position: relative; z-index: 1; flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: .92rem; font-weight: 700;
  background: var(--surface); color: var(--green-900);
  border: 2px solid var(--primary);
}
.tl-row.latest .tl-no { background: var(--chrome); color: var(--on-chrome); border-color: var(--green-900); }
.tl-body {
  flex: 1; min-width: 0; padding: 10px 14px; border-radius: 11px;
  background: var(--ivory); border: 1px solid var(--line-solid);
}
.tl-row.latest .tl-body { border-color: var(--primary); background: var(--primary-tint); }
.tl-when { font-size: .84rem; font-weight: 600; color: var(--green-900); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tl-meta { font-size: .76rem; color: var(--muted); margin-top: 4px; line-height: 1.5; word-break: break-word; }
.tl-meta.faint { font-size: .68rem; opacity: .75; }

/* ── Settings list editors ─────────────────────────────────────────────── */
.settings-form textarea {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .84rem; line-height: 1.7;
}

/* ═══════════════ KIOSK SECURITY CARDS (v2.1) ═══════════════ */
.ks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ks-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--card, var(--surface)); }
.ks-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.ks-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn-outline.sm { font-size: .82rem; padding: .4rem .7rem; }
.btn-outline.sm.danger { color: var(--danger, var(--danger-text)); border-color: var(--danger, var(--danger-text)); }

/* ═══════════════ DATE FILTER (v2.7) ═══════════════
   Sits in the existing .toolbar row and borrows .filter-select wholesale, so it
   reads as part of the furniture rather than something bolted on. */
.datefilter { display: contents; }
.df-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.df-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .82rem; color: var(--muted, var(--text-secondary)); white-space: nowrap; cursor: pointer;
}
.df-toggle input { accent-color: var(--gold, var(--primary)); cursor: pointer; }
.df-fields { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.df-fields .df-from, .df-fields .df-to { min-width: 9.5rem; }
.df-preset { min-width: 9rem; }

/* "Showing all dates because you're searching" — a warning tone, because it is
   telling you the filter on screen is not the one being applied. */
.datefilter-notice { margin-bottom: 12px; }
.datefilter-notice .df-reapply { margin-left: 6px; }

/* ═══════════════ ASSIGNMENT CHAIN (v2.7) ═══════════════ */
.chain { list-style: none; margin: 0 0 14px; padding: 0; }
.chain-row {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line, var(--border));
}
.chain-row:last-child { border-bottom: 0; }
.chain-when { min-width: 5.6rem; line-height: 1.25; }
.chain-when b { display: block; font-size: .84rem; }
.chain-when span { font-size: .74rem; color: var(--muted, var(--text-secondary)); }
.chain-body { flex: 1; min-width: 0; }
.chain-move { font-size: .88rem; font-weight: 500; }
.chain-arrow { color: var(--gold, var(--primary)); padding: 0 2px; }
.chain-meta { font-size: .76rem; color: var(--muted, var(--text-secondary)); margin-top: 2px; }
.chain-reason { font-size: .76rem; color: var(--muted, var(--text-secondary)); margin-top: 3px; font-style: italic; }
.chain-repair { opacity: .72; }

/* ════════════════════ CONTACT IDENTITY (v8.0) ════════════════════
   Multiple contact numbers under one customer and one lead. Built on
   the same tokens as .hist-row and .detail-list so the section reads as
   part of the profile rather than bolted onto it. State is carried by
   a badge and a label, never by colour alone. */
.contacts-panel { margin-bottom: 18px; }
.contact-list { display: grid; gap: 7px; }

.contact-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; flex-wrap: wrap;
  padding: 11px 13px; border-radius: 10px;
  background: var(--ivory); border: 1px solid var(--line-solid);
}
.contact-row.is-primary { border-color: var(--gold-300); }
.contact-row.is-inactive { opacity: .68; }

.contact-main { flex: 1 1 220px; min-width: 0; }
.contact-num {
  font-size: .95rem; font-weight: 600; color: var(--green-900);
  word-break: break-word; letter-spacing: .01em;
}
.contact-meta {
  margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center; font-size: .78rem;
}
.contact-sub { margin-top: 4px; font-size: .72rem; color: var(--muted); word-break: break-word; }
.contact-note { margin: 6px 0 0; flex-basis: 100%; }
.ct-dim { color: var(--muted); }

.contact-actions { display: flex; flex-wrap: wrap; gap: 6px; flex: 0 0 auto; }
.contact-bar { margin-top: 12px; }

.ct-compare { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.ct-compare .d {
  padding: 11px 13px; border-radius: 10px;
  background: var(--ivory); border: 1px solid var(--line-solid);
}
.ct-compare .d small {
  display: block; font-size: .61rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.ct-compare .d span { font-size: .9rem; color: var(--green-900); font-weight: 600; word-break: break-word; }

.ct-results { margin: 10px 0 4px; }
ul.ct-conflict { margin: 8px 0 0; padding-left: 18px; }
ul.ct-conflict li { margin-bottom: 3px; }

/* Phones: the row becomes a stack and the buttons take the full width
   rather than overflowing sideways. */
@media (max-width: 560px) {
  .contact-row { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  .contact-actions { width: 100%; }
  .contact-actions .btn-outline { flex: 1 1 auto; }
  .ct-compare { grid-template-columns: 1fr; }
}

/* Keyboard users must be able to see where they are. */
.contact-actions button:focus-visible,
.contact-bar button:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 2px; }
