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

:root {
  --gold: #C9A227;
  --gold-mid: #D4AF37;
  --gold-light: #E8C547;
  --gold-pale: rgba(201, 162, 39, 0.12);
  --gold-border: rgba(201, 162, 39, 0.28);
  --gold-glow: rgba(201, 162, 39, 0.35);
  --white: #FFFFFF;
  --bg: #F4F1EB;
  --bg-alt: #FAF8F5;
  --sidebar-bg: #12110F;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-text: #A8A29E;
  --sidebar-text-active: #FAFAF9;
  --text: #1A1814;
  --text-secondary: #44403C;
  --text-muted: #78716C;
  --border: rgba(28, 25, 23, 0.08);
  --border-light: rgba(28, 25, 23, 0.05);
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04), 0 2px 8px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 4px 6px rgba(28, 25, 23, 0.04), 0 12px 32px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 8px 16px rgba(28, 25, 23, 0.06), 0 24px 48px rgba(201, 162, 39, 0.14);
  --shadow-card: 0 0 0 1px rgba(28, 25, 23, 0.06), 0 4px 24px rgba(28, 25, 23, 0.06);
  --success: #15803D;
  --success-bg: #DCFCE7;
  --danger: #B91C1C;
  --danger-bg: #FEE2E2;
  --warning: #B45309;
  --warning-bg: #FEF3C7;
  --info: #1D4ED8;
  --info-bg: #DBEAFE;
  --sidebar-w: 272px;
  --topbar-h: 68px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', 'Montserrat', 'Segoe UI', sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 60% at 50% -20%, rgba(201, 162, 39, 0.09), transparent),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(201, 162, 39, 0.05), transparent),
    radial-gradient(ellipse 40% 30% at 0% 100%, rgba(28, 25, 23, 0.03), transparent);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; font-weight: 500; }
a:hover { color: var(--gold-mid); }

/* ===== APP SHELL ===== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  text-align: center;
}

.sidebar-brand img {
  max-width: 170px;
  height: auto;
  filter: brightness(1.08);
}

.sidebar-brand .tagline {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold-mid);
  margin-top: 10px;
  font-weight: 600;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section {
  margin-bottom: 20px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
  padding: 0 12px 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.sidebar-nav a i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.35);
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text-active);
}

.sidebar-nav a:hover i { color: var(--gold-mid); }

.sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.2), rgba(201, 162, 39, 0.08));
  color: var(--gold-light);
  font-weight: 600;
  border: 1px solid rgba(201, 162, 39, 0.25);
  box-shadow: 0 0 20px rgba(201, 162, 39, 0.08);
}

.sidebar-nav a.active i { color: var(--gold-mid); }

.sidebar-footer {
  padding: 16px 12px 20px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: #F87171;
  font-size: 13px;
  font-weight: 500;
}

.sidebar-footer a:hover { background: rgba(248, 113, 113, 0.1); }

/* Main area */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb strong { color: var(--text); font-weight: 600; }

.topbar-search {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  gap: 8px;
  width: 280px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.topbar-search:focus-within {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 3px var(--gold-pale);
}

.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  width: 100%;
  color: var(--text);
  font-family: inherit;
}

.topbar-search i { color: var(--text-muted); font-size: 13px; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
  transition: all 0.18s;
}

.topbar-btn:hover { border-color: var(--gold-border); color: var(--gold); background: var(--gold-pale); }

.notif-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--white);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  cursor: pointer;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}

.user-chip .name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-chip .role { font-size: 11px; color: var(--text-muted); }

.main-content { padding: 28px 32px 48px; flex: 1; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.page-header .subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ===== CARDS ===== */
.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title i { color: var(--gold); }

.card-title .gold-bar {
  width: 4px; height: 18px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  border-radius: 2px;
  display: inline-block;
}

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold-mid));
}

.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold-pale), rgba(201, 162, 39, 0.06));
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  font-size: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--gold-border);
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin: 4px 0;
}

.stat-card .sub {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-card .trend-up { color: var(--success); font-weight: 600; }
.stat-card .trend-down { color: var(--danger); font-weight: 600; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn:disabled,
.btn[aria-busy="true"] {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-mid) 50%, var(--gold-light) 100%);
  color: var(--white);
  box-shadow: 0 4px 14px var(--gold-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-mid), var(--gold-light));
  box-shadow: 0 6px 20px var(--gold-glow);
  transform: translateY(-2px);
}

.btn-outline {
  background: var(--white);
  border: 1.5px solid var(--gold-border);
  color: var(--gold);
}

.btn-outline:hover { background: var(--gold-pale); border-color: var(--gold); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover { border-color: var(--gold-border); color: var(--gold); background: var(--gold-pale); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #991B1B; }

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-icon { padding: 8px 10px; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead {
  background: linear-gradient(180deg, var(--bg-alt), rgba(250, 248, 245, 0.6));
}

th {
  text-align: left;
  padding: 13px 16px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: none;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: rgba(201, 162, 39, 0.04); }
tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-new { background: var(--info-bg); color: var(--info); }
.badge-calling { background: var(--warning-bg); color: var(--warning); }
.badge-qualified { background: #E0F2FE; color: #0369A1; }
.badge-scheduled { background: var(--gold-pale); color: var(--gold); border: 1px solid var(--gold-border); }
.badge-won { background: var(--success-bg); color: var(--success); }
.badge-lost { background: var(--danger-bg); color: var(--danger); }
.badge-cancelled { background: #F3F4F6; color: #6B7280; }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-sent { background: var(--success-bg); color: var(--success); }
.badge-high { background: var(--danger-bg); color: var(--danger); }
.badge-medium { background: var(--warning-bg); color: var(--warning); }
.badge-low { background: var(--success-bg); color: var(--success); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,39,0.15);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 17, 15, 0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 92%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-overlay.open { display: flex; }

.modal h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gold-pale);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* ===== PIPELINE ===== */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.pipeline-column {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  min-height: 320px;
  box-shadow: var(--shadow-sm);
}

.pipeline-column h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gold-pale);
}

.pipeline-card {
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
}

.pipeline-card:hover {
  border-color: var(--gold-border);
  box-shadow: var(--shadow-sm);
  background: var(--white);
}

/* ===== INTEGRATIONS ===== */
.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.integration-item {
  text-align: center;
  padding: 20px 16px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  transition: all 0.18s;
}

.integration-item:hover { border-color: var(--gold-border); background: var(--gold-pale); }

.integration-item .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-bottom: 10px;
}

.dot-on { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.dot-off { background: #D1D5DB; }

.integration-item .int-name { font-weight: 600; font-size: 13px; color: var(--text); }
.integration-item .int-status { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== CALENDAR ===== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cal-header {
  background: var(--gold-pale);
  padding: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
}

.cal-day {
  background: var(--white);
  min-height: 100px;
  padding: 10px;
  font-size: 12px;
}

.cal-day.other-month { background: var(--bg); color: var(--text-muted); }
.cal-day.today { background: #FFFCF5; }
.cal-day .day-num { font-weight: 700; color: var(--text); margin-bottom: 6px; }

.cal-event {
  background: var(--gold-pale);
  border-left: 3px solid var(--gold);
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 10px;
  margin-bottom: 3px;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* ===== TASKS ===== */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--white);
  transition: all 0.18s;
}

.task-item:hover { border-color: var(--gold-border); box-shadow: var(--shadow-sm); }
.task-item.done { opacity: 0.6; }
.task-item.done .task-title { text-decoration: line-through; }

.task-check {
  width: 22px; height: 22px;
  border: 2px solid var(--gold-border);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
  transition: all 0.18s;
}

.task-check.checked { background: var(--gold); border-color: var(--gold); color: var(--white); }

.task-title { font-weight: 600; color: var(--text); font-size: 14px; }
.task-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== ACTIVITY FEED ===== */
.activity-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gold-pale);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  flex-shrink: 0;
  font-size: 14px;
}

.activity-body .act-action { font-weight: 600; color: var(--text); font-size: 13px; }
.activity-body .act-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.activity-body .act-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-left {
  background:
    radial-gradient(ellipse 80% 80% at 20% 20%, rgba(255, 255, 255, 0.12), transparent),
    linear-gradient(155deg, #1A1814 0%, #2D2618 40%, #C9A227 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
}

.login-left img {
  max-width: 260px;
  margin-bottom: 32px;
  filter: brightness(1.05);
}

.login-left h2 { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.login-left p { font-size: 15px; opacity: 0.9; line-height: 1.7; max-width: 360px; text-align: center; }

.login-features { margin-top: 40px; display: flex; flex-direction: column; gap: 14px; }
.login-features .feat { display: flex; align-items: center; gap: 12px; font-size: 14px; opacity: 0.95; }
.login-features .feat i { width: 32px; height: 32px; background: rgba(255,255,255,0.15); border-radius: 8px; display: flex; align-items: center; justify-content: center; }

.login-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  background: var(--bg);
  background-image: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(201, 162, 39, 0.06), transparent);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.9);
  padding: 40px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.login-card h1 { font-size: 26px; font-weight: 800; color: var(--text); margin-bottom: 6px; letter-spacing: -0.4px; }
.login-card .subtitle { color: var(--text-muted); margin-bottom: 32px; font-size: 14px; }

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  display: none;
  border: 1px solid #FECACA;
}

.cred-box {
  margin-top: 24px;
  padding: 16px;
  background: var(--gold-pale);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  font-size: 13px;
}

.cred-box .cred-title { font-weight: 700; color: var(--gold); margin-bottom: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.cred-box p { margin: 4px 0; color: var(--text-secondary); }
.cred-box strong { color: var(--text); }

/* ===== QUICK ACTIONS ===== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.22s ease;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.quick-action i {
  font-size: 22px;
  color: var(--gold);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-pale);
  border-radius: 12px;
  border: 1px solid var(--gold-border);
  transition: transform 0.22s;
}

.quick-action:hover {
  border-color: var(--gold-border);
  background: var(--white);
  color: var(--gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.quick-action:hover i {
  transform: scale(1.08);
  background: linear-gradient(135deg, var(--gold-pale), rgba(201, 162, 39, 0.08));
}

/* ===== SCRIPTS ===== */
.script-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}

.script-card h4 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.script-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.7; white-space: pre-line; }

/* ===== UTILITIES ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); font-weight: 600; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state i { font-size: 40px; color: var(--gold-border); margin-bottom: 16px; display: block; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item {
  padding: 14px 22px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
}
.toast-success { background: var(--success); color: var(--white); }
.toast-error { background: var(--danger); color: var(--white); }
.toast-info { background: var(--gold); color: var(--white); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Live auto-refresh indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.live-indicator .live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: livePulse 2s infinite;
}
.live-indicator.refreshing .live-dot { animation-duration: 0.8s; }
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Agent panel */
.agent-panel { text-align: center; padding: 40px 32px; }
.agent-orb {
  width: 140px; height: 140px; border-radius: 50%; margin: 0 auto 24px;
  background: linear-gradient(145deg, rgba(255,255,255,0.95), var(--gold-pale));
  border: 2px solid var(--gold-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: var(--gold);
  box-shadow: 0 8px 32px rgba(201, 162, 39, 0.2), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: all 0.3s;
  position: relative;
}
.agent-orb::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), transparent, var(--gold-light));
  z-index: -1;
  opacity: 0.4;
}
.agent-orb.calling {
  border-color: var(--gold-mid);
  box-shadow: 0 0 0 12px rgba(201, 162, 39, 0.12), 0 8px 40px rgba(201, 162, 39, 0.3);
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }

/* Responsive */
@media (max-width: 1024px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-left { display: none; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-wrap { margin-left: 0; }
  .main-content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .topbar-search { display: none; }
  .form-row { grid-template-columns: 1fr; }
}

/* ===== Usage & Price (aligned to Novara shell) ===== */
.usage-page { --usage-gap: 16px; --usage-panel-h: 420px; }
.usage-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--usage-gap);
  margin-bottom: var(--usage-gap);
  align-items: stretch;
}
.usage-kpis .stat-card {
  display: flex;
  flex-direction: column;
  min-height: 148px;
  height: 100%;
  margin: 0;
}
.usage-kpis .stat-card .sub {
  margin-top: auto;
  min-height: 2.4em;
  line-height: 1.35;
}
.usage-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--usage-gap);
  align-items: stretch;
}
.usage-agents-card,
.usage-calls-card {
  display: flex;
  flex-direction: column;
  height: var(--usage-panel-h);
  min-height: var(--usage-panel-h);
  max-height: var(--usage-panel-h);
  margin-bottom: 0;
  overflow: hidden;
}
.usage-agents-card .card-header,
.usage-calls-card .card-header {
  flex-shrink: 0;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.usage-hint { margin: 0; font-size: 12px; color: var(--text-muted); text-align: right; }
.usage-agents,
.usage-calls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 2px;
}
.usage-agents:has(.empty-state),
.usage-calls:has(.empty-state) {
  justify-content: center;
  align-items: center;
}
.usage-agent {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.18s, background 0.18s;
}
.usage-agent:hover { border-color: var(--gold-border); }
.usage-agent.is-active {
  border-color: var(--gold-border);
  background: var(--gold-pale);
}
.usage-agent-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  background: var(--gold-pale); color: var(--gold); border: 1px solid var(--gold-border);
}
.usage-agent-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.usage-agent-meta strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usage-agent-meta span { font-size: 11px; color: var(--text-muted); }
.usage-bar { margin-top: 6px; height: 4px; border-radius: 999px; background: var(--border-light); overflow: hidden; }
.usage-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.usage-agent-nums { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; }
.usage-num-el { font-size: 12px; font-weight: 700; color: var(--gold); }
.usage-num-tw { font-size: 11px; color: var(--text-muted); }
.usage-call {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  overflow: hidden;
  flex-shrink: 0;
}
.usage-call[open] { border-color: var(--gold-border); box-shadow: var(--shadow-card); }
.usage-call-summary {
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; cursor: pointer; user-select: none;
}
.usage-call-summary::-webkit-details-marker { display: none; }
.usage-call-main { min-width: 0; }
.usage-call-main strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usage-call-sub { font-size: 12px; color: var(--text-muted); }
.usage-call-chips { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.usage-chip { font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 8px; background: var(--bg-alt); color: var(--text); }
.usage-chip--el { background: var(--gold-pale); color: var(--gold); }
.usage-chip--tw { background: var(--bg-alt); color: var(--text-secondary); }
.usage-chip--tx { background: var(--success-bg); color: var(--success); }
.usage-chevron { font-size: 11px; color: var(--text-muted); transition: transform 0.2s; }
.usage-call[open] .usage-chevron { transform: rotate(180deg); }
.usage-call-detail { padding: 0 16px 16px; border-top: 1px solid var(--border-light); }
.usage-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 0 8px; }
.usage-detail-grid .label { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.usage-detail-grid strong { font-size: 13px; font-weight: 600; }
.usage-detail-grid .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; word-break: break-all; }
.usage-transcript-wrap { margin-top: 8px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-alt); }
.usage-transcript-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.usage-chat { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; }
.usage-bubble { max-width: 92%; padding: 10px 12px; border-radius: 14px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.usage-bubble p { margin: 0; }
.usage-bubble-role { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; opacity: 0.7; }
.usage-bubble--agent { align-self: flex-start; background: var(--gold-pale); border: 1px solid var(--gold-border); border-bottom-left-radius: 4px; }
.usage-bubble--user { align-self: flex-end; background: var(--white); border: 1px solid var(--border); border-bottom-right-radius: 4px; }
.usage-bubble--system { align-self: center; max-width: 100%; border: 1px dashed var(--border); color: var(--text-muted); font-size: 12px; text-align: center; }
.usage-transcript-empty { padding: 18px; text-align: center; color: var(--text-muted); font-size: 13px; }
.usage-detail-actions { margin-top: 12px; display: flex; gap: 8px; }

@media (max-width: 1100px) {
  .usage-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-split { grid-template-columns: 1fr; }
  .usage-agents-card, .usage-calls-card { height: auto; min-height: 280px; max-height: none; }
  .usage-agents, .usage-calls { max-height: 360px; }
}
@media (max-width: 640px) {
  .usage-kpis { grid-template-columns: 1fr; }
  .usage-detail-grid { grid-template-columns: 1fr; }
}

/* ===== Show more / Show less (shared) ===== */
.show-more-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}
.show-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--gold-border);
  background: var(--gold-pale);
  color: var(--gold);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.show-more-btn:hover {
  background: rgba(201, 162, 39, 0.2);
  border-color: var(--gold);
}
.show-more-btn-all {
  background: var(--white);
  border-style: dashed;
}
.show-more-btn-less {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.show-more-btn-less:hover {
  border-color: var(--gold-border);
  color: var(--gold);
}
.pipeline-column .show-more-bar {
  flex-direction: column;
  border-top: none;
  padding-top: 8px;
  margin-top: 8px;
}
.pipeline-column .show-more-btn {
  width: 100%;
  border-radius: 10px;
}
