/* ==========================================================================
   Voiceagent Dashboard — design system
   No framework: plain CSS with custom properties for light/dark theming.
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --accent: 37 99 235;       /* blue-600 */
  --accent-strong: 29 78 216;/* blue-700 */
  --accent-soft: 219 234 254;/* blue-100 */

  --success: 22 163 74;
  --warning: 217 119 6;
  --danger: 220 38 38;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px -10px rgba(15, 23, 42, 0.18);
  --shadow-lg: 0 20px 48px -16px rgba(15, 23, 42, 0.28);

  --sidebar-w: 264px;
  --topbar-h: 68px;

  color-scheme: light;

  --bg: 248 250 252;
  --bg-elevated: 255 255 255;
  --bg-sunken: 241 245 249;
  --border: 226 232 240;
  --border-soft: 237 241 246;
  --text: 15 23 42;
  --text-muted: 100 116 139;
  --text-faint: 148 163 184;
  --sidebar-bg: 17 24 39;
  --sidebar-text: 203 213 225;
  --sidebar-text-active: 255 255 255;
  --sidebar-border: 31 41 55;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: 10 14 23;
  --bg-elevated: 17 24 38;
  --bg-sunken: 22 30 46;
  --border: 35 45 64;
  --border-soft: 28 37 54;
  --text: 226 232 240;
  --text-muted: 148 163 184;
  --text-faint: 100 116 139;
  --sidebar-bg: 8 12 21;
  --sidebar-text: 148 163 184;
  --sidebar-text-active: 255 255 255;
  --sidebar-border: 24 32 48;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 28px -10px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: rgb(var(--bg));
  color: rgb(var(--text));
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
  transition: background-color .2s ease, color .2s ease;
}

a { color: inherit; }

img, svg { display: block; }

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }

/* ----------------------------------------------------------------------- */
/* Auth / login screen                                                     */
/* ----------------------------------------------------------------------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: rgb(var(--bg));
}

.auth-visual {
  flex: 1.1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
  background:
    radial-gradient(circle at 18% 22%, rgba(96, 165, 250, 0.35), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(37, 99, 235, 0.4), transparent 46%),
    linear-gradient(160deg, #0b1220 0%, #111c34 52%, #15234a 100%);
  color: #e2e8f0;
  overflow: hidden;
}

.auth-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 40%, black 0%, transparent 72%);
  pointer-events: none;
}

.auth-visual > * { position: relative; z-index: 1; }

.auth-waveform {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 84px;
}

.auth-waveform span {
  display: block;
  width: 6px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(147, 197, 253, 0.95), rgba(59, 130, 246, 0.35));
}

.auth-quote {
  max-width: 420px;
  font-size: 22px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.auth-quote span { display: block; margin-top: 14px; font-size: 14px; font-weight: 400; color: rgba(226,232,240,0.6); }

.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 36px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, rgb(var(--accent)), rgb(var(--accent-strong)));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.brand-mark .icon { width: 19px; height: 19px; }

.auth-card h1 {
  font-size: 26px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.auth-card p.lead {
  margin: 0 0 28px;
  color: rgb(var(--text-muted));
  font-size: 14.5px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
  color: rgb(var(--text-muted));
}

.input,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--border));
  background: rgb(var(--bg-elevated));
  color: rgb(var(--text));
  font-family: inherit;
  font-size: 14.5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgb(var(--accent));
  box-shadow: 0 0 0 3px rgba(var(--accent), 0.16);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.6) brightness(1.2);
  cursor: pointer;
  opacity: 0.7;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}
input[type="date"]::-webkit-datetime-edit-fields-wrapper { color: rgb(var(--text)); }
input[type="date"]::-webkit-datetime-edit-text         { color: rgb(var(--text-faint)); }
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-year-field {
  color: rgb(var(--text));
}
input[type="date"]::-webkit-datetime-edit-day-field:focus,
input[type="date"]::-webkit-datetime-edit-month-field:focus,
input[type="date"]::-webkit-datetime-edit-year-field:focus {
  background: rgba(var(--accent), 0.25);
  border-radius: 2px;
  outline: none;
}

.input-icon-wrap { position: relative; }
.input-icon-wrap .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgb(var(--text-faint));
}
.input-icon-wrap input { padding-left: 42px; }

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  margin-bottom: 22px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgb(var(--text-muted));
  cursor: pointer;
}

.checkbox-row input { width: 16px; height: 16px; accent-color: rgb(var(--accent)); }

.link {
  color: rgb(var(--accent));
  text-decoration: none;
  font-weight: 500;
}
.link:hover { text-decoration: underline; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 5px 14px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: rgb(var(--accent));
  color: #fff;
}
.btn-primary:hover { background: rgb(var(--accent-strong)); }

.auth-card .btn-primary { width: 100%; }

.btn-secondary {
  background: rgb(var(--bg-sunken));
  color: rgb(var(--text));
  border-color: rgb(var(--border));
}
.btn-secondary:hover { background: rgb(var(--bg-elevated)); }

.btn-ghost {
  background: transparent;
  color: rgb(var(--text-muted));
}
.btn-ghost:hover { background: rgb(var(--bg-sunken)); color: rgb(var(--text)); }

.btn-sm { padding: 4px 10px; font-size: 11.5px; }

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 20px;
  border: 1px solid;
}
.alert .icon { margin-top: 1px; }
.alert-info {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.25);
  color: rgb(var(--accent-strong));
}
[data-theme="dark"] .alert-info { color: #93c5fd; }
.alert-error {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.3);
  color: rgb(var(--danger));
}
.alert-success {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.3);
  color: rgb(var(--success, 22 163 74));
}
[data-theme="dark"] .alert-success { color: #86efac; }

.auth-footnote {
  margin-top: 28px;
  font-size: 12.5px;
  color: rgb(var(--text-faint));
  text-align: center;
}

/* ----------------------------------------------------------------------- */
/* App shell                                                               */
/* ----------------------------------------------------------------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgb(var(--sidebar-bg));
  color: rgb(var(--sidebar-text));
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgb(var(--sidebar-border));
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: transform .25s ease;
}

.sidebar-head {
  padding: 22px 22px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgb(var(--sidebar-border));
}

.sidebar-head .brand-mark { width: 34px; height: 34px; }
.sidebar-head .brand-name {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.sidebar-head .brand-sub {
  font-size: 11.5px;
  color: rgb(var(--text-faint));
}

.sidebar-close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: rgb(var(--sidebar-text));
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}

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

.nav-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgb(var(--text-faint));
  padding: 14px 12px 8px;
}
.nav-label:first-child { padding-top: 4px; }

/* Agent switcher */

.agent-switcher {
  padding: 16px 22px 4px;
  border-bottom: 1px solid rgb(var(--sidebar-border));
}

.agent-switcher-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-select-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 30px 7px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--sidebar-border));
  background: rgba(255,255,255,0.04);
}

.agent-avatar {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(145deg, rgb(var(--accent)), #6366f1);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.agent-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 0;
  width: 100%;
  cursor: pointer;
}
.agent-select:focus { outline: none; box-shadow: none; }
.agent-select option { color: rgb(var(--text)); background: rgb(var(--bg-elevated)); }

.agent-select-chevron {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  color: rgb(var(--text-faint));
  pointer-events: none;
}
.agent-select-chevron .icon { width: 14px; height: 14px; }

.agent-add-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--sidebar-border));
  background: rgba(255,255,255,0.04);
  color: rgb(var(--sidebar-text));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.agent-add-btn:hover {
  background: rgba(var(--accent), 0.22);
  border-color: rgba(var(--accent), 0.4);
  color: #fff;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: rgb(var(--sidebar-text));
  text-decoration: none;
  margin-bottom: 2px;
  transition: background-color .12s ease, color .12s ease;
  position: relative;
}

.nav-item .icon { color: rgb(var(--text-faint)); transition: color .12s ease; }

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

.nav-item.active {
  background: rgba(var(--accent), 0.18);
  color: #fff;
}
.nav-item.active .icon { color: #93c5fd; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: rgb(var(--accent));
}

.nav-item .badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: rgba(var(--accent), 0.25);
  color: #bfdbfe;
  padding: 2px 7px;
  border-radius: 999px;
}

.sidebar-foot {
  padding: 16px;
  border-top: 1px solid rgb(var(--sidebar-border));
}

.user-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-radius: var(--radius-sm);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgb(var(--accent)), #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-card .name { font-size: 13.5px; font-weight: 600; color: #fff; }
.user-card .role { font-size: 12px; color: rgb(var(--text-faint)); }

.user-card .logout-link {
  margin-left: auto;
  color: rgb(var(--text-faint));
  display: flex;
  padding: 6px;
  border-radius: 8px;
  transition: color .12s ease, background-color .12s ease;
}
.user-card .logout-link:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* Main column */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid rgb(var(--border));
  background: rgba(var(--bg-elevated), 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid rgb(var(--border));
  border-radius: 9px;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  color: rgb(var(--text-muted));
  cursor: pointer;
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  position: relative;
}
.topbar-search .icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: rgb(var(--text-faint));
}
.topbar-search input {
  padding: 9px 14px 9px 40px;
  background: rgb(var(--bg-sunken));
  border-color: transparent;
  font-size: 13.5px;
}
.topbar-search input:focus { background: rgb(var(--bg-elevated)); border-color: rgb(var(--accent)); }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--bg-elevated));
  color: rgb(var(--text-muted));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.icon-btn:hover { color: rgb(var(--text)); background: rgb(var(--bg-sunken)); }

.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(var(--danger));
  border: 1.5px solid rgb(var(--bg-elevated));
}

.theme-toggle .icon-sun, .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ── Topbar Panels (Benachrichtigungen / Changelog) ──────────────────────── */
.topbar-panel-wrap {
  position: relative;
}
.topbar-panel {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  background: rgb(var(--bg-elevated));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.06);
  z-index: 100;
  overflow: hidden;
  animation: panel-in .14s ease;
}
.topbar-panel.open { display: block; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.topbar-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgb(var(--border));
}
.topbar-panel-head h3 {
  font-size: 13.5px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgb(var(--text));
}
.topbar-panel-head .panel-close {
  width: 26px; height: 26px;
  border: none; background: none;
  border-radius: 6px;
  color: rgb(var(--text-muted));
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s, color .1s;
}
.topbar-panel-head .panel-close:hover { background: rgb(var(--bg-sunken)); color: rgb(var(--text)); }

.topbar-panel-empty {
  padding: 40px 20px;
  text-align: center;
  color: rgb(var(--text-faint));
}
.topbar-panel-empty .panel-empty-icon {
  width: 40px; height: 40px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: rgb(var(--bg-sunken));
  display: flex; align-items: center; justify-content: center;
  color: rgb(var(--text-muted));
}
.topbar-panel-empty p {
  font-size: 13px;
  margin: 0;
  line-height: 1.5;
}
.topbar-panel-empty p strong {
  display: block;
  font-size: 13.5px;
  color: rgb(var(--text-muted));
  margin-bottom: 4px;
}

.content {
  padding: 28px;
  flex: 1;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 23px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.page-head p {
  margin: 0;
  color: rgb(var(--text-muted));
  font-size: 14px;
  max-width: 560px;
}

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

.breadcrumb {
  font-size: 12.5px;
  color: rgb(var(--text-faint));
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb .current { color: rgb(var(--text-muted)); font-weight: 600; }

/* ----------------------------------------------------------------------- */
/* Cards / grids / generic content blocks                                 */
/* ----------------------------------------------------------------------- */

.card {
  background: rgb(var(--bg-elevated));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 22px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px;
  border-bottom: 1px solid rgb(var(--border-soft));
}
.card-head h2 { font-size: 16px; margin: 0; letter-spacing: -0.01em; display: flex; align-items: center; gap: 6px; }
.card-head .sub { font-size: 12.5px; color: rgb(var(--text-muted)); margin-top: 2px; }

.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-12 { grid-template-columns: repeat(12, 1fr); }

@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.col-span-8 { grid-column: span 8; }
.col-span-7 { grid-column: span 7; }
.col-span-6 { grid-column: span 6; }
.col-span-5 { grid-column: span 5; }
.col-span-4 { grid-column: span 4; }
@media (max-width: 980px) {
  .grid-12 > [class*="col-span-"] { grid-column: span 12; }
}

/* KPI stat cards */

.stat-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--accent), 0.12);
  color: rgb(var(--accent));
}
.stat-icon.success { background: rgba(22,163,74,0.12); color: rgb(var(--success)); }
.stat-icon.warning { background: rgba(217,119,6,0.12); color: rgb(var(--warning)); }
.stat-icon.violet { background: rgba(99,102,241,0.14); color: #6366f1; }

.stat-label {
  font-size: 13px;
  color: rgb(var(--text-muted));
  font-weight: 500;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.stat-value .unit { font-size: 15px; font-weight: 500; color: rgb(var(--text-muted)); }

.trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.trend.up { color: rgb(var(--success)); background: rgba(22,163,74,0.12); }
.trend.down { color: rgb(var(--danger)); background: rgba(220,38,38,0.12); }
.trend .icon { width: 13px; height: 13px; }

/* Tables */

.table-wrap { overflow-x: auto; }

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

thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgb(var(--text-faint));
  font-weight: 700;
  padding: 12px 22px;
  border-bottom: 1px solid rgb(var(--border-soft));
  white-space: nowrap;
}

tbody td {
  padding: 14px 22px;
  border-bottom: 1px solid rgb(var(--border-soft));
  color: rgb(var(--text));
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color .12s ease; }
tbody tr:hover { background: rgb(var(--bg-sunken)); }

td.num, th.num { text-align: right; }

.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgb(var(--bg-sunken));
  color: rgb(var(--text-muted));
  margin-right: 10px;
}
.rank.top1 { background: rgba(217,119,6,0.16); color: rgb(var(--warning)); }
.rank.top2 { background: rgba(100,116,139,0.16); color: rgb(var(--text-muted)); }
.rank.top3 { background: rgba(180,83,9,0.14); color: #b45309; }

.bar-track {
  height: 6px;
  border-radius: 999px;
  background: rgb(var(--bg-sunken));
  overflow: hidden;
  width: 100px;
}
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, rgb(var(--accent)), #60a5fa); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.tag-dot { width: 7px; height: 7px; border-radius: 50%; }
.tag.green { background: rgba(22,163,74,0.12); color: rgb(var(--success)); }
.tag.green .tag-dot { background: rgb(var(--success)); }
.tag.amber { background: rgba(217,119,6,0.12); color: rgb(var(--warning)); }
.tag.amber .tag-dot { background: rgb(var(--warning)); }
.tag.blue { background: rgba(37,99,235,0.12); color: rgb(var(--accent)); }
.tag.blue .tag-dot { background: rgb(var(--accent)); }
.tag.gray { background: rgb(var(--bg-sunken)); color: rgb(var(--text-muted)); }
.tag.gray .tag-dot { background: rgb(var(--text-faint)); }

/* Mini chart placeholders (pure CSS bars / sparkline) */

.chart-placeholder {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 220px;
  padding: 22px 22px 4px;
}
.chart-placeholder .col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.chart-placeholder .bar {
  width: 100%;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, rgba(37,99,235,0.9), rgba(37,99,235,0.35));
}
.chart-placeholder .bar.alt {
  background: linear-gradient(180deg, rgba(99,102,241,0.55), rgba(99,102,241,0.18));
}
.chart-placeholder .lbl { font-size: 11px; color: rgb(var(--text-faint)); }

.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 46px;
}
.sparkline span {
  flex: 1;
  border-radius: 3px 3px 1px 1px;
  background: rgba(var(--accent), 0.35);
}
.sparkline span.now { background: rgb(var(--accent)); }

.donut {
  --p: 0;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(rgb(var(--accent)) calc(var(--p) * 1%), rgb(var(--bg-sunken)) 0);
  margin: 6px auto 0;
  position: relative;
}
.donut::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: rgb(var(--bg-elevated));
}
.donut-label {
  position: relative;
  text-align: center;
  z-index: 1;
}
.donut-label strong { font-size: 22px; display: block; letter-spacing: -0.02em; }
.donut-label span { font-size: 12px; color: rgb(var(--text-muted)); }

.legend { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-row .sw { width: 10px; height: 10px; border-radius: 3px; }
.legend-row .lbl { color: rgb(var(--text-muted)); }
.legend-row .val { margin-left: auto; font-weight: 600; }

/* Lists (recent calls / activity) */

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 22px;
  border-bottom: 1px solid rgb(var(--border-soft));
}
.list-item:last-child { border-bottom: none; }

.list-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.list-icon.in { background: rgba(22,163,74,0.12); color: rgb(var(--success)); }
.list-icon.out { background: rgba(37,99,235,0.12); color: rgb(var(--accent)); }
.list-icon.missed { background: rgba(220,38,38,0.1); color: rgb(var(--danger)); }

.list-main { min-width: 0; flex: 1; }
.list-main .title { font-size: 13.5px; font-weight: 600; }
.list-main .meta { font-size: 12px; color: rgb(var(--text-muted)); margin-top: 2px; }
.list-end { text-align: right; flex-shrink: 0; }
.list-end .amount { font-size: 13.5px; font-weight: 600; }
.list-end .time { font-size: 12px; color: rgb(var(--text-faint)); margin-top: 2px; }

/* ----------------------------------------------------------------------- */
/* Forms (settings pages)                                                  */
/* ----------------------------------------------------------------------- */

.form-section { padding: 24px 22px; border-bottom: 1px solid rgb(var(--border-soft)); }
.form-section:last-child { border-bottom: none; }
.form-section h3 { margin: 0 0 4px; font-size: 14.5px; }
.form-section .desc { margin: 0 0 18px; font-size: 13px; color: rgb(var(--text-muted)); max-width: 540px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

.hint { font-size: 12px; color: rgb(var(--text-faint)); margin-top: 6px; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgb(var(--border-soft));
}
.switch-row:last-child { border-bottom: none; }
.switch-row .txt strong { display: block; font-size: 13.5px; font-weight: 600; }
.switch-row .txt span { font-size: 12.5px; color: rgb(var(--text-muted)); }

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute;
  inset: 0;
  background: rgb(var(--bg-sunken));
  border: 1px solid rgb(var(--border));
  border-radius: 999px;
  transition: background-color .15s ease;
}
.switch .track::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s ease;
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: rgb(var(--accent)); border-color: rgb(var(--accent)); }
.switch input:checked + .track::before { transform: translateX(18px); }

.copy-field {
  display: flex;
  gap: 8px;
}
.copy-field input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.divider { height: 1px; background: rgb(var(--border-soft)); margin: 22px 0; border: none; }

/* Voice picker cards */

.voice-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-md);
  background: rgb(var(--bg-elevated));
  transition: border-color .15s ease, box-shadow .15s ease;
}
.voice-card.selected {
  border-color: rgb(var(--accent));
  box-shadow: 0 0 0 3px rgba(var(--accent), 0.14);
}
.voice-card .play-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--bg-sunken));
  color: rgb(var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.voice-card .play-btn:hover { background: rgba(var(--accent), 0.14); }
.voice-card .meta { flex: 1; min-width: 0; }
.voice-card .meta .name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.voice-card .meta .desc { font-size: 12.5px; color: rgb(var(--text-muted)); margin-top: 3px; }
.voice-card .wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  margin: 0 6px;
}
.voice-card .wave span {
  width: 3px;
  border-radius: 2px;
  background: rgb(var(--text-faint));
}
.voice-card.selected .wave span { background: rgb(var(--accent)); }

.radio-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgb(var(--border));
  flex-shrink: 0;
}
.voice-card.selected .radio-pill {
  border-color: rgb(var(--accent));
  background: rgb(var(--accent));
  color: #fff;
}
.radio-pill .icon { width: 12px; height: 12px; }

/* Per-agent configuration banner (voices/integrations/agent-settings) */

.agent-avatar-lg { width: 44px; height: 44px; border-radius: 13px; font-size: 14px; }

.agent-context-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgb(var(--border));
  background: rgb(var(--bg-elevated));
  margin-bottom: 20px;
}
.agent-context-info { flex: 1; min-width: 0; }
.agent-context-name { font-size: 14px; font-weight: 500; }
.agent-context-name strong { font-weight: 700; }
.agent-context-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-size: 12.5px;
  color: rgb(var(--text-muted));
}

/* Banner shown while an admin is viewing the cockpit as another user */
.impersonation-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(217,119,6,0.35);
  background: rgba(217,119,6,0.1);
  color: rgb(var(--warning));
  font-size: 13px;
  margin-bottom: 20px;
}
.impersonation-bar strong { font-weight: 700; }
.impersonation-bar .btn { margin-left: auto; flex-shrink: 0; }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filter-bar select { width: auto; padding: 9px 34px 9px 14px; font-size: 13px; }
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--bg-elevated));
  font-size: 13px;
  font-weight: 500;
  color: rgb(var(--text-muted));
  cursor: pointer;
}
.filter-pill.active {
  background: rgba(var(--accent), 0.12);
  border-color: rgba(var(--accent), 0.4);
  color: rgb(var(--accent));
}

/* Pricing / billing */

.balance-card {
  background: linear-gradient(135deg, #111c34 0%, #1d2b4d 55%, #1e3a8a 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.balance-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 0%, rgba(96,165,250,0.35), transparent 55%);
}
.balance-card > * { position: relative; }
.balance-card .lbl { font-size: 13px; color: rgba(226,232,240,0.7); margin-bottom: 8px; }
.balance-card .amount { font-size: 36px; font-weight: 700; letter-spacing: -0.02em; }
.balance-card .amount .cur { font-size: 18px; font-weight: 500; color: rgba(226,232,240,0.7); }
.balance-card .meta-row { display: flex; gap: 28px; margin-top: 22px; }
.balance-card .meta-row .item .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(226,232,240,0.55); margin-bottom: 4px; }
.balance-card .meta-row .item .v { font-size: 15px; font-weight: 600; }
.balance-card .actions { margin-top: 24px; display: flex; gap: 10px; }
.balance-card .btn-primary { background: #fff; color: #1d2b4d; width: auto; }
.balance-card .btn-primary:hover { background: #e2e8f0; }
.balance-card .btn-secondary { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.18); }
.balance-card .btn-secondary:hover { background: rgba(255,255,255,0.18); }

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgb(var(--border-soft));
}
.price-row:last-child { border-bottom: none; }
.price-row .lbl { font-size: 13.5px; font-weight: 500; }
.price-row .lbl span { display: block; font-size: 12px; color: rgb(var(--text-muted)); font-weight: 400; margin-top: 2px; }
.price-row .val { font-size: 14.5px; font-weight: 700; }
.price-row .val small { font-weight: 500; color: rgb(var(--text-muted)); font-size: 12px; }

/* Pagination */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  font-size: 12.5px;
  color: rgb(var(--text-muted));
}
.pagination .pages { display: flex; gap: 6px; }
.pagination .pages button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--bg-elevated));
  color: rgb(var(--text-muted));
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
}
.pagination .pages button.active { background: rgb(var(--accent)); border-color: rgb(var(--accent)); color: #fff; }

/* ----------------------------------------------------------------------- */
/* Overlay / mobile                                                        */
/* ----------------------------------------------------------------------- */

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 35;
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-flex; }
  .menu-toggle { display: inline-flex; }
  .overlay.show { display: block; }
  .topbar-search { display: none; }
}

@media (max-width: 640px) {
  .content { padding: 18px; }
  .topbar { padding: 0 16px; }
  .card-pad, .card-head { padding: 18px; }
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tbody tr { padding: 14px 18px; border-bottom: 1px solid rgb(var(--border-soft)); }
  tbody td { border: none; padding: 4px 0; white-space: normal; }
  tbody td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 130px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgb(var(--text-faint));
    font-weight: 700;
  }
  .balance-card .meta-row { flex-wrap: wrap; gap: 16px; }
  .auth-visual { display: none; }
  .auth-form-side { padding: 24px 20px; }
}

.text-muted { color: rgb(var(--text-muted)); }
.text-faint { color: rgb(var(--text-faint)); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ----------------------------------------------------------------------- */
/* Modal / Popout                                                          */
/* ----------------------------------------------------------------------- */

body.modal-open { overflow: hidden; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: rgb(var(--bg-elevated));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: modal-pop .15s ease;
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid rgb(var(--border-soft));
}
.modal-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 9px;
}
.modal-head .sub {
  font-size: 12.5px;
  color: rgb(var(--text-muted));
  margin-top: 4px;
}
.modal-close {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--bg-elevated));
  color: rgb(var(--text-muted));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
.modal-close:hover { color: rgb(var(--text)); background: rgb(var(--bg-sunken)); }

.modal-body { padding: 22px; }
.modal-body .field:last-of-type { margin-bottom: 0; }
.modal-body .alert { margin-bottom: 18px; }

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 640px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: none; max-height: 92vh; border-radius: var(--radius-md) var(--radius-md) 0 0; }
}

/* ── Avatar-Bild ─────────────────────────────────────────────────────────── */

.avatar-img {
  object-fit: cover;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.avatar.avatar-img {
  background: transparent;
  border: none;
}

/* ── Sidebar-Footer: Gruppen-Tags ───────────────────────────────────────── */

.user-card {
  align-items: flex-start !important;
}

.user-card-info {
  flex: 1;
  min-width: 0;
}

.sidebar-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.sidebar-group-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: rgb(var(--sidebar-text));
  white-space: nowrap;
}

/* ── Gruppen / Berechtigungs-Editor ─────────────────────────────────────── */

.perm-area {
  margin-bottom: 28px;
}

.perm-area-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgb(var(--text-muted));
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgb(var(--border-soft));
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}

.perm-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--border-soft));
  background: rgb(var(--bg-elevated));
  cursor: pointer;
  transition: border-color .12s, background-color .12s;
}

.perm-row:hover {
  border-color: rgb(var(--accent));
  background: rgba(var(--accent), 0.04);
}

.perm-row input[type="checkbox"] {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: rgb(var(--accent));
  cursor: pointer;
}

.perm-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.perm-disabled:hover {
  border-color: rgb(var(--border-soft));
  background: rgb(var(--bg-elevated));
}

.perm-label {
  font-size: 13.5px;
  font-weight: 500;
}

.perm-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: rgb(var(--text-faint));
  margin-top: 2px;
}

/* Aktive Tabellenzeile (Gruppe wird bearbeitet) */
tr.row-highlight td {
  background: rgba(var(--accent), 0.05);
}

/* Button: aktiver Filter */
.btn-active {
  background: rgb(var(--accent)) !important;
  color: #fff !important;
  border-color: rgb(var(--accent)) !important;
}

/* Danger-Button */
.btn-danger {
  background: rgba(var(--danger), 0.1);
  color: rgb(var(--danger));
  border: 1px solid rgba(var(--danger), 0.25);
}
.btn-danger:hover {
  background: rgba(var(--danger), 0.18);
  border-color: rgba(var(--danger), 0.45);
}
.btn-danger-solid {
  background: rgb(var(--danger));
  color: #fff;
  border: 1px solid rgb(var(--danger));
}
.btn-danger-solid:hover {
  background: rgb(220, 38, 38);
  border-color: rgb(220, 38, 38);
}
.btn-success {
  background: rgb(var(--success));
  color: #fff;
  border: 1px solid rgb(var(--success));
}
.btn-success:hover {
  background: rgb(16, 130, 58);
  border-color: rgb(16, 130, 58);
}

/* ── Wallet ────────────────────────────────────────────────────────────────── */
.wallet-balance {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: rgb(var(--text));
}
.wallet-credit { color: #22c55e; font-weight: 600; }
.wallet-debit  { color: rgb(var(--danger)); font-weight: 600; }
.wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wallet-badge.credit { background: rgba(34,197,94,0.12); color: #22c55e; }
.wallet-badge.debit  { background: rgba(var(--danger),0.12); color: rgb(var(--danger)); }
.wallet-badge.neutral { background: rgba(var(--text-muted),0.12); color: rgb(var(--text-muted)); }
