/* =========================================================================
   RecoveryDesk — WhatsApp Debt Collection Platform
   Global stylesheet
   Primary colour : #0d9488 (teal-600)
   Sidebar bg     : #1e293b (slate-800)
   ========================================================================= */

/* ----- Design tokens ----------------------------------------------------- */
:root {
  --color-primary:        #0d9488;
  --color-primary-dark:   #0f766e;
  --color-primary-light:  #14b8a6;
  --color-primary-50:     #f0fdfa;
  --color-primary-100:    #ccfbf1;

  --sidebar-bg:           #1e293b;
  --sidebar-bg-2:         #0f172a;
  --sidebar-text:         #cbd5e1;
  --sidebar-text-muted:   #64748b;
  --sidebar-active:       #0d9488;

  --bg:                   #f8fafc;
  --surface:              #ffffff;
  --surface-2:            #f1f5f9;
  --border:               #e2e8f0;
  --border-strong:        #cbd5e1;

  --text:                 #0f172a;
  --text-muted:           #64748b;
  --text-subtle:          #94a3b8;

  --emerald:              #10b981;
  --emerald-soft:         #d1fae5;
  --amber:                 #f59e0b;
  --amber-soft:           #fef3c7;
  --red:                  #ef4444;
  --red-soft:             #fee2e2;
  --sky:                  #0ea5e9;
  --sky-soft:             #e0f2fe;
  --violet:               #8b5cf6;
  --violet-soft:          #ede9fe;
  --orange:               #f97316;
  --orange-soft:          #ffedd5;
  --zinc:                 #71717a;
  --zinc-soft:            #e4e4e7;

  --radius:               10px;
  --radius-sm:            6px;
  --radius-lg:            14px;
  --shadow-sm:            0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow:               0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg:            0 12px 32px rgba(15, 23, 42, 0.18);

  --sidebar-w:            250px;
  --topbar-h:             64px;
}

/* ----- Reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ----- Layout shell ----------------------------------------------------- */
#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  overflow-y: auto;
}
.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-header .brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--color-primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.sidebar-header .brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.sidebar-header .brand-sub {
  font-size: 11px;
  color: var(--sidebar-text-muted);
  margin-top: 1px;
}

.nav { padding: 12px 10px 24px; flex: 1; }
.nav-group { margin-bottom: 18px; }
.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-text-muted);
  padding: 6px 12px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.4);
}
.nav-item .nav-icon { font-size: 15px; flex-shrink: 0; width: 18px; text-align: center; }
.nav-item .nav-label { flex: 1; }
.nav-item .nav-badge {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .topbar-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}
.topbar .topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar .hamburger {
  display: none;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 22px;
  padding: 4px 8px;
  cursor: pointer;
}
.topbar .topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  width: 280px;
}
.topbar .topbar-search input {
  border: 0;
  background: transparent;
  outline: 0;
  flex: 1;
  font-size: 13px;
}
.topbar .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}

.view-container {
  padding: 24px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}
.footer {
  padding: 16px 24px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ----- Cards ------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; flex: 1; }
.card-content { padding: 20px; }
.card-content.p-0 { padding: 0; }

/* ----- KPI cards --------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.kpi-card .kpi-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: var(--color-primary-50);
  color: var(--color-primary);
}
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.kpi-sub.positive { color: var(--emerald); }
.kpi-sub.negative { color: var(--red); }

/* ----- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-outline:hover { background: var(--surface-2); }
.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 5px; }
.btn-icon { padding: 6px 8px; }
.btn-block { display: flex; width: 100%; }

/* ----- Badges ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--zinc-soft);
  color: var(--zinc);
  white-space: nowrap;
}
.badge-emerald { background: var(--emerald-soft); color: #065f46; }
.badge-amber   { background: var(--amber-soft);   color: #92400e; }
.badge-red     { background: var(--red-soft);     color: #991b1b; }
.badge-sky     { background: var(--sky-soft);     color: #075985; }
.badge-violet  { background: var(--violet-soft);  color: #5b21b6; }
.badge-orange  { background: var(--orange-soft);  color: #9a3412; }
.badge-zinc    { background: var(--zinc-soft);    color: #3f3f46; }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); }
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  letter-spacing: 0.03em;
}

/* ----- Tables ------------------------------------------------------------ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}
.table th, .table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-2);
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.table .text-right { text-align: right; }
.table .text-center { text-align: center; }
.table .num { font-variant-numeric: tabular-nums; text-align: right; font-weight: 500; }

/* ----- List items -------------------------------------------------------- */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item.selected { background: var(--color-primary-50); border-left: 3px solid var(--color-primary); }
.list-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; font-size: 13.5px; }
.list-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.list-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ----- Forms ------------------------------------------------------------- */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  transition: border 0.15s ease, box-shadow 0.15s ease;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: 0;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-100);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-help { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ----- Modal ------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn 0.22s ease;
}
.modal.modal-lg { max-width: 760px; }
.modal.modal-xl { max-width: 960px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-title { font-size: 15px; font-weight: 600; flex: 1; }
.modal-close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface-2);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* ----- Toast ------------------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.22s ease;
}
.toast .toast-icon { font-size: 16px; }
.toast-success { border-left-color: var(--emerald); }
.toast-success .toast-icon { color: var(--emerald); }
.toast-error   { border-left-color: var(--red); }
.toast-error .toast-icon   { color: var(--red); }
.toast-info    { border-left-color: var(--sky); }
.toast-info .toast-icon    { color: var(--sky); }
@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ----- Chat -------------------------------------------------------------- */
.chat-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - var(--topbar-h) - 100px);
  min-height: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.chat-sidebar {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface-2);
}
.chat-messages {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-2);
  flex: 1;
}
.chat-message {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  word-wrap: break-word;
}
.chat-message.outbound {
  align-self: flex-end;
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 2px;
}
.chat-message.inbound {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 2px;
}
.chat-message .msg-meta { font-size: 10.5px; opacity: 0.7; margin-top: 3px; }
.chat-input {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: var(--surface);
}
.chat-input input, .chat-input textarea {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  resize: none;
}

/* ----- Progress ---------------------------------------------------------- */
.progress {
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  height: 8px;
  width: 100%;
}
.progress-bar {
  background: var(--color-primary);
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress-bar.success { background: var(--emerald); }
.progress-bar.warning { background: var(--amber); }
.progress-bar.danger  { background: var(--red); }

/* ----- Feature grid ------------------------------------------------------ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--color-primary);
}
.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--color-primary-50);
  color: var(--color-primary);
  margin-bottom: 12px;
}
.feature-title { font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.feature-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.feature-card .feature-cta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 600;
}

/* ----- Loading + Empty --------------------------------------------------- */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--text-muted);
  gap: 12px;
}
.loading .spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 38px; margin-bottom: 10px; opacity: 0.6; }
.empty-state .empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-state .empty-desc  { font-size: 13px; max-width: 360px; margin: 0 auto; }

/* ----- Tabs -------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tab {
  padding: 8px 14px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}
.tab .tab-count {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 5px;
  font-weight: 700;
}
.tab.active .tab-count { background: var(--color-primary-50); color: var(--color-primary); }

/* ----- Drawer (debtor detail) ------------------------------------------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 90;
  animation: fadeIn 0.18s ease;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 640px;
  max-width: 95vw;
  background: var(--surface);
  z-index: 91;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.24s ease;
}
.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

/* ----- Timeline ---------------------------------------------------------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--color-primary-100);
}
.timeline-item .timeline-time { font-size: 11.5px; color: var(--text-muted); }
.timeline-item .timeline-title { font-size: 13.5px; font-weight: 600; margin-top: 2px; }
.timeline-item .timeline-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* ----- Misc -------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.page-header .page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-header .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-lg { font-size: 16px; }
.text-bold { font-weight: 700; }
.text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.text-emerald { color: var(--emerald); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-primary { color: var(--color-primary); }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.stat-box .stat-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-box .stat-value { font-size: 18px; font-weight: 700; margin-top: 3px; }

.callout {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid;
}
.callout-info { background: var(--sky-soft); border-color: #7dd3fc; color: #075985; }
.callout-warning { background: var(--amber-soft); border-color: #fcd34d; color: #92400e; }
.callout-success { background: var(--emerald-soft); border-color: #6ee7b7; color: #065f46; }
.callout-error { background: var(--red-soft); border-color: #fca5a5; color: #991b1b; }

.code-block {
  background: var(--sidebar-bg-2);
  color: #e2e8f0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
}

.starter-prompts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.starter-prompt {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.starter-prompt:hover { background: var(--color-primary-50); color: var(--color-primary); border-color: var(--color-primary); }

.severity-critical { border-left: 4px solid var(--red); }
.severity-warning  { border-left: 4px solid var(--amber); }
.severity-info     { border-left: 4px solid var(--sky); }

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid var(--border-strong);
  cursor: pointer;
}

/* ----- Mobile ----------------------------------------------------------- */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar .hamburger { display: block; }
  .topbar .topbar-search { display: none; }
  .view-container { padding: 16px; }
  .chat-container { grid-template-columns: 1fr; height: 600px; }
  .chat-sidebar { display: none; }
  .drawer { width: 100%; }
}

@media (max-width: 600px) {
  .page-header h1 { font-size: 17px; }
  .kpi-value { font-size: 22px; }
  .form-row { grid-template-columns: 1fr; }
}

/* Mobile backdrop for sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 25;
}
.sidebar-backdrop.show { display: block; }
