/* ═══════════════════════════════════════════════════════════════════════════
   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: rgba(255, 255, 255, .7);
  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: #fff; }

/* ── 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: rgba(250, 248, 242, .9);
  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: rgba(255, 255, 255, .6);
  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(--green-900); color: var(--gold-300);
  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: #fff; 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(--green-900), var(--green-800));
  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: rgba(207, 224, 214, .5); 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: #cfe0d6; 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: #fff; }
.nav-item.active { background: var(--gold-grad); color: var(--green-950); font-weight: 600; }
.nav-item.active .nav-count { background: rgba(13, 43, 30, .18); color: var(--green-950); }
.sidebar-foot {
  margin-top: auto; padding: 14px 10px 4px; font-size: .64rem; line-height: 1.7;
  color: rgba(207, 224, 214, .58); 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: rgba(201, 162, 39, .1); border: 1px solid rgba(201, 162, 39, .42); color: #7a5d00; }
.callout.warn strong { color: var(--green-900); }
.callout.info { background: rgba(47, 111, 143, .08); border: 1px solid rgba(47, 111, 143, .3); color: #1f4e63; }
.callout.lock { background: var(--green-900); color: #dbe9e1; border: 1px solid rgba(201, 162, 39, .4); }
.callout.lock strong { color: var(--gold-300); }

/* ── 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: #fff;
  border: 1px solid var(--line-solid); box-shadow: var(--shadow-soft);
  position: relative; overflow: hidden;
}
.kpi.hero { background: linear-gradient(150deg, var(--green-900), var(--green-700)); border-color: rgba(201, 162, 39, .4); }
.kpi.hero .kpi-val { color: var(--gold-300); }
.kpi.hero .kpi-label { color: #cfe0d6; }
.kpi.alert { border-color: rgba(176, 58, 46, .4); background: rgba(176, 58, 46, .04); }
.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: #fff;
  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: #fff; 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: rgba(201, 162, 39, .05); }
.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(--green-800); 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: #fff; 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(--green-900); color: var(--gold-300); }
.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: rgba(8, 31, 21, .5); 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: #fff;
  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: #fff;
  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: rgba(37, 107, 74, .05); border: 1px solid rgba(37, 107, 74, .22); }
.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: #dbe9e1; font-size: .78rem; line-height: 1.6;
}
.readonly-note b { color: var(--gold-300); }

/* ═══════════════════════ AI ASSISTANT ═══════════════════════ */

.ai-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 200;
  display: flex; align-items: center; gap: 9px;
  padding: 14px 20px 14px 16px; border-radius: 999px;
  background: linear-gradient(140deg, var(--green-900), var(--green-700));
  color: var(--gold-300); border: 1px solid rgba(201, 162, 39, .55);
  box-shadow: 0 12px 34px rgba(13, 43, 30, .38);
  font-family: var(--font-body); font-size: .78rem; font-weight: 600;
  letter-spacing: .06em; cursor: pointer;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.ai-fab:hover { transform: translateY(-3px); box-shadow: 0 18px 44px rgba(13, 43, 30, .48); }
.ai-fab svg { flex-shrink: 0; }
@media (max-width: 640px) {
  .ai-fab { padding: 15px; right: 16px; bottom: 16px; }
  .ai-fab-label { display: none; }
}

.ai-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 210;
  width: min(430px, calc(100vw - 32px));
  height: min(640px, calc(100dvh - 48px));
  display: flex; flex-direction: column;
  background: #fff; border-radius: 20px;
  border: 1px solid rgba(201, 162, 39, .35);
  box-shadow: 0 24px 70px rgba(13, 43, 30, .34);
  overflow: hidden; animation: aiIn .32s var(--ease);
}
@keyframes aiIn { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .ai-panel { right: 8px; left: 8px; bottom: 8px; width: auto; height: calc(100dvh - 16px); border-radius: 16px; }
}

.ai-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 16px; background: linear-gradient(140deg, var(--green-900), var(--green-700));
  color: #eef5f0; flex-shrink: 0;
}
.ai-head-brand { display: flex; align-items: center; gap: 11px; }
.ai-head-brand b { display: block; font-size: .9rem; color: #fff; font-weight: 600; letter-spacing: .02em; }
.ai-head-brand small { font-size: .64rem; color: var(--gold-300); letter-spacing: .06em; }
.ai-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--gold-400);
  box-shadow: 0 0 0 4px rgba(201, 162, 39, .22); animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.ai-head-actions { display: flex; gap: 6px; }
.ai-icon {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .1);
  color: #eef5f0; font-size: .82rem; line-height: 1;
}
.ai-icon:hover { background: rgba(255, 255, 255, .2); }

.ai-body { flex: 1; overflow-y: auto; padding: 16px; background: var(--ivory); }

.ai-msg { margin-bottom: 14px; animation: viewIn .3s var(--ease); }
.ai-msg.user { display: flex; justify-content: flex-end; }
.ai-msg.user .ai-bubble {
  background: var(--green-900); color: #eef5f0; border-radius: 14px 14px 4px 14px;
  max-width: 85%; padding: 11px 14px; font-size: .83rem; line-height: 1.55;
}
.ai-msg.bot .ai-bubble {
  background: #fff; border: 1px solid var(--line-solid);
  border-radius: 14px 14px 14px 4px; padding: 13px 15px;
  font-size: .83rem; line-height: 1.65; color: var(--ink); white-space: pre-wrap;
}
.ai-msg.bot .ai-bubble strong { color: var(--green-900); }

.ai-intro { font-size: .82rem; line-height: 1.7; color: var(--ink); }
.ai-intro .ai-lock {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .64rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--green-950); background: var(--gold-grad);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 10px;
}

.ai-suggest-group { margin-top: 14px; }
.ai-suggest-title {
  font-size: .6rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 7px;
}
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chip {
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-solid); background: #fff;
  font-family: var(--font-body); font-size: .73rem; color: var(--green-800);
  transition: all .18s; text-align: left;
}
.ai-chip:hover { border-color: var(--gold-500); background: rgba(201, 162, 39, .08); }

.ai-result { margin-top: 11px; border: 1px solid var(--line-solid); border-radius: 12px; overflow: hidden; background: #fff; }
.ai-result-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; background: var(--ivory); border-bottom: 1px solid var(--line-solid);
}
.ai-result-title { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green-800); }
.ai-result-actions { display: flex; gap: 5px; }
.ai-result-actions button {
  padding: 4px 9px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line-solid); background: #fff;
  font-family: var(--font-body); font-size: .64rem; font-weight: 600; color: var(--green-800);
}
.ai-result-actions button:hover { border-color: var(--gold-500); }
.ai-table-scroll { max-height: 260px; overflow: auto; }
.ai-table { width: 100%; border-collapse: collapse; font-size: .7rem; }
.ai-table th {
  position: sticky; top: 0; text-align: left; padding: 8px 10px; white-space: nowrap;
  font-size: .58rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--green-800); background: var(--ivory); border-bottom: 1px solid var(--line-solid);
}
.ai-table td { padding: 7px 10px; border-bottom: 1px solid rgba(227, 224, 214, .6); white-space: nowrap; }
.ai-table tr:last-child td { border-bottom: none; }
.ai-chart-box { height: 190px; padding: 12px; position: relative; }
.ai-more { padding: 8px 12px; font-size: .68rem; color: var(--muted); background: var(--ivory); border-top: 1px solid var(--line-solid); }

.ai-typing { display: flex; gap: 4px; padding: 13px 15px; }
.ai-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--gold-500);
  animation: bounce 1.3s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .18s; }
.ai-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

.ai-input {
  display: flex; gap: 8px; padding: 12px; background: #fff;
  border-top: 1px solid var(--line-solid); flex-shrink: 0;
}
.ai-input input {
  flex: 1; padding: 12px 15px; border-radius: 999px;
  border: 1px solid var(--line-solid); background: var(--ivory);
  font-family: var(--font-body); font-size: .84rem; color: var(--ink); outline: none;
}
.ai-input input:focus { border-color: var(--gold-500); background: #fff; box-shadow: 0 0 0 3px rgba(201, 162, 39, .15); }
.ai-input button {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; cursor: pointer;
  background: var(--green-900); color: var(--gold-300);
  border: 1px solid rgba(201, 162, 39, .4); font-size: 1.05rem;
  transition: transform .2s var(--ease);
}
.ai-input button:hover { transform: scale(1.06); }
.ai-input button:disabled { opacity: .5; cursor: wait; transform: none; }

/* ── 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: 12px 0 40px rgba(13, 43, 30, .3);
  }
  .sidebar.open { transform: none; }
  .sidebar-backdrop {
    display: block; position: fixed; inset: var(--topbar-h) 0 0; z-index: 80;
    background: rgba(8, 31, 21, .45); 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: rgba(176, 58, 46, .9); color: #fff; }
.nav-item.active .nav-count.gold,
.nav-item.active .nav-count.alert { background: rgba(13, 43, 30, .22); color: var(--green-950); }

.stat-pill.warn { border-color: rgba(201, 162, 39, .55); background: rgba(201, 162, 39, .1); }
.stat-pill.warn b { color: #8a6d10; }

.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, rgba(201,162,39,.5), rgba(26,77,53,.25));
}
.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: #fff; color: var(--green-900);
  border: 2px solid rgba(201, 162, 39, .55);
}
.tl-row.latest .tl-no { background: var(--green-900); color: var(--gold-300); 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: rgba(201, 162, 39, .45); background: rgba(201, 162, 39, .06); }
.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;
}
