/* ═══════════════════════════════════════════════════════════════════════════
   AKQUISITOR AI — Enterprise Design System v2
   Reference: Microsoft Dynamics · SAP · Salesforce Lightning
   Stack: Vanilla CSS, dark-first, body.light for light mode
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Design Tokens: Dark Mode ────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:         #0d0d10;   /* page background — alias for legacy code */
  --bg1:        #0d0d10;
  --bg2:        #13131a;   /* card / sidebar background */
  --bg3:        #1a1a24;   /* elevated surface, hover */
  --bg4:        #22222f;   /* input, deep surface */

  /* Borders */
  --border:        #28283a;
  --border-strong: #38384f;

  /* Typography */
  --text:       #dcdce8;
  --text-muted: #6a6a80;
  --text-dim:   #40404d;

  /* Brand */
  --primary:     #4263eb;  /* Salesforce-esque professional blue */
  --primary-h:   #6b84f5;  /* lighter for links / accents */
  --primary-dim: #1a2566;  /* tinted background */

  /* Semantic */
  --success:  #16a34a;
  --warning:  #d97706;
  --danger:   #dc2626;
  --info:     #2563eb;

  /* Geometry */
  --radius:    2px;   /* sharp — enterprise feel */
  --radius-sm: 1px;

  /* Layout */
  --sidebar-w:   224px;
  --sidebar-w-c: 44px;

  /* Shadows */
  --shadow:    0 1px 4px rgba(0,0,0,.5);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.6);

  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ── Design Tokens: Light Mode ───────────────────────────────────────────── */
body.light {
  --bg:         #f2f2f5;
  --bg1:        #f2f2f5;
  --bg2:        #ffffff;
  --bg3:        #ededf2;
  --bg4:        #e4e4ec;
  --border:        #d0d0dd;
  --border-strong: #b0b0c4;
  --text:       #111120;
  --text-muted: #5a5a72;
  --text-dim:   #9898aa;
  --primary:     #3254d8;
  --primary-h:   #2645c0;
  --primary-dim: #dce4ff;
  --success:  #15803d;
  --warning:  #b45309;
  --danger:   #b91c1c;
  --info:     #1d4ed8;
  --shadow:    0 1px 4px rgba(0,0,0,.12);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.15);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg1);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary-h); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: var(--font); }

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

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow: hidden;
  transition: width .18s ease;
  flex-shrink: 0;
}

#content-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 24px 28px;
  min-height: 100vh;
  transition: margin-left .18s ease;
  background: var(--bg1);
}

/* ── Sidebar Logo ────────────────────────────────────────────────────────── */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 16px 14px 13px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 52px;
}
.logo-icon { color: var(--primary-h); flex-shrink: 0; }
.logo-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
}

/* ── Nav List ────────────────────────────────────────────────────────────── */
.nav-list {
  list-style: none;
  padding: 6px 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.nav-list::-webkit-scrollbar { width: 3px; }
.nav-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 0; }

.nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--text-dim);
  padding: 14px 14px 3px;
  text-transform: uppercase;
  white-space: nowrap;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
  transition: background .1s, color .1s;
  white-space: nowrap;
  border-left: 2px solid transparent;
  cursor: pointer;
}
.nav-link:hover {
  background: var(--bg3);
  color: var(--text);
  text-decoration: none;
}
.nav-link.active {
  background: var(--bg3);
  color: var(--text);
  border-left-color: var(--primary);
  font-weight: 500;
}

.nav-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .65;
}
.nav-link:hover .nav-icon,
.nav-link.active .nav-icon { opacity: 1; }
.nav-icon svg { width: 15px; height: 15px; }
.nav-label { font-size: 13px; overflow: hidden; white-space: nowrap; }

/* ── Nav Footer ──────────────────────────────────────────────────────────── */
.nav-footer {
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.nav-user { padding: 10px 14px 6px; }
.nav-user-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-user-role {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.nav-logout { color: var(--text-muted) !important; }
.nav-logout:hover { color: var(--danger) !important; background: rgba(220,38,38,.06) !important; text-decoration: none; }

/* ── Collapsed Sidebar ───────────────────────────────────────────────────── */
body.sidebar-collapsed #sidebar { width: var(--sidebar-w-c); }
body.sidebar-collapsed #content-area { margin-left: var(--sidebar-w-c); }
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .nav-section,
body.sidebar-collapsed .nav-user { display: none; }
body.sidebar-collapsed .nav-link { padding: 8px; justify-content: center; border-left: none; }
body.sidebar-collapsed .sidebar-logo { padding: 14px; justify-content: center; }
body.sidebar-collapsed .nav-logout { justify-content: center; }

/* ── Page Header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
}

/* ── Stats Bar (connected tiles, enterprise KPI strip) ───────────────────── */
.stats-bar {
  display: flex;
  gap: 0;
  background: var(--border);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}
.stat-item {
  flex: 1;
  background: var(--bg2);
  padding: 14px 18px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.stat-item:last-child { border-right: none; }
.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.03em;
  line-height: 1;
  margin-bottom: 3px;
}
.stat-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
}

/* ── Filter Bar ──────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar select,
.filter-bar input {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 9px;
  font-size: 12px;
  outline: none;
  transition: border-color .1s;
  font-family: var(--font);
}
.filter-bar select:focus,
.filter-bar input:focus { border-color: var(--primary); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  background: var(--bg3);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .1s, border-color .1s, color .1s;
  white-space: nowrap;
  letter-spacing: .01em;
  font-family: var(--font);
  line-height: 1.4;
}
.btn:hover { background: var(--bg4); text-decoration: none; }
.btn:active { opacity: .85; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: #3252c8; border-color: #3252c8; }

.btn-success {
  background: rgba(22,163,74,.12);
  border-color: rgba(22,163,74,.35);
  color: var(--success);
}
.btn-success:hover { background: rgba(22,163,74,.2); }

.btn-danger {
  background: rgba(220,38,38,.1);
  border-color: rgba(220,38,38,.35);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(220,38,38,.18); }

.btn-warning {
  background: rgba(217,119,6,.1);
  border-color: rgba(217,119,6,.35);
  color: var(--warning);
}
.btn-warning:hover { background: rgba(217,119,6,.18); }

.btn-secondary {
  background: var(--bg3);
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-secondary:hover { color: var(--text); background: var(--bg4); }

.btn-sm { padding: 3px 8px; font-size: 11px; }
.btn-lg { padding: 8px 16px; font-size: 13px; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  border: 1px solid transparent;
  line-height: 1.4;
}
.badge-blue,    .badge-active   { background:rgba(66,99,235,.14); color:#6b84f5; border-color:rgba(66,99,235,.3); }
.badge-green                    { background:rgba(22,163,74,.12);  color:#22c55e; border-color:rgba(22,163,74,.3);  }
.badge-yellow,  .badge-paused   { background:rgba(217,119,6,.12);  color:#f59e0b; border-color:rgba(217,119,6,.3);  }
.badge-red,     .badge-disabled { background:rgba(220,38,38,.1);   color:#f87171; border-color:rgba(220,38,38,.3);  }
.badge-gray                     { background:var(--bg4); color:var(--text-muted); border-color:var(--border); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .09em;
  margin-bottom: 5px;
}
input[type=text], input[type=email], input[type=password],
input[type=number], select, textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font);
  transition: border-color .1s;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input::placeholder, textarea::placeholder { color: var(--text-dim); }
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--bg3); color: var(--text); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-container {
  background: var(--bg2);
  border: 1px solid var(--border);
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--bg3);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg3); }
.loading-row, .empty-row, .error-row {
  text-align: center;
  color: var(--text-muted);
  padding: 36px !important;
  font-size: 13px;
}
.error-row { color: var(--danger); }
.text-center { text-align: center !important; }
.table-link { color: var(--primary-h); font-weight: 500; }
.table-link:hover { text-decoration: underline; }

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border-strong);
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 14px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Login Page ──────────────────────────────────────────────────────────── */
body:has(.login-box) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg1);
}
.login-box {
  width: 360px;
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.login-logo {
  font-size: 28px;
  text-align: center;
  margin-bottom: 6px;
}
.login-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 3px;
}
.login-sub {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.login-error {
  background: rgba(220,38,38,.08);
  border: 1px solid rgba(220,38,38,.3);
  color: var(--danger);
  padding: 8px 12px;
  font-size: 12px;
  margin-bottom: 14px;
  display: none;
}
.btn-login { width: 100%; justify-content: center; padding: 9px; font-size: 13px; margin-top: 6px; }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
code {
  background: var(--bg4);
  padding: 1px 5px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--primary-h);
}

/* ── Date Cell (appointments) ────────────────────────────────────────────── */
.date-cell { display: flex; flex-direction: column; }
.date-cell .date { font-size: 13px; font-weight: 500; }
.date-cell .time { font-size: 11px; color: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  #content-area { padding: 16px; }
  .stats-bar { flex-wrap: wrap; }
  .stat-item { min-width: 45%; }
}
@media (max-width: 600px) {
  #sidebar { position: fixed; }
  body.sidebar-collapsed #sidebar { width: 0; }
  body.sidebar-collapsed #content-area { margin-left: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LEGACY SUPPORT — all old class names remain functional
   ═══════════════════════════════════════════════════════════════════════════ */

/* Old layout classes */
.content    { }
.page-title { font-size: 17px; font-weight: 600; margin-bottom: 18px; color: var(--text); }
.section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--text-muted);
  margin: 22px 0 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Old stat-card grid */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg2);
  padding: 14px 16px;
}
.stat-card .stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.stat-card .stat-value { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 4px; letter-spacing: -.02em; }
.stat-callable .stat-value { color: var(--primary-h); }

/* Old table-wrapper */
.table-wrapper { background: var(--bg2); border: 1px solid var(--border); overflow: auto; margin-bottom: 20px; }
.table-wrapper table { width: 100%; border-collapse: collapse; }
.table-wrapper th { background: var(--bg3); padding: 9px 14px; text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.table-wrapper td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-wrapper tr:last-child td { border-bottom: none; }
.table-wrapper tr:hover td { background: var(--bg3); }
.loading, .empty { text-align: center; color: var(--text-muted); padding: 32px; display: block; }
.error { text-align: center; color: var(--danger); padding: 32px; display: block; }

/* Old control-panel */
.control-panel { background: var(--bg2); border: 1px solid var(--border); padding: 16px; margin-bottom: 18px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.result-area { display: none; margin-top: 14px; max-height: 220px; overflow-y: auto; background: var(--bg3); padding: 10px; font-size: 12px; }
.result-area.visible { display: block; }
.run-status { font-size: 13px; margin-bottom: 6px; }
.run-status--running  { color: var(--primary-h); }
.run-status--finished { color: var(--success); }
.run-status--error    { color: var(--danger); }
.result-row { font-size: 12px; color: var(--text-muted); padding: 2px 0; }

/* Old nav-cards */
.nav-cards { display: flex; gap: 10px; flex-wrap: wrap; }
.nav-card { background: var(--bg2); border: 1px solid var(--border); padding: 11px 18px; color: var(--text); font-weight: 600; font-size: 13px; transition: background .1s; cursor: pointer; }
.nav-card:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.auto-status { font-size: 12px; color: var(--text-muted); margin-left: 8px; }

/* Old badge variants */
.badge-new          { background: rgba(66,99,235,.12); color: #6b84f5; }
.badge-attempted    { background: rgba(217,119,6,.12);  color: var(--warning); }
.badge-interested   { background: rgba(22,163,74,.12);  color: var(--success); }
.badge-not_interested, .badge-no_answer { background: rgba(220,38,38,.1); color: #f87171; }
.badge-converted    { background: rgba(66,99,235,.12); color: #6b84f5; }
.badge-queued       { background: rgba(66,99,235,.12); color: #6b84f5; }
.badge-draft        { background: var(--bg4); color: var(--text-muted); }

/* Queue status colors */
.queue-next td { background: rgba(66,99,235,.06) !important; }
.queue-soon td { background: rgba(66,99,235,.03) !important; }

/* Sidebar toggle button (legacy) */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 8px 14px;
}
