/* VoiceAI Service Platform - Light Theme & Vietnamese Popular Typography */
:root {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-light: #dbeafe;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --info: #0369a1;
  --info-bg: #e0f2fe;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-family-modern: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-family-modern);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── LOGIN SCREEN ─── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.login-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
}

.login-brand h1 {
  font-size: 20px;
  color: var(--text-main);
}

.login-brand p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── APP SHELL & HEADER ─── */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ─── NAVIGATION TABS ─── */
.nav-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.nav-tab {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.nav-tab:hover {
  color: var(--primary);
  background: var(--bg-subtle);
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #f8fafc;
}

@media (max-width: 768px) {
  .nav-inner {
    padding: 0 8px;
    gap: 2px;
  }
  .nav-tab {
    padding: 10px 10px;
    font-size: 12.5px;
  }
}

/* ─── MAIN CONTAINER ─── */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ─── CARDS & GRID ─── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.grid-2col {
  display: grid;
  grid-template-columns: minmax(360px, 480px) 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

@media (max-width: 992px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

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

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

/* ─── BUTTONS & INPUTS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover {
  background: var(--bg-subtle);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

.btn-danger {
  background: var(--danger-bg);
  border-color: #fca5a5;
  color: var(--danger);
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ─── TABLES ─── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 90px;
  margin-bottom: -90px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th,
table.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

table.data-table th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  white-space: nowrap;
}

table.data-table tr:hover td {
  background: #f8fafc;
}

/* ─── BADGES & PROGRESS ─── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-active,
.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-disabled,
.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-revoked,
.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

.quota-bar-wrap {
  min-width: 140px;
  margin-bottom: 4px;
}

.quota-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.quota-bar-track {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 99px;
  overflow: hidden;
}

.quota-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
}

.quota-bar-fill.warn {
  background: #d97706;
}

.quota-bar-fill.danger {
  background: #dc2626;
}

/* ─── MODALS & ALERTS ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

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

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-fullscreen-box {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 96vw;
  max-width: 1480px;
  height: 94vh;
  max-height: 94vh;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-large-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 820px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.alert-banner {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #86efac;
  background: #f0fdf4;
  color: #14532d;
  margin-bottom: 20px;
}

.code-block {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 12.5px;
  color: #0f172a;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.45;
}

.key-token-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #ffffff;
  border: 2px dashed var(--primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 8px;
}

/* ─── SPEECH STYLE CARDS (CHỌN PHONG CÁCH DIỄN THUYẾT TRỰC QUAN) ─── */
.speech-style-card {
  border: 1.5px solid var(--border-color);
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  user-select: none;
}

.speech-style-card:hover {
  border-color: #93c5fd;
  background: #f8fafc;
  transform: translateY(-1.5px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
}

.speech-style-card.active {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 1px var(--primary), 0 3px 8px rgba(37, 99, 235, 0.08);
}

.speech-style-card .style-check-icon {
  width: 18px;
  height: 18px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.speech-style-card:not(.active) .style-check-icon {
  display: none;
}

/* ─── STREAMING PLAYGROUND ─── */
.stream-transcript-box {
  min-height: 160px;
  max-height: 300px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.transcript-final {
  color: var(--text-main);
  font-weight: 600;
  margin-bottom: 6px;
}

.transcript-partial {
  color: var(--primary);
  font-style: italic;
}

.ws-log-box {
  height: 220px;
  overflow-y: auto;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: Consolas, monospace;
  font-size: 12px;
}

.ws-log-item {
  padding: 3px 0;
  border-bottom: 1px dashed var(--border-light);
}


/* ─── ACTION MENUS (DROPDOWN) ─── */
.action-menu-wrap {
  position: relative;
  display: inline-block;
}

.action-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.action-menu-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: #94a3b8;
}

.action-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 175px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  z-index: 1000;
}

.action-dropdown.dropup {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 4px;
}

.action-dropdown.show {
  display: block;
}

.action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s ease;
}

.action-dropdown-item:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.action-dropdown-item.danger {
  color: var(--danger);
}

.action-dropdown-item.danger:hover {
  background: var(--danger-bg);
}

.action-dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* ─── AUDIO INLINE PLAYER ─── */
.inline-audio-player {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 4px 10px;
  width: fit-content;
  min-width: 210px;
}

.inline-audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.inline-audio-btn:hover {
  background: var(--primary-hover);
}

.inline-audio-seeker {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}

.inline-audio-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: Consolas, monospace;
  white-space: nowrap;
  min-width: 32px;
  text-align: right;
}

/* ─── PAGINATION ─── */
.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-info {
  font-size: 12.5px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  min-width: 32px;
  height: 30px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-page:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-main);
}

.btn-page:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-page.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* ─── BUTTON LABEL NO-WRAP ─── */
.btn {
  white-space: nowrap !important;
}

.btn svg,
.btn-icon svg {
  flex-shrink: 0;
}

/* ─── SPEECH CRAFT (DOC-TO-SPEECH) ─── */
@media (max-width: 992px) {
  .speech-craft-grid {
    grid-template-columns: 1fr !important;
  }
}

