/* ═══════════════════════════════════════════════════════════════
   AI CALL CENTER — DESIGN SYSTEM
   Modern, clean, utility-first
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Space+Mono:wght@400;700&display=swap');

/* ─── THEME TOKENS ─── */
:root {
  --bg:           #f8f9fb;
  --surface:      #ffffff;
  --surface2:     #f3f4f6;
  --surface-solid: #ffffff;
  --border:       #e5e7eb;
  --border2:      #d1d5db;

  --text:         #1f2937;
  --text-dim:     #6b7280;

  --blue:         #4f7cef;
  --blue-soft:    rgba(79,124,239,.07);
  --cyan:         #4f7cef;      /* cyan → blue'a eşitlendi */
  --green:        #22c55e;
  --red:          #ef4444;
  --amber:        #f59e0b;
  --purple:       #4f7cef;      /* purple → blue'a eşitlendi */

  --primary:      #4f7cef;
  --bg-card:      #ffffff;
  --bg-hover:     #f3f4f6;

  --shadow-sm:    0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 2px 8px rgba(0,0,0,.06);
  --shadow-lg:    0 4px 16px rgba(0,0,0,.08);
  --shadow-card:  0 0 0 1px rgba(0,0,0,.04);

  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;

  --font:         'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:         'Space Mono', 'SF Mono', monospace;
  --transition:   .25s ease-out;
}

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mono { font-family: var(--mono); }

::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ─── LAYOUT — Sidebar + Content ─── */
.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: 232px;
  min-width: 232px;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.sidebar-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 16px;
  margin-top: 6px;
  border: none;
  border-left: 2px solid transparent;
  background: none;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: .05em;
  cursor: pointer;
  transition: all .15s;
}

.sidebar-group-label:hover {
  color: var(--blue);
  background: rgba(0,71,141,.03);
}

.sidebar-group-label.has-active {
  color: var(--primary);
  border-left-color: var(--primary);
}

.sidebar-group-label:not(.has-active) {
  color: var(--text);
  border-left-color: transparent;
}

.sidebar-group-label .accordion-arrow {
  font-size: 12px;
  transition: transform .2s ease;
  opacity: 0.5;
}

.sidebar-group-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}

.sidebar-group-items.open {
  max-height: 500px;
}

.nav-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 16px 7px 28px;
  border: none;
  background: none;
  border-radius: 0;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-align: left;
}

.nav-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-btn.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 500;
  border-right: 2px solid var(--blue);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ─── MAIN CONTENT ─── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 32px 36px;
  overflow-y: auto;
}

.content-inner {
  animation: fadeUp .35s ease;
  max-width: 1400px;
}

/* ─── HEADER (artık kullanılmıyor ama agent.html için korunuyor) ─── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 68px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 220px;
}

.nav-menu {
  display: flex;
  gap: 4px;
}

/* ─── PANELS / CARDS ─── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Modal kart bileşeni — panel ile aynı stil, overflow görünür */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}

.agent-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border2);
}

.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.agent-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge.active   { background: rgba(34,197,94,.08);  color: var(--green); }
.badge.ended    { background: rgba(107,116,144,.07); color: var(--text-dim); }
.badge.transferred { background: rgba(79,124,239,.07); color: var(--blue); }

.badge.support    { background: rgba(79,124,239,.07); color: var(--blue); }
.badge.sales      { background: rgba(34,197,94,.07);  color: var(--green); }
.badge.appointment { background: rgba(79,124,239,.07); color: var(--blue); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.btn.primary:hover:not(:disabled) {
  background: #3d6be0;
  box-shadow: 0 2px 8px rgba(79,124,239,.2);
}

.btn.outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn.outline:hover:not(:disabled) {
  background: var(--surface2);
  border-color: var(--border2);
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-sm:hover {
  background: var(--surface2);
  border-color: var(--border2);
}

.btn-sm:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* ─── FORMS ─── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: all var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,109,240,.1);
}

.form-input::placeholder {
  color: var(--text-dim);
  opacity: .6;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7490' viewBox='0 0 16 16'%3E%3Cpath d='m4.427 6.427 3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ─── MODAL / OVERLAY ─── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn .2s ease;
  padding: 24px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: slideUp .25s ease;
}

.modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--surface2);
  border-radius: 8px;
  font-size: 18px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
}

.close-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* ─── TOAST ─── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  animation: slideIn .3s ease-out;
  min-width: 280px;
}

.toast.toast-success { border-left-color: var(--green); }
.toast.toast-error   { border-left-color: var(--red); }
.toast.toast-warning { border-left-color: var(--amber); }
.toast.toast-info    { border-left-color: var(--blue); }

/* ─── RANGE SLIDERS ─── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

/* ─── CHECKBOX ─── */
input[type="checkbox"] {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ─── ANIMATIONS ─── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.fade-in {
  animation: fadeUp .35s ease;
}

/* ─── UTILITIES ─── */
code, pre {
  font-family: var(--mono);
}

optgroup {
  font-weight: 700;
  font-family: var(--font);
}

/* ─── DASHBOARD ─── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.dash-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.dash-stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border2);
}

.dash-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.dash-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--mono);
  line-height: 1.1;
  margin-top: 2px;
}

.dash-stat-pulse {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  50% { opacity: .7; box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* ─── DASHBOARD GRID ─── */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(0, 1.8fr);
  gap: 20px;
}

.dash-live-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}

.dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.dash-count-badge {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  animation: pulse 2s infinite;
}

/* ─── LIVE CALL CARD ─── */
.dash-live-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.dash-live-card:hover {
  border-color: var(--border2);
  background: #fff;
}

.dash-live-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-live-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(59,109,240,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.dash-live-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-live-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.dash-live-timer {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ─── DASHBOARD TABLE ─── */
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.dash-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.dash-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.dash-table tbody tr:last-child td {
  border-bottom: none;
}

.dash-table tbody tr:hover {
  background: rgba(59,109,240,.02);
}

.dash-table-empty {
  text-align: center;
  padding: 48px 20px !important;
  color: var(--text-dim);
  font-size: 14px;
}

/* ─── TRANSCRIPT ─── */
.transcript-msg {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.transcript-msg:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.transcript-role {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.transcript-role.user {
  color: var(--blue);
}

.transcript-role.assistant {
  color: var(--green);
}

.transcript-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.no-data {
  text-align: center;
  padding: 32px;
  color: var(--text-dim);
  font-size: 14px;
}

/* ─── QC PAGE ─── */
.qc-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.qc-meta-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.qc-step-result {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  transition: all var(--transition);
}

.qc-step-result:hover {
  background: rgba(241,244,249,.8);
}

.qc-mini-stat {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  text-align: center;
}

.qc-mini-stat-value {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
  line-height: 1;
}

.qc-mini-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.qc-step-editor {
  padding: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.qc-step-editor:hover {
  border-color: var(--border2);
}

.qc-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.qc-step-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.qc-step-btn:hover:not(:disabled) {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--text);
}

.qc-step-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
}

/* ─── STATS PAGE ─── */
.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stats-kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}

.stats-kpi:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border2);
}

.stats-kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stats-kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.stats-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--mono);
  line-height: 1.1;
  margin-top: 2px;
}

.stats-kpi-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ─── ALARM & TRANSKRİPT ANİMASYONLARI ─── */
@keyframes alarmFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: .5; transform: scale(1.4); }
}

/* Transkript açıkken kart dikey flex olur */
.dash-live-card {
  display: flex;
  flex-direction: column !important;
}

/* Transkript alanı scroll çubuğu */
.live-transcript-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.live-transcript-scroll::-webkit-scrollbar { width: 4px; }
.live-transcript-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ─── LOGIN PAGE ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  animation: slideUp .35s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
  color: #fff;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}

.login-logo p {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 4px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-form .form-input {
  padding: 12px 16px;
  font-size: 15px;
}

.login-btn {
  width: 100%;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  border: none;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  transition: all var(--transition);
}

.login-btn:hover:not(:disabled) {
  background: #3d6be0;
  box-shadow: 0 2px 8px rgba(79,124,239,.2);
}

.login-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.login-error {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn .2s ease;
}

/* ─── SETTINGS / USAGE ─── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

.settings-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.usage-bar {
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--blue);
  transition: width .5s ease;
}

.usage-bar-fill.warn { background: var(--amber); }
.usage-bar-fill.danger { background: var(--red); }

.usage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.usage-row:last-child { border-bottom: none; }

.usage-label {
  color: var(--text-dim);
  font-weight: 600;
}

.usage-value {
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text);
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(59,109,240,.08);
  color: var(--blue);
}

.plan-badge.enterprise { background: rgba(139,92,246,.08); color: var(--purple); }

.input-with-toggle {
  position: relative;
}

.input-with-toggle .form-input {
  padding-right: 44px;
}

.input-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.input-toggle-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

/* ─── SUPER ADMIN LAYOUT ─── */
.sa-layout {
  display: flex;
  min-height: 100vh;
}

.sa-sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sa-sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sa-sidebar-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
}

.sa-sidebar-logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.sa-sidebar-logo-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

.sa-sidebar-nav {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sa-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}

.sa-sidebar-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.sa-sidebar-item.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.sa-sidebar-item .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sa-sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sa-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 0;
}

.sa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}

.sa-header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.sa-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sa-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

.sa-sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  width: fit-content;
}

.sa-sub-tab {
  padding: 8px 18px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.sa-sub-tab:hover {
  color: var(--text);
}

.sa-sub-tab.active {
  background: var(--surface);
  color: var(--blue);
  box-shadow: var(--shadow-sm);
}

/* ─── SUPER ADMIN TABLE ─── */
.sa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.sa-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.sa-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.sa-table tbody tr:last-child td { border-bottom: none; }

.sa-table tbody tr:hover { background: rgba(59,109,240,.02); }

.sa-table tbody tr { cursor: pointer; transition: background var(--transition); }

/* ─── SUPER ADMIN STATS CARDS ─── */
.sa-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.sa-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.sa-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}

.sa-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.sa-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--mono);
  line-height: 1.1;
  margin-top: 2px;
}

/* ─── TENANT STATUS BADGES ─── */
.badge.tenant-active  { background: rgba(34,197,94,.1); color: var(--green); }
.badge.tenant-trial   { background: rgba(59,109,240,.08); color: var(--blue); }
.badge.tenant-suspended { background: rgba(239,68,68,.08); color: var(--red); }

/* ─── USER AVATAR ─── */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.user-avatar.lg { width: 40px; height: 40px; font-size: 16px; }

/* ─── HEADER USER MENU ─── */
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--transition);
}

.header-user:hover {
  background: var(--surface2);
  border-color: var(--border2);
}

.header-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.header-user-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

/* ─── LOGOUT BUTTON ─── */
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.logout-btn:hover {
  background: rgba(239,68,68,.06);
  border-color: rgba(239,68,68,.2);
  color: var(--red);
}

/* ─── REGISTER PAGE ─── */
.register-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 560px;
  animation: slideUp .35s ease;
}

.plan-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.plan-card {
  padding: 18px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  background: var(--surface);
}

.plan-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
}

.plan-card.selected {
  border-color: var(--blue);
  background: rgba(59,109,240,.04);
  box-shadow: 0 0 0 3px rgba(59,109,240,.1);
}

.plan-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.plan-card-desc {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  line-height: 1.4;
}

.plan-card-features {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
}

.register-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-dim);
}

.register-footer a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.register-footer a:hover {
  text-decoration: underline;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1280px) {
  .dash-stats { grid-template-columns: repeat(3, 1fr); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-dept { grid-column: span 2; }
}

@media (max-width: 1024px) {
  .sidebar { width: 52px; min-width: 52px; }
  .sidebar .sidebar-header div > div { display: none; }
  .sidebar .sidebar-header { justify-content: center; padding: 12px 8px; }
  .sidebar .sidebar-group-label,
  .sidebar .sidebar-footer span:last-child { display: none; }
  .sidebar .sidebar-group-items { max-height: 500px !important; }
  .sidebar .nav-btn { justify-content: center; padding: 10px; font-size: 0; }
  .sidebar .nav-btn::first-letter { font-size: 12px; }
  .main-content { padding: 24px 20px; }
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-dept { grid-column: span 1; }
}

@media (max-width: 768px) {
  .sidebar { width: 48px; min-width: 48px; }
  .main-content { padding: 16px 12px; }
}

/* ═══════════════════════════════════════════════════════════════
   BILLING
   ═══════════════════════════════════════════════════════════════ */

.billing-container { max-width: 960px; }

.billing-loading { text-align: center; padding: 60px 0; color: var(--text-dim); font-size: 15px; }

.billing-plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}
.billing-plan-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.billing-plan-name { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.billing-plan-price { font-size: 26px; font-weight: 700; color: var(--blue); }
.billing-plan-period { font-size: 14px; font-weight: 500; color: var(--text-dim); }
.billing-plan-badge {
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: .03em;
}
.billing-plan-includes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.billing-plan-include-item { text-align: center; }
.billing-plan-include-val { display: block; font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.billing-plan-include-label { font-size: 12px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.billing-section-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

.billing-usage-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.billing-usage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.billing-usage-card {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}
.billing-usage-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
}
.billing-usage-val { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }
.billing-overage-text { font-size: 13px; color: var(--red); font-weight: 600; margin-top: 8px; }
.billing-overage-cost {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, .06);
  border: 1px solid rgba(239, 68, 68, .15);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--red);
}

.billing-invoices-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
}

.billing-empty {
  text-align: center;
  padding: 40px 0;
  color: var(--text-dim);
  font-size: 14px;
}

.billing-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
}

/* Billing Admin (Super Admin) */
.billing-admin { }

.billing-plan-form {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.billing-form-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.billing-form-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.billing-form-input:focus { border-color: var(--blue); }
.billing-form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

@media (max-width: 700px) {
  .billing-plan-includes { grid-template-columns: repeat(2, 1fr); }
  .billing-usage-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   AGENT MANAGEMENT — Toolbar, Table, Pagination, Bulk, Import
   ═══════════════════════════════════════════════════════════════ */

.agent-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.agent-toolbar .search-box {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  position: relative;
}

.agent-toolbar .search-box input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: all var(--transition);
  outline: none;
}

.agent-toolbar .search-box input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,109,240,.1);
}

.agent-toolbar .search-box .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 14px;
  pointer-events: none;
}

.agent-toolbar .filter-select {
  padding: 9px 32px 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7490' viewBox='0 0 16 16'%3E%3Cpath d='m4.427 6.427 3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  outline: none;
  transition: all var(--transition);
}

.agent-toolbar .filter-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,109,240,.1);
}

.view-toggle {
  display: flex;
  background: var(--surface2);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.view-toggle button {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  cursor: pointer;
  background: transparent;
  color: var(--text-dim);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}

.view-toggle button.active {
  background: var(--surface);
  color: var(--blue);
  box-shadow: var(--shadow-sm);
}

/* ─── Agent Table ─── */
.agent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.agent-table thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  white-space: nowrap;
  user-select: none;
}

.agent-table thead th.sortable {
  cursor: pointer;
  transition: color var(--transition);
}

.agent-table thead th.sortable:hover {
  color: var(--blue);
}

.agent-table thead th.sortable .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  opacity: .4;
  transition: opacity var(--transition);
}

.agent-table thead th.sortable.sorted .sort-arrow {
  opacity: 1;
  color: var(--blue);
}

.agent-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.agent-table tbody tr:last-child td { border-bottom: none; }

.agent-table tbody tr {
  transition: background var(--transition);
}

.agent-table tbody tr:hover {
  background: rgba(59,109,240,.02);
}

.agent-table tbody tr.selected {
  background: rgba(59,109,240,.05);
}

.agent-table .row-actions {
  display: flex;
  gap: 6px;
  opacity: .5;
  transition: opacity var(--transition);
}

.agent-table tbody tr:hover .row-actions {
  opacity: 1;
}

.agent-table .row-action-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
}

.agent-table .row-action-btn:hover {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--text);
}

.agent-table .row-action-btn.danger:hover {
  background: rgba(239,68,68,.06);
  border-color: rgba(239,68,68,.3);
  color: var(--red);
}

/* ─── Bulk Action Bar ─── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--blue-soft);
  border: 1px solid rgba(59,109,240,.2);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  animation: fadeUp .2s ease;
}

.bulk-bar .bulk-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  white-space: nowrap;
}

.bulk-bar .bulk-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 7px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(59,109,240,.25);
  background: var(--surface);
  color: var(--blue);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.bulk-bar .bulk-btn:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.bulk-bar .bulk-btn.danger {
  border-color: rgba(239,68,68,.25);
  color: var(--red);
}

.bulk-bar .bulk-btn.danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* ─── Pagination ─── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  font-size: 13px;
}

.pagination .page-info {
  color: var(--text-dim);
  font-weight: 600;
}

.pagination .page-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination .page-btn {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.pagination .page-btn:hover:not(:disabled) {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--text);
}

.pagination .page-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.pagination .page-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.pagination .page-size-select {
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7490' viewBox='0 0 16 16'%3E%3Cpath d='m4.427 6.427 3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  outline: none;
}

/* ─── Import Dropzone ─── */
.import-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}

.import-dropzone:hover,
.import-dropzone.dragover {
  border-color: var(--blue);
  background: rgba(59,109,240,.04);
}

.import-dropzone.has-file {
  border-color: var(--green);
  background: rgba(34,197,94,.04);
}

.import-preview {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.import-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.import-preview table th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.import-preview table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}

.import-preview table tr.error td {
  background: rgba(239,68,68,.05);
  color: var(--red);
}

.import-result {
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.import-result.success {
  background: rgba(34,197,94,.08);
  border: 1px solid rgba(34,197,94,.2);
  color: var(--green);
}

.import-result.has-errors {
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.2);
  color: var(--amber);
}

/* ── Color Swatch ── */
.color-swatch {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.1);
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════════════
   REPORT BUILDER
   ═══════════════════════════════════════════════════════════════════════ */

/* Top toolbar */
.rb-toolbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.rb-toolbar-group {
  display: flex; align-items: center; gap: 8px;
}
.rb-template-select {
  padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600;
  min-width: 200px; cursor: pointer;
}
.rb-template-select:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(59,109,240,.15); }
.rb-input {
  padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600;
  min-width: 180px;
}
.rb-input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(59,109,240,.15); }
.rb-btn {
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all var(--transition); display: inline-flex; align-items: center; gap: 6px;
}
.rb-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft, rgba(59,109,240,.06)); }
.rb-btn-primary {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.rb-btn-primary:hover { background: #2a5cd4; color: #fff; }
.rb-btn-danger { color: var(--red); border-color: rgba(239,68,68,.3); }
.rb-btn-danger:hover { background: rgba(239,68,68,.06); border-color: var(--red); }
.rb-btn-sm { padding: 5px 10px; font-size: 12px; }

/* Date toggle */
.rb-date-toggle {
  display: flex; gap: 2px; background: var(--surface2); padding: 3px; border-radius: 10px;
  border: 1px solid var(--border);
}
.rb-date-toggle button {
  padding: 6px 12px; border: none; border-radius: 8px; font-size: 12px; font-weight: 700;
  cursor: pointer; background: transparent; color: var(--text-dim); transition: all .2s;
}
.rb-date-toggle button.active {
  background: var(--surface); color: var(--blue); box-shadow: var(--shadow-sm);
}

/* Layout: palette + canvas */
.rb-layout { display: flex; gap: 20px; }

/* Widget palette sidebar */
.rb-palette {
  width: 260px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; max-height: calc(100vh - 220px); overflow-y: auto;
}
.rb-palette-title {
  font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.rb-palette-category { margin-bottom: 16px; }
.rb-palette-category-title {
  font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: .05em; margin-bottom: 8px; padding: 0 4px;
}
.rb-palette-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition); margin-bottom: 5px; font-size: 13px;
  font-weight: 600; color: var(--text);
}
.rb-palette-item:hover {
  border-color: var(--blue); background: rgba(59,109,240,.04); box-shadow: var(--shadow-sm);
  color: var(--blue);
}
.rb-palette-item-icon { font-size: 16px; flex-shrink: 0; }
.rb-palette-item-size {
  margin-left: auto; font-size: 10px; font-weight: 600; color: var(--text-dim);
  background: var(--surface2); padding: 2px 6px; border-radius: 4px;
}

/* Report canvas */
.rb-canvas { flex: 1; min-width: 0; }
.rb-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.rb-grid-empty {
  grid-column: 1 / -1; text-align: center; padding: 80px 20px; color: var(--text-dim);
  border: 2px dashed var(--border); border-radius: var(--radius); font-size: 14px;
}
.rb-grid-empty-icon { font-size: 48px; margin-bottom: 12px; display: block; }

/* Widget card */
.rb-widget {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); overflow: hidden; transition: all var(--transition);
}
.rb-widget:hover { box-shadow: var(--shadow-md); border-color: var(--border2, var(--border)); }
.rb-widget-small  { grid-column: span 1; }
.rb-widget-medium { grid-column: span 2; }
.rb-widget-large  { grid-column: span 3; }

/* Widget header */
.rb-widget-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface2);
}
.rb-widget-title {
  font-size: 12px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px;
}
.rb-widget-controls { display: flex; align-items: center; gap: 2px; }
.rb-widget-controls button {
  width: 24px; height: 24px; border: none; border-radius: 6px; background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-dim); transition: all var(--transition);
}
.rb-widget-controls button:hover { background: var(--surface); color: var(--text); }
.rb-widget-controls button.remove:hover { color: var(--red); background: rgba(239,68,68,.08); }
.rb-widget-controls button.size-btn { font-size: 10px; font-weight: 700; }

/* Widget body */
.rb-widget-body { padding: 14px; }
.rb-widget-loading {
  display: flex; align-items: center; justify-content: center; min-height: 80px;
  color: var(--text-dim); font-size: 13px;
}

/* KPI mini card inside widget */
.rb-kpi { text-align: center; padding: 10px 0; }
.rb-kpi-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.1; }
.rb-kpi-sub { font-size: 12px; color: var(--text-dim); margin-top: 6px; font-weight: 600; }

/* Summary panel */
.rb-summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.rb-summary-row:last-child { border-bottom: none; }
.rb-summary-label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.rb-summary-value { font-size: 14px; font-weight: 600; color: var(--text); }

/* Heatmap */
.rb-heatmap { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.rb-heatmap-cell {
  aspect-ratio: 1; border-radius: 4px; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--text-dim); transition: all .2s;
}

/* Responsive */
@media (max-width: 900px) {
  .rb-layout { flex-direction: column; }
  .rb-palette { width: 100%; max-height: none; }
  .rb-grid { grid-template-columns: 1fr; }
  .rb-widget-medium, .rb-widget-large { grid-column: span 1; }
}
