:root {
  color-scheme: light;
  --nav: #FFFFFF;
  --nav-soft: #F4F4F5;
  --nav-muted: #71717A;
  --ink: #18181B;
  --muted: #71717A;
  --subtle: #A1A1AA;
  --line: #E4E4E7;
  --line-subtle: #EBEBEF;
  --paper: #FFFFFF;
  --canvas: #F7F7F8;
  --primary: #18181B;
  --primary-hover: #27272A;
  --green: #059669;
  --green-dark: #047857;
  --green-pale: #ECFDF5;
  --amber: #D97706;
  --red: #DC2626;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 25px -5px rgba(24, 24, 27, 0.06), 0 8px 10px -6px rgba(24, 24, 27, 0.04);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--font-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
}

button, a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #18181B;
}

button {
  cursor: pointer;
}

.boot-screen {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  background: var(--canvas);
}

.boot-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
}

/* ========================================================================
   Login & Auth Screen (Matches /app Studio Login Aesthetic)
   ======================================================================== */
.login-wrap {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(400px, 45%);
  background: var(--canvas);
}

.login-showcase {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 44px 52px;
  background: #18181B;
  color: #FFFFFF;
  border-right: 1px solid #27272A;
}

.login-showcase::before, .login-showcase::after {
  content: '';
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  pointer-events: none;
}

.login-showcase::before {
  width: 720px;
  height: 720px;
  left: -120px;
  top: 20%;
}

.login-showcase::after {
  width: 540px;
  height: 540px;
  left: -40px;
  top: 30%;
}

.brand {
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #FFFFFF;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #FFFFFF;
  color: #18181B;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
}

.brand-admin {
  color: #A1A1AA;
  font-weight: 450;
  font-size: 13px;
}

.showcase-copy {
  position: relative;
  z-index: 1;
  max-width: 500px;
  margin: auto 0;
  padding: 48px 0;
}

.showcase-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #A1A1AA;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.showcase-kicker::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.showcase-copy h1 {
  margin: 18px 0 14px;
  font-size: clamp(34px, 4.4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: #FFFFFF;
  font-weight: 700;
}

.showcase-copy p {
  max-width: 410px;
  margin: 0;
  color: #A1A1AA;
  font-size: 14px;
  line-height: 1.6;
}

.showcase-footer {
  z-index: 1;
  color: #71717A;
  font-size: 12px;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  background: var(--canvas);
}

.login-card {
  width: min(420px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 4px 20px -2px rgba(24, 24, 27, 0.04);
}

.login-card h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.login-card .subhead {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.secure-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--nav-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.secure-note .lock {
  display: grid;
  flex: none;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 11px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label, .field .field-label {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 550;
}

.field input, .field select, .field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 9px 12px;
  color: var(--ink);
  font-size: 13.5px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 1px var(--primary);
}

.field textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

.field input::placeholder, .field textarea::placeholder {
  color: var(--subtle);
}

.field .hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
}

/* ========================================================================
   Buttons (Matches /app Design Tokens)
   ======================================================================== */
.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-primary {
  background: var(--primary);
  color: #FFFFFF;
  border-color: transparent;
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.button-secondary {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

.button-secondary:hover:not(:disabled) {
  background: var(--nav-soft);
  border-color: #D4D4D8;
}

.button-danger {
  border-color: #FECACA;
  background: #FEF2F2;
  color: var(--red);
}

.button-danger:hover:not(:disabled) {
  background: #FEE2E2;
}

.button-small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 6px;
}

.button-full {
  width: 100%;
}

.notice {
  margin: 0 0 15px;
  padding: 10px 14px;
  border: 1px solid #FECACA;
  border-radius: 8px;
  background: #FEF2F2;
  color: var(--red);
  font-size: 12.5px;
  line-height: 1.45;
}

.notice.success {
  border-color: #A7F3D0;
  background: #ECFDF5;
  color: #047857;
}

.notice.info {
  border-color: var(--line);
  background: var(--nav-soft);
  color: var(--muted);
}

.mfa-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.12em;
}

.secret-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--nav-soft);
  padding: 14px;
}

.secret-card .secret-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.secret-card code {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.otp-uri {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.recovery-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.recovery-list code {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font: 700 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
}

/* ========================================================================
   Admin Layout Shell & Sidebar (Matches /app LeftNav Design)
   ======================================================================== */
.admin-shell {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  background: var(--canvas);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  color: var(--ink);
  border-right: 1px solid var(--line-subtle);
  padding: 16px 10px 14px;
  user-select: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 20px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.sidebar-brand .brand-mark {
  width: 26px;
  height: 26px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--primary);
  color: #FFFFFF;
}

.sidebar-admin {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}

.sidebar-label {
  padding: 0 8px 8px;
  color: var(--subtle);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: #52525B;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 130ms ease, color 130ms ease;
}

.nav-item:hover {
  background: var(--nav-soft);
  color: var(--ink);
}

.nav-item.active {
  border-color: transparent;
  background: var(--nav-soft);
  color: var(--ink);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.nav-item.active .nav-icon {
  color: var(--ink);
}

.sidebar-spacer {
  flex: 1;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  border-top: 1px solid var(--line-subtle);
}

.avatar {
  display: grid;
  flex: none;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--nav-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.profile-copy {
  min-width: 0;
  flex: 1;
}

.profile-email {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-role {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.sidebar-logout {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #FFFFFF;
  color: var(--muted);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 550;
  transition: all 130ms ease;
}

.sidebar-logout:hover {
  background: var(--nav-soft);
  color: var(--ink);
  border-color: #D4D4D8;
}

/* ========================================================================
   Main Area & Header TopBar
   ======================================================================== */
.main-area {
  min-width: 0;
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line-subtle);
  background: #FFFFFF;
  position: sticky;
  top: 0;
  z-index: 10;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 3px #D1FAE5;
}

.top-refresh {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #FFFFFF;
  color: var(--ink);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 550;
  transition: all 130ms ease;
}

.top-refresh:hover {
  background: var(--nav-soft);
  border-color: #D4D4D8;
}

.content-wrap {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px 28px 48px;
}

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

.page-head h1 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.content-notice {
  margin-bottom: 16px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h2, .card-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metric-value {
  margin-top: 8px;
  color: var(--ink);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.metric-foot {
  margin-top: 6px;
  color: var(--subtle);
  font-size: 11px;
}

/* ========================================================================
   Status Badges & Tags (Matches ElevenLabs Zinc Status Tokens)
   ======================================================================== */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  border-radius: 6px;
  padding: 2px 8px;
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.status-tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-tag.warn {
  background: #FFFBEB;
  color: #B45309;
  border-color: #FDE68A;
}

.status-tag.danger {
  background: #FEF2F2;
  color: #B91C1C;
  border-color: #FECACA;
}

.status-tag.neutral {
  background: #F4F4F5;
  color: #71717A;
  border-color: #E4E4E7;
}

.status-tag.refund {
  background: #F1F5F9;
  color: #475569;
  border-color: #CBD5E1;
}

/* ========================================================================
   Data Tables
   ======================================================================== */
.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

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

thead th {
  position: sticky;
  top: 0;
  padding: 10px 14px;
  background: #FAFAFA;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody td {
  padding: 12px 14px;
  border-top: 1px solid var(--line-subtle);
  color: var(--ink);
  vertical-align: top;
  line-height: 1.5;
}

tbody tr:hover td {
  background: #FAFAFA;
}

.cell-main {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
}

.cell-sub {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.nowrap {
  white-space: nowrap;
}

.empty {
  padding: 32px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 80px;
  color: var(--muted);
  font-size: 13px;
  justify-content: center;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.section-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.inline-form .wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.form-actions .hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.filterbar .field {
  min-width: 190px;
  flex: 1;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.pagination-buttons {
  display: flex;
  gap: 6px;
}

.detail-panel {
  margin-top: 16px;
}

.detail-ledger {
  margin-top: 20px;
}

.section-gap {
  margin-top: 16px;
}

.section-gap-sm {
  margin-top: 16px;
}

.key-value {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-subtle);
  font-size: 12px;
}

.key-value:last-child {
  border-bottom: 0;
}

.key-value span:first-child {
  color: var(--muted);
}

.key-value span:last-child {
  color: var(--ink);
  font-weight: 550;
  overflow-wrap: anywhere;
}

.audit-detail {
  max-width: 380px;
  max-height: 90px;
  overflow: auto;
  color: #52525B;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--nav-soft);
  padding: 6px 8px;
  border-radius: 6px;
}

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.settings-editor {
  min-height: 200px !important;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace !important;
}

.settings-workspace {
  display: grid;
  gap: 18px;
}
.settings-workspace > .field {
  max-width: 360px;
}
.tool-setting-list {
  display: grid;
  gap: 10px;
}
.tool-setting {
  padding: 15px;
  border: 1px solid var(--line-subtle);
  border-radius: 10px;
  background: #FCFCFD;
}
.tool-setting-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.tool-setting-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}
.tool-setting-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.tool-rate-fields {
  display: grid;
  grid-template-columns: minmax(140px, .8fr) minmax(150px, .8fr) minmax(220px, 1.3fr);
  gap: 12px;
  align-items: end;
}
.tool-rate-fields .field input, .tool-rate-fields .field select {
  min-height: 39px;
}
.confirm-rate {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
}
.confirm-rate input, .tool-toggle input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}
.confirm-rate span, .tool-toggle-copy {
  display: grid;
  gap: 4px;
}
.confirm-rate strong, .tool-toggle-copy strong {
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
}
.confirm-rate small, .tool-toggle-copy small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
.tool-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line-subtle);
  border-radius: 9px;
  background: #FCFCFD;
}
.tool-toggle > input { margin-left: 1px; }
.tool-toggle-copy { flex: 1; min-width: 0; }
.tool-toggle-status { flex: 0 0 auto; }
.tool-toggle-locked { background: #F7F7F8; }
.tool-toggle-locked .tool-toggle-copy { opacity: .8; }
.tool-toggle input:disabled { cursor: not-allowed; }
.batch-parts {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}
.batch-part {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 9px;
  padding: 6px 8px;
  border: 1px solid var(--line-subtle);
  border-radius: 7px;
  background: #FCFCFD;
  color: var(--muted);
  font-size: 10px;
}
.batch-part strong { color: var(--ink); }
.batch-part code { color: var(--ink); font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.batch-part-error { flex-basis: 100%; color: #B42318; }

.preformatted {
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--nav-soft);
  color: var(--ink);
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.callout {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--nav-soft);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
}

.callout.warning {
  border-color: #FDE68A;
  background: #FFFBEB;
  color: #B45309;
}

.one-time-code {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--nav-soft);
  color: var(--ink);
  font: 700 13px ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.code-spaced {
  margin: 8px 0;
}

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 24, 27, 0.45);
  backdrop-filter: blur(2px);
}

.modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
  padding: 24px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  color: var(--ink);
}

.modal-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #FFFFFF;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: all 130ms ease;
}

.modal-close:hover {
  background: var(--nav-soft);
  color: var(--ink);
}

.mobile-nav-toggle {
  display: none;
}

.notice-inline {
  margin: 8px 0 0;
  color: #B45309;
  font-size: 11px;
}

.hidden {
  display: none !important;
}

/* ========================================================================
   Service Integrations Area (Kết nối dịch vụ)
   ======================================================================== */
.nav-item[data-nav="integrations"] {
  color: #52525B;
}

.nav-item[data-nav="integrations"] .nav-icon {
  color: var(--muted);
}

.nav-item[data-nav="integrations"].active {
  background: var(--nav-soft);
  color: var(--ink);
}

.integration-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.integration-intro h2 {
  margin: 3px 0 6px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.integration-intro p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.integration-eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.integration-revision {
  flex: none;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--nav-soft);
  color: var(--muted);
  font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.integration-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.integration-tab {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: #52525B;
  text-align: left;
  transition: all 130ms ease;
}

.integration-tab:hover {
  border-color: #D4D4D8;
  background: var(--nav-soft);
}

.integration-tab.active {
  border-color: var(--primary);
  background: var(--nav-soft);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--primary);
}

.integration-tab span {
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-tab small {
  color: var(--muted);
  font-size: 11px;
}

.integration-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  padding: 22px;
  box-shadow: var(--shadow);
}

.integration-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.integration-panel-head h2 {
  margin: 2px 0 5px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.integration-panel-head p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.integration-state {
  display: grid;
  justify-items: end;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.integration-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(310px, 0.85fr);
  align-items: start;
  gap: 16px;
}

.integration-split > section {
  min-width: 0;
}

.integration-panel .card {
  box-shadow: var(--shadow);
}

.subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 10px;
}

.subsection-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}

.subsection-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.credential-list {
  display: grid;
  gap: 10px;
}

.credential-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.credential-card.is-active {
  border-color: var(--primary);
  background: #FAFAFA;
  box-shadow: 0 0 0 1px var(--primary);
}

.credential-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.credential-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.credential-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}

.credential-mark {
  display: grid;
  width: 24px;
  height: 24px;
  flex: none;
  place-items: center;
  border-radius: 6px;
  background: #ECFDF5;
  color: #059669;
  font-size: 13px;
  font-weight: 800;
}

.credential-card:not(.is-active) .credential-mark {
  background: var(--nav-soft);
  color: var(--subtle);
}

.source-chip {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  background: var(--paper);
}

.masked-secret {
  display: block;
  margin: 10px 0 8px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  background: var(--nav-soft);
  color: var(--ink);
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.credential-card .key-value {
  grid-template-columns: 120px minmax(0, 1fr);
  padding: 6px 0;
  font-size: 11px;
}

.credential-current {
  align-self: center;
  color: #059669;
  font-size: 11px;
  font-weight: 650;
}

.integration-form-card {
  border-color: var(--line);
  background: var(--paper);
}

.integration-form-card .card-head h3, .integration-split .card-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.integration-form-card .card-head p, .integration-split .card-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.step-badge {
  display: grid;
  width: 24px;
  height: 24px;
  flex: none;
  place-items: center;
  border-radius: 6px;
  background: var(--nav-soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  transition: background-color 130ms ease;
}

.toggle-row:hover {
  background: var(--nav-soft);
}

.toggle-row input {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 1px 0 0;
  accent-color: var(--primary);
}

.toggle-row span {
  display: grid;
  gap: 3px;
}

.toggle-row strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.toggle-row small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.secret-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--nav-soft);
  color: var(--muted);
  font-size: 11.5px;
}

.secret-status strong {
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
  text-align: right;
  overflow-wrap: anywhere;
}

.callback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--nav-soft);
}

.callback-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.callback-copy > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.callback-copy code {
  color: var(--ink);
  font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.integration-check {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  align-items: baseline;
  margin: 10px 0;
}

.integration-check strong {
  font-size: 11px;
  color: var(--ink);
}

.integration-check span {
  font-size: 11px;
  color: var(--muted);
}

.integration-footer-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.modal-actions {
  justify-content: flex-end;
}

/* ========================================================================
   Responsive Media Queries
   ======================================================================== */
@media (max-width: 1100px) {
  .admin-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .content-wrap {
    padding-right: 20px;
    padding-left: 20px;
  }
  .topbar {
    padding: 0 20px;
  }
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .integration-split {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
  }
}

@media (max-width: 760px) {
  .login-wrap {
    grid-template-columns: 1fr;
  }
  .tool-rate-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .confirm-rate {
    grid-column: 1 / -1;
  }
  .login-showcase {
    display: none;
  }
  .login-panel {
    min-height: 100vh;
    padding: 24px 16px;
  }
  .admin-shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    width: 256px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
  }
  .admin-shell.nav-open .sidebar {
    transform: translateX(0);
  }
  .mobile-nav-toggle {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #FFFFFF;
    color: var(--ink);
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
  }
  .topbar {
    height: 52px;
    padding: 0 14px;
  }
  .topbar-right {
    gap: 8px;
  }
  .topbar-right .environment-label {
    display: none;
  }
  .content-wrap {
    padding: 20px 14px 36px;
  }
  .page-head {
    flex-direction: column;
    margin-bottom: 16px;
  }
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .integration-split {
    grid-template-columns: 1fr;
  }
  .integration-panel {
    padding: 16px;
  }
  .integration-intro {
    padding: 16px;
  }
}

@media (max-width: 500px) {
  .login-panel {
    padding: 16px;
  }
  .login-card {
    padding: 28px 20px;
    border-radius: 14px;
  }
  .login-card h2 {
    font-size: 20px;
  }
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .metric-value {
    font-size: 24px;
  }
  .inline-form {
    grid-template-columns: 1fr;
  }
  .tool-rate-fields {
    grid-template-columns: 1fr;
  }
  .confirm-rate {
    grid-column: auto;
  }
  .inline-form .wide {
    grid-column: auto;
  }
  .key-value {
    grid-template-columns: 105px minmax(0, 1fr);
  }
  .page-head h1 {
    font-size: 20px;
  }
  .breadcrumb {
    gap: 6px;
  }
  .breadcrumb > span:nth-child(2) {
    display: none;
  }
  .top-refresh {
    padding: 0 8px;
  }
  .topbar-right {
    font-size: 0;
  }
  .integration-tabs {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .integration-tab {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 10px 12px;
  }
  .integration-tab small {
    text-align: right;
  }
  .integration-intro, .integration-panel-head {
    flex-direction: column;
  }
  .integration-state {
    grid-template-columns: auto auto;
    align-items: center;
    justify-items: start;
  }
  .integration-revision {
    align-self: flex-start;
  }
  .subsection-head {
    align-items: flex-start;
  }
  .credential-card .key-value {
    grid-template-columns: 105px minmax(0, 1fr);
  }
  .callback-row {
    align-items: flex-start;
  }
}
