/* ============================================================
   ASTRA MBG POSTER AI V3 — Design System
   ============================================================ */

/* ── TOKENS — MitraKSB futuristic glass (dark base) ── */
:root,
[data-theme="dark"] {
  /* Brand */
  --primary: #1a4fb8;
  --primary-dark: #123d8f;
  --primary-darker: #0d2f6d;
  --primary-glow: rgba(26, 79, 184, 0.34);
  --primary-glow-soft: rgba(34, 211, 238, 0.14);
  --accent-blue: #1a4fb8;
  --secondary: #EAB308;
  --secondary-dark: #CA8A04;
  --accent: #1a4fb8;
  --accent-light: #59c2e0;
  --bg-0: #040914;
  --bg-1: #07111F;
  --bg-2: #0B1F3A;
  --bg-app: #040914;
  --bg-surface: #0B1F3A;
  --bg-elevated: #111E36;
  --surface-glass: rgba(11, 22, 44, .70);
  --surface-hover: rgba(34, 211, 238, .06);
  --border-soft: rgba(255,255,255,.08);
  --border-active: rgba(34, 211, 238, .40);
  --sidebar-bg: #070D1B;
  --input-bg: rgba(11, 22, 44, .70);
  --text-primary: #F8FAFC;
  --text-secondary: #AAB4C8;
  --text-muted: #69758B;
  --violet: #7C3AED;
  --purple: #A855F7;
  --blue: #2563EB;
  --cyan: #22D3EE;

  /* Neutrals */
  --bg-base: #090E1A;
  --bg-card: #0F172A;
  --bg-card-2: #162033;
  --bg-card-3: #1E2D45;
  --bg-glass: rgba(15, 23, 42, 0.7);
  --bg-glass-light: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --border-primary: rgba(6, 182, 212, 0.3);

  /* Text */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #4B5563;
  --text-accent: #06B6D4;
}

[data-theme="light"] {
  --bg-0: #F1F5F9;
  --bg-1: #E8EEF6;
  --bg-2: #E2E8F0;
  --bg-app: #F1F5F9;
  --bg-surface: #FFFFFF;
  --bg-elevated: #E8EEF6;
  --surface-glass: rgba(255,255,255,.92);
  --surface-hover: rgba(26,79,184,.06);
  --border-soft: rgba(15,23,42,.10);
  --border-active: rgba(26,79,184,.32);
  --sidebar-bg: #FFFFFF;
  --input-bg: #FFFFFF;
  --text-primary: #0B1220;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --bg-base: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-2: #F1F5F9;
  --bg-card-3: #E2E8F0;
  --bg-glass: rgba(248,250,252,.88);
  --bg-glass-light: rgba(255,255,255,.7);
  --border: rgba(15,23,42,.10);
  --border-strong: rgba(15,23,42,.14);
  --border-primary: rgba(26,79,184,.22);
}

  /* Status */
  --success: #22C55E;
  --success-bg: rgba(34, 197, 94, 0.12);
  --warning: #EAB308;
  --warning-bg: rgba(234, 179, 8, 0.12);
  --error: #EF4444;
  --error-bg: rgba(239, 68, 68, 0.12);
  --info: #3B82F6;
  --info-bg: rgba(59, 130, 246, 0.12);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-collapsed-w: 68px;
  --topbar-h: 0px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

    --surface-card: var(--bg-card);
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
  --shadow-primary: 0 0 28px rgba(124,58,237,0.35);

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 0.4s cubic-bezier(0.4,0,0.2,1);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { min-height: 100%; font-size: 14px; scroll-behavior: smooth; }
html.public-landing { min-height: 100%; }
body {
  font-family: 'Inter', 'Plus Jakarta Sans', system-ui, sans-serif;
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(26,79,184,0.22), transparent 60%),
    radial-gradient(760px 480px at 98% 12%, rgba(34,211,238,0.14), transparent 58%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: clip;
  overflow-y: visible;
  -webkit-font-smoothing: antialiased;
}
/* Public landing: normal document scroll (html is the scroller) so sticky header works. */
body.public-landing { min-height: 100vh; height: auto; overflow: visible; }
body.public-landing section { height: auto; }
body.public-landing [id] { scroll-margin-top: 96px; }
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(600px 300px at 85% 88%, rgba(34,211,238,0.08), transparent 60%);
}
.logo-text .logo-name { background: linear-gradient(135deg, #2a6bd8, #22D3EE); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea, select {
  font: inherit;
  background: var(--surface-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, textarea:focus, select:focus, button:focus-visible {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--primary-glow-soft);
  outline: 2px solid transparent;
}
img { display: block; max-width: 100%; }
ul { list-style: none; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--transition-slow);
  overflow: hidden;
  position: relative;
  z-index: 100;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-w); }

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
  min-height: 60px;
}
.logo-mark { width: 36px; height: 36px; flex-shrink: 0; }
.logo-mark svg { width: 36px; height: 36px; }
.logo-text { flex: 1; overflow: hidden; transition: opacity var(--transition); }
.logo-name {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.05em;
  line-height: 1;
}
.logo-sub {
  display: block;
  font-size: 9.5px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-top: 3px;
  white-space: nowrap;
}
.sidebar-toggle {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-glass-light); color: var(--text-primary); }
.sidebar-toggle svg { width: 16px; height: 16px; }

.collapsed .logo-text { opacity: 0; width: 0; }
.collapsed .sidebar-toggle { margin-left: auto; margin-right: auto; }

/* SPPG Info */
.sidebar-sppg {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: opacity var(--transition);
}
.sppg-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.sppg-name {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}
.sppg-sub {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.collapsed .sidebar-sppg { opacity: 0; height: 0; padding: 0; overflow: hidden; }

/* Nav */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 8px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  margin-bottom: 1px;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-glass-light); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(6,182,212,0.15), rgba(6,182,212,0.05));
  color: var(--primary);
  border-left: 3px solid var(--primary);
}
.nav-item.active svg { stroke: var(--primary); }
.nav-item.nav-cta {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
  color: white;
  margin: 6px 0;
  font-weight: 700;
  box-shadow: var(--shadow-primary);
}
.nav-item.nav-cta:hover { filter: brightness(1.1); }
.nav-badge {
  margin-left: auto;
  background: var(--error);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  flex-shrink: 0;
}
.nav-divider { height: 1px; background: var(--border); margin: 8px 0; }
.collapsed .nav-item span:not(.nav-badge) { display: none; }
.collapsed .nav-badge { position: absolute; top: 4px; right: 4px; }

/* Footer */
.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.sidebar-version { font-size: 10px; color: var(--text-muted); }
.collapsed .sidebar-footer { opacity: 0; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-base);
  position: relative;
  /* single canonical page gutter — do not add horizontal padding to page-header/page-body */
  padding: 0 clamp(20px, 2vw, 32px) 32px;
}
@media (max-width: 640px) { .main-content { padding-left: 16px; padding-right: 16px; } }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  padding: 24px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.page-title-block {}
.page-breadcrumb {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.page-actions { display: flex; gap: 8px; flex-shrink: 0; padding-top: 4px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.card-sm { padding: 14px 16px; border-radius: var(--radius-md); }
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
  color: white;
  box-shadow: 0 0 16px rgba(6,182,212,0.25);
}
.btn-primary:hover { filter: brightness(1.15); box-shadow: 0 0 24px rgba(6,182,212,0.4); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-card-3);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-card-2); border-color: var(--primary); color: var(--primary); }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-glass-light); color: var(--text-primary); }
.btn-danger { background: var(--error-bg); color: var(--error); border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: var(--error); color: white; }
.btn-success { background: var(--success-bg); color: var(--success); border-color: rgba(34,197,94,0.2); }
.btn-success:hover { background: var(--success); color: white; }
.btn-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(234,179,8,0.2); }
.btn-sm { padding: 5px 10px; font-size: 11.5px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-xl { padding: 14px 28px; font-size: 15px; font-weight: 700; border-radius: var(--radius-md); }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); }
.btn-ai {
  background: linear-gradient(135deg, #7C3AED, #4F46E5);
  color: white;
  box-shadow: 0 0 16px rgba(124,58,237,0.25);
}
.btn-ai:hover { filter: brightness(1.15); box-shadow: 0 0 24px rgba(124,58,237,0.4); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-error { background: var(--error-bg); color: var(--error); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.badge-primary { background: var(--primary-glow); color: var(--primary); }

/* Status dot */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.green { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.yellow { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.status-dot.red { background: var(--error); box-shadow: 0 0 6px var(--error); }
.status-dot.grey { background: var(--text-muted); }

/* Lock badge */
.lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
}
.lock-badge.locked { background: rgba(239,68,68,0.12); color: #F87171; border: 1px solid rgba(239,68,68,0.2); }
.lock-badge.unlocked { background: rgba(34,197,94,0.1); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.lock-badge.crop-ok { background: rgba(234,179,8,0.1); color: var(--warning); border: 1px solid rgba(234,179,8,0.2); }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.page-body { padding: 20px 0 32px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

/* ============================================================
   STAT CARD
   ============================================================ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-glow) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: var(--border-primary); transform: translateY(-2px); }
.stat-card-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-card-value { font-size: 32px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-card-sub { font-size: 11px; color: var(--text-secondary); }
.stat-card-icon {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 36px; height: 36px;
  background: var(--bg-glass-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.stat-card-icon svg { width: 18px; height: 18px; }

/* ============================================================
   AI STATUS CARD
   ============================================================ */
.ai-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.ai-status-row:last-child { border-bottom: none; }
.ai-status-label { font-size: 12.5px; color: var(--text-primary); font-weight: 500; }
.ai-status-val {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
}

/* ============================================================
   WORKFLOW WIZARD
   ============================================================ */
.workflow-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.workflow-header {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  background: var(--bg-card);
}
.workflow-title { font-size: 16px; font-weight: 800; color: var(--text-primary); }
.step-indicators { display: flex; gap: 4px; flex: 1; }
.step-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
  white-space: nowrap;
}
.step-indicator.active { background: var(--primary-glow); color: var(--primary); }
.step-indicator.done { color: var(--success); }
.step-indicator.done .step-num { background: var(--success); color: white; }
.step-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bg-card-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.step-indicator.active .step-num { background: var(--primary); color: white; }
.workflow-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}
.workflow-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--bg-card);
}
.step-progress {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================================
   UPLOAD ZONE
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-glass-light);
  position: relative;
  overflow: hidden;
}
.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, var(--primary-glow) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
}
.upload-zone:hover { border-color: var(--primary); }
.upload-zone:hover::before { opacity: 1; }
.upload-zone.drag-over { border-color: var(--primary); background: var(--primary-glow); }
.upload-zone input { display: none; }
.upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-text { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.upload-sub { font-size: 12px; color: var(--text-secondary); }
.upload-formats {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 14px;
}
.upload-format {
  padding: 3px 8px;
  background: var(--bg-card-3);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: monospace;
}

/* ============================================================
   MENU ITEM
   ============================================================ */
.menu-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  margin-bottom: 8px;
}
.menu-item-card:hover { border-color: var(--border-strong); }
.menu-item-num {
  width: 26px; height: 26px;
  background: var(--bg-card-3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}
.menu-item-info { flex: 1; min-width: 0; }
.menu-item-name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.menu-item-gram { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.menu-item-confidence {
  font-size: 10px;
  font-weight: 700;
  color: var(--success);
  background: var(--success-bg);
  padding: 2px 7px;
  border-radius: 10px;
}
.menu-item-actions { display: flex; gap: 4px; }

/* ============================================================
   NUTRITION PANEL
   ============================================================ */
.nutrition-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.nutrition-panel {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.nutrition-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}
.nutrition-field { margin-bottom: 12px; }
.nutrition-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nutrition-unit { color: var(--text-muted); font-weight: 400; }
.nutrition-input { position: relative; }
.nutrition-input input { padding-right: 40px; }
.nutrition-input-unit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  pointer-events: none;
}

/* ============================================================
   IDENTITY STEP
   ============================================================ */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.logo-slot {
  background: var(--bg-card-2);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.logo-slot:hover { border-color: var(--primary); }
.logo-slot.has-logo { border-style: solid; border-color: var(--border-strong); }
.logo-slot img { width: 48px; height: 48px; object-fit: contain; }
.logo-slot-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.logo-slot-plus { font-size: 22px; color: var(--text-muted); }
.logo-slot .logo-lock {
  position: absolute;
  top: 6px; right: 6px;
  font-size: 11px;
  color: var(--error);
}

/* ============================================================
   CREATIVE DIRECTION
   ============================================================ */
.creative-mode-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}
.creative-tab {
  flex: 1;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.creative-tab.active { background: var(--bg-glass-light); color: var(--text-primary); border: 1px solid var(--border-strong); }
.style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.style-card {
  background: var(--bg-card-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.style-card:hover { border-color: var(--primary); }
.style-card.selected { border-color: var(--primary); background: var(--primary-glow); }
.style-card-emoji { font-size: 22px; margin-bottom: 6px; }
.style-card-name { font-size: 11.5px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }

/* ============================================================
   POSTER GRID
   ============================================================ */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.poster-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}
.poster-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.poster-thumb {
  aspect-ratio: 9/16;
  background: linear-gradient(135deg, var(--bg-card-3), var(--bg-card-2));
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}
.poster-thumb-empty {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
  background: #07111f;
}
.poster-card-body { padding: 12px; }
.poster-card-date { font-size: 10px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.poster-card-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.poster-card-status { margin-top: 6px; }
.poster-card-actions {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   PRE-FLIGHT CHECK
   ============================================================ */
.preflight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.preflight-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card-2);
}
.preflight-item.ok { border-color: rgba(34,197,94,0.25); background: var(--success-bg); }
.preflight-item.fail { border-color: rgba(239,68,68,0.25); background: var(--error-bg); }
.preflight-item.crop-ok { border-color: rgba(234,179,8,0.25); background: var(--warning-bg); }
.preflight-icon { font-size: 16px; flex-shrink: 0; }
.preflight-label { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.preflight-sub { font-size: 10.5px; color: var(--text-secondary); }

/* ============================================================
   STUDIO EDITOR
   ============================================================ */
.studio-layout {
  display: grid;
  grid-template-columns: 220px 1fr 240px;
  height: 100vh;
  overflow: hidden;
}
.studio-panel {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  height: 100%;
}
.studio-panel-right {
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  height: 100%;
}
.studio-canvas-area {
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  position: relative;
}
.studio-panel-title {
  padding: 14px 14px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}
.tool-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  width: 100%;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.tool-btn:hover { background: var(--bg-glass-light); color: var(--text-primary); }
.tool-btn.active { background: var(--primary-glow); color: var(--primary); }
.tool-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Layer */
.layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.layer-item:hover { background: var(--bg-glass-light); color: var(--text-primary); }
.layer-item.selected { background: var(--primary-glow); color: var(--primary); }
.layer-item-icon { font-size: 12px; flex-shrink: 0; }
.layer-item-label { flex: 1; font-weight: 500; }
.layer-item-badges { display: flex; gap: 2px; }
.layer-lock-icon { font-size: 10px; }
.layer-crop-icon { font-size: 10px; color: var(--warning); }
.layer-section { padding: 8px 10px 4px; font-size: 9.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* Canvas */
.poster-canvas {
  width: 400px;
  height: 711px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  cursor: default;
}
.poster-canvas-inner {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Canvas toolbar */
.studio-toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  z-index: 10;
}
.studio-toolbar-btn {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}
.studio-toolbar-btn:hover { background: var(--bg-glass-light); color: var(--text-primary); }
.studio-toolbar-btn svg { width: 12px; height: 12px; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  height: 100vh;
  overflow: hidden;
}
.settings-nav {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 10px;
  overflow-y: auto;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
}
.settings-nav-item:hover { background: var(--bg-glass-light); color: var(--text-primary); }
.settings-nav-item.active { background: var(--primary-glow); color: var(--primary); }
.settings-nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.settings-body {
  overflow-y: auto;
  padding: 28px;
}
.settings-section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.settings-section-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.settings-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.settings-row-sub { font-size: 11.5px; color: var(--text-secondary); }
.settings-row-control { flex-shrink: 0; min-width: 200px; }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle {
  position: relative;
  width: 36px; height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle input { display: none; }
.toggle-track {
  width: 36px; height: 20px;
  background: var(--bg-card-3);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  transition: all var(--transition);
  display: block;
  cursor: pointer;
}
.toggle-thumb {
  width: 14px; height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  position: absolute;
  top: 3px; left: 3px;
  transition: all var(--transition);
}
.toggle input:checked + .toggle-track { background: var(--primary); border-color: var(--primary); }
.toggle input:checked ~ .toggle-thumb { transform: translateX(16px); background: white; }
.toggle-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.modal-sub {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 4px;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 320px;
  pointer-events: all;
  animation: toastIn 0.25s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes toastIn {
  from { transform: translateY(-12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   SECTION HEADER
   ============================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.section-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}
.empty-state-icon { font-size: 48px; opacity: 0.5; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.empty-state-sub { font-size: 13px; color: var(--text-secondary); max-width: 320px; line-height: 1.6; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-row { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-group { position: relative; }
.form-hint { font-size: 10.5px; color: var(--text-muted); margin-top: 4px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Radio group */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.radio-option:hover { border-color: var(--border-strong); }
.radio-option.selected { border-color: var(--primary); background: var(--primary-glow); }
.radio-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  margin-top: 1px;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.radio-option.selected .radio-dot { border-color: var(--primary); }
.radio-option.selected .radio-dot::after {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.radio-text { flex: 1; }
.radio-label { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.radio-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* Checkbox */
.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.checkbox-option:hover { background: var(--bg-glass-light); }
.checkbox {
  width: 16px; height: 16px;
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.checkbox.checked { background: var(--primary); border-color: var(--primary); }
.checkbox.checked::after { content: '✓'; color: white; font-size: 10px; font-weight: 700; }
.checkbox-label { font-size: 12.5px; font-weight: 500; color: var(--text-primary); }

/* ============================================================
   RANGE SLIDER
   ============================================================ */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-card-3);
  border: none;
  height: 4px;
  border-radius: 2px;
  padding: 0;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
  cursor: pointer;
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.gap-12 { gap: 12px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary-color { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-sm { font-size: 11.5px; }
.text-xs { font-size: 10px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.separator { height: 1px; background: var(--border); margin: 8px 0; }

/* Color swatch */
.color-swatch {
  width: 20px; height: 20px;
  border-radius: 4px;
  border: 2px solid var(--border-strong);
  cursor: pointer;
  display: inline-block;
}

/* Thumbnail placeholder */
.thumb-placeholder {
  width: 100%;
  aspect-ratio: 9/16;
  background: linear-gradient(135deg, var(--bg-card-3) 0%, var(--bg-card-2) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
}
.thumb-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, var(--primary-glow) 100%);
}

/* AI Processing overlay */
.ai-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
}
.ai-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ai-processing-text { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.ai-processing-sub { font-size: 12px; color: var(--text-secondary); text-align: center; }

/* Variation cards */
.variation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.variation-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}
.variation-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.variation-card.selected { border-color: var(--primary); box-shadow: 0 0 20px var(--primary-glow); }
.variation-label {
  padding: 8px 12px;
  background: var(--bg-card-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.variation-name { font-size: 11px; font-weight: 700; color: var(--text-primary); text-transform: uppercase; }
.variation-style { font-size: 10px; color: var(--text-secondary); }
.variation-actions {
  padding: 8px;
  background: var(--bg-card);
  display: flex;
  gap: 4px;
  justify-content: center;
  border-top: 1px solid var(--border);
}

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* History date chip */
.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Tag pills */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 600; background: var(--bg-card-3); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── LOGIN OVERLAY ── */
.login-overlay{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;background:radial-gradient(ellipse 900px 600px at 50% -10%, rgba(124,58,237,0.22), transparent 60%), radial-gradient(ellipse 700px 500px at 90% 90%, rgba(6,182,212,0.14), transparent 55%), #060a14;}
.login-card{width:380px;max-width:92vw;background:rgba(15,23,42,0.92);border:1px solid rgba(124,58,237,0.28);border-radius:20px;padding:28px;backdrop-filter:blur(16px);box-shadow:0 32px 80px rgba(0,0,0,0.6), 0 0 40px rgba(124,58,237,0.18);}
.login-card h2{font-size:18px;font-weight:800;color:#fff;margin-bottom:6px;}
.login-card p{font-size:12px;color:#94A3B8;margin-bottom:18px;}
.login-input{width:100%;padding:10px 12px;border-radius:10px;border:1px solid rgba(255,255,255,0.12);background:rgba(255,255,255,0.06);color:#fff;font-size:13px;}
.login-input:focus{border-color:#7C3AED;outline:none;box-shadow:0 0 0 3px rgba(124,58,237,0.2);}
.login-btn{width:100%;padding:11px;border-radius:10px;border:none;background:linear-gradient(135deg,#7C3AED,#06B6D4);color:#fff;font-weight:700;cursor:pointer;margin-top:14px;}
.login-btn:hover{filter:brightness(1.08);}

/* ── PROVIDER ACCORDION ── */
.accordion{border:1px solid rgba(255,255,255,0.08);border-radius:14px;overflow:hidden;margin-bottom:10px;background:rgba(255,255,255,0.03);}
.accordion-head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;cursor:pointer;background:rgba(255,255,255,0.02);}
.accordion-head:hover{background:rgba(124,58,237,0.06);}
.accordion-body{padding:14px 16px;border-top:1px solid rgba(255,255,255,0.06);}

/* ── RESPONSIVE ── */
.ai-model-selector { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 18px; padding: 14px 16px; border: 1px solid rgba(103,232,249,.18); border-radius: 12px; background: rgba(6,182,212,.05); }
.ai-model-select { min-width: 260px; background: rgba(4,10,22,.82); border: 1px solid rgba(103,232,249,.3); border-radius: 9px; color: #f8fafc; font-size: 12.5px; font-weight: 600; padding: 9px 12px; cursor: pointer; }
.ai-model-select:focus { border-color: #22d3ee; box-shadow: 0 0 0 3px rgba(34,211,238,.1); outline: none; }
.ai-cta-compare { border: 1px solid rgba(255,255,255,.15) !important; color: #b9c6da !important; background: rgba(255,255,255,.04) !important; }
.ai-cta-compare:hover { border-color: rgba(34,211,238,.55) !important; color: #fff !important; background: rgba(6,182,212,.08) !important; }
.ai-data-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.ai-data-strip-title { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; flex-shrink: 0; }
.ai-data-strip-items { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-data-item { font-size: 11px; font-weight: 600; color: var(--text-secondary); background: rgba(255,255,255,.06); padding: 3px 9px; border-radius: 6px; }

/* ── HYBRID CONTROL PANEL ── */
.ai-mode-row { margin-top: 18px; }
.ai-mode-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ai-mode-btn { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: #cbd5e1; display: flex; flex-direction: column; gap: 3px; cursor: pointer; transition: all .2s ease; }
.ai-mode-btn strong { font-size: 12.5px; color: #fff; }
.ai-mode-btn small { font-size: 10px; color: var(--text-muted); }
.ai-mode-btn.active { border-color: rgba(34,211,238,.6); background: rgba(6,182,212,.12); box-shadow: 0 0 18px rgba(6,182,212,.15); }
.ai-mode-btn.disabled { opacity: .5; cursor: not-allowed; }
.ai-bg-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 12px 16px; border-radius: 12px; border: 1px dashed rgba(255,255,255,.18); background: rgba(255,255,255,.03); }
.ai-bg-status.has-bg { border-style: solid; border-color: rgba(34,211,238,.4); background: rgba(6,182,212,.07); }
.ai-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.ai-compose-row { margin-top: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.03); }
.ai-compose-title { font-size: 11px; font-weight: 700; color: var(--text-secondary); margin-bottom: 10px; }
.ai-compose-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 10px; }
.ai-compose-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 10px; font-weight: 600; color: var(--text-muted); }
.ai-compose-grid input[type="range"] { width: 100%; }
@media (max-width: 900px) {
  .ai-mode-options { grid-template-columns: 1fr; }
  .ai-action-grid { grid-template-columns: 1fr; }
  .ai-compose-grid { grid-template-columns: 1fr 1fr; }
}
.ai-debug-status { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.08); font-size: 10px; color: var(--text-secondary); line-height: 1.8; }
.ai-debug-status strong { color: var(--text-primary); }
.ai-debug-status code { color: var(--primary); font-family: monospace; }
.ai-fallback-badge { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: rgba(234,179,8,.12); border: 1px solid rgba(234,179,8,.25); color: #EAB308; font-size: 11px; font-weight: 700; }
.ai-compare-panel { margin-top: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.03); }
.ai-compare-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ai-compare-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.ai-compare-empty { font-size: 11px; color: var(--text-muted); grid-column: 1 / -1; }
.ai-compare-card { border: 1px solid rgba(255,255,255,.1); border-radius: 10px; overflow: hidden; background: rgba(0,0,0,.2); }
.ai-compare-card img { width: 100%; display: block; aspect-ratio: 9/16; object-fit: cover; }
.ai-compare-meta { padding: 8px 10px; font-size: 10px; color: var(--text-secondary); line-height: 1.7; }
.ai-compare-meta strong { color: #fff; }
.ai-compare-status-ok { color: var(--success); }
.ai-compare-status-err { color: var(--error); }
.ai-raw-panel { margin-top: 16px; padding: 16px; border-radius: 14px; border: 1px solid rgba(34,211,238,.3); background: rgba(6,182,212,.05); }
.ai-raw-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ai-raw-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ai-raw-image { border-radius: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,.15); background: #060a12; }
.ai-raw-image img { width: 100%; display: block; }
.ai-raw-meta { font-size: 11px; color: var(--text-secondary); line-height: 2; }
.ai-raw-meta strong { color: #fff; }
.ai-raw-empty { font-size: 11.5px; color: var(--text-muted); padding: 8px 0; }
.ai-dev-tools { margin-top: 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: 12px 16px; background: rgba(255,255,255,.02); }
.ai-dev-tools summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.ai-dev-tools[open] summary { margin-bottom: 10px; }
@media (max-width: 900px) { .ai-raw-body { grid-template-columns: 1fr; } }


.ai-studio-hero {
  min-height: 156px;
  padding: 28px 32px;
  border: 1px solid rgba(103, 232, 249, 0.24);
  border-radius: 22px;
  background: radial-gradient(circle at 82% 18%, rgba(34, 211, 238, 0.2), transparent 27%), linear-gradient(115deg, #101827 0%, #111936 54%, #1d1641 100%);
  box-shadow: 0 18px 55px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.07);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.ai-studio-hero-copy { position: relative; z-index: 1; max-width: 650px; }
.ai-eyebrow { color: #67e8f9; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.ai-eyebrow-muted { color: rgba(255,255,255,.45); }
.ai-live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 12px #34d399; margin-right: 6px; }
.ai-studio-hero h2 { font-size: 31px; line-height: 1.12; margin: 10px 0 8px; letter-spacing: -.04em; }
.ai-studio-hero p { color: #aab8d0; font-size: 13px; line-height: 1.55; }
.ai-studio-hero-meta { position: relative; z-index: 1; min-width: 148px; padding: 14px; display: flex; flex-direction: column; gap: 3px; border: 1px solid rgba(255,255,255,.13); border-radius: 14px; background: rgba(255,255,255,.07); color: #fff; font-size: 12px; }
.ai-studio-hero-meta small { color: #8fa1bd; font-size: 10px; }
.ai-meta-icon { color: #a78bfa; font-size: 24px; line-height: 1; }
.ai-studio-orb { position: absolute; width: 210px; height: 210px; border-radius: 50%; filter: blur(2px); opacity: .22; }
.ai-studio-orb-one { right: 18%; top: -125px; background: #22d3ee; }
.ai-studio-orb-two { right: 0; bottom: -155px; background: #8b5cf6; }
.ai-lock-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 13px 16px; border: 1px solid rgba(52, 211, 153, .2); border-radius: 13px; background: linear-gradient(90deg, rgba(16, 185, 129, .08), rgba(15,23,42,.65)); }
.ai-lock-bar-label { display: flex; align-items: center; gap: 6px; color: #6ee7b7; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.ai-lock-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-lock-chip { padding: 5px 9px; border-radius: 7px; font-size: 10px; font-weight: 700; border: 1px solid; }
.ai-lock-chip-green { color: #6ee7b7; background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.25); }
.ai-lock-chip-cyan { color: #67e8f9; background: rgba(6,182,212,.1); border-color: rgba(6,182,212,.25); }
.ai-lock-chip-amber { color: #fcd34d; background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.25); }
.ai-lock-chip-indigo { color: #c4b5fd; background: rgba(99,102,241,.1); border-color: rgba(99,102,241,.25); }
.ai-prompt-studio { padding: 22px; border: 1px solid rgba(103,232,249,.18); border-radius: 18px; background: linear-gradient(145deg, rgba(20,31,52,.94), rgba(15,23,42,.82)); box-shadow: 0 12px 32px rgba(0,0,0,.16); }
.ai-prompt-studio-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.ai-prompt-studio-title { display: flex; align-items: center; gap: 11px; }
.ai-prompt-icon { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; background: linear-gradient(135deg, #06b6d4, #6366f1); box-shadow: 0 0 20px rgba(6,182,212,.25); }
.ai-prompt-textarea { display: block; min-height: 92px; resize: vertical; padding: 14px 16px; color: #f8fafc; line-height: 1.55; font-size: 13px; background: rgba(4,10,22,.72); border: 1px solid rgba(103,232,249,.3); border-radius: 12px; }
.ai-prompt-textarea:focus { border-color: #22d3ee; box-shadow: 0 0 0 3px rgba(34,211,238,.1), 0 0 25px rgba(34,211,238,.08); }
.ai-preset-section { margin-top: 16px; }
.ai-preset-label { color: #8393ad; font-size: 10px; font-weight: 700; margin-bottom: 8px; }
.ai-preset-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.ai-preset-chip { padding: 7px 10px; color: #b9c6da; font-size: 10.5px; font-weight: 600; border: 1px solid rgba(255,255,255,.1); border-radius: 8px; background: rgba(255,255,255,.045); transition: all .2s ease; }
.ai-preset-chip:hover { color: #fff; border-color: rgba(34,211,238,.55); background: rgba(6,182,212,.1); transform: translateY(-1px); }
.ai-prompt-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 19px; padding-top: 17px; border-top: 1px solid rgba(255,255,255,.08); }
.ai-cta-main { background: linear-gradient(135deg, #06b6d4, #4f46e5) !important; box-shadow: 0 8px 22px rgba(6,182,212,.2); }
.ai-cta-main:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(6,182,212,.3); }
.ai-result-layout { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(300px, 1.1fr); align-items: start; gap: 20px; }
.ai-canvas-panel, .ai-report-card { border: 1px solid rgba(255,255,255,.1); border-radius: 17px; background: linear-gradient(145deg, rgba(20,29,47,.95), rgba(9,14,26,.95)); }
.ai-canvas-panel { padding: 15px; display: flex; flex-direction: column; align-items: center; }
.ai-canvas-panel-header { width: 100%; display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ai-canvas-wrapper { width: min(100%, 330px); aspect-ratio: 9/16; border: 1px solid rgba(255,255,255,.15); border-radius: 12px; overflow: hidden; box-shadow: 0 14px 40px rgba(0,0,0,.5); }
.ai-report-card { padding: 20px; }
.ai-report-concept { padding-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.ai-palette-row { padding: 16px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.ai-rationale { margin: 16px 0; padding: 12px; border-left: 3px solid #22d3ee; border-radius: 0 9px 9px 0; background: rgba(6,182,212,.06); }
.ai-rationale-text { color: #cbd5e1; font-size: 11.5px; line-height: 1.6; }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .nutrition-grid { grid-template-columns: 1fr; }
  .studio-layout { grid-template-columns: 1fr; }
}

/* ============================================================
   MitraKSB FINAL — futuristic glass components
   ============================================================ */
.mk-sidebar-submenu { display: none; margin: 2px 0 6px 14px; border-left: 1px solid var(--border-soft); padding-left: 8px; }
.mk-sidebar-submenu.open { display: block; }
.mk-chev { transition: transform .2s ease; display:inline-block; }
[aria-expanded='true'] .mk-chev { transform: rotate(90deg); }
.settings-accordion { border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface-glass); backdrop-filter: blur(10px); margin-bottom: 12px; overflow: hidden; }
.settings-accordion > .settings-accordion-head { display:flex; align-items:center; justify-content:space-between; padding: 14px 18px; cursor:pointer; font-weight: 700; color: var(--text-primary); }
.settings-accordion > .settings-accordion-head:hover { background: var(--surface-hover); }
.settings-accordion > .settings-accordion-body { display:none; padding: 16px 18px; border-top: 1px solid var(--border-soft); }
.settings-accordion.open > .settings-accordion-body { display:block; }
.settings-accordion.open > .settings-accordion-head { border-left: 2px solid var(--border-active); }
.status-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }
.status-dot.ready { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.nc { background: var(--text-muted); }
.status-dot.disabled { background: var(--warning); }
.status-dot.err { background: var(--danger); }
.mk-hero { position:relative; overflow:hidden; border-radius: 22px; padding: 34px 30px; border:1px solid var(--border-soft); background:
  linear-gradient(135deg, rgba(124,58,237,0.18), rgba(37,99,235,0.10) 45%, rgba(34,211,238,0.06));
  backdrop-filter: blur(12px); }
.mk-hero h1 { font-size: 26px; font-weight: 800; letter-spacing:-0.01em; }
.mk-hero p { color: var(--text-secondary); margin-top: 6px; font-size: 13px; }
.mk-stat-grid { display:grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 14px; }
.mk-stat { border:1px solid var(--border-soft); border-radius: 16px; padding: 16px; background: var(--surface-glass); backdrop-filter: blur(8px); }
.mk-stat .k { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.mk-stat .v { font-size: 22px; font-weight: 800; margin-top: 6px; }
.mk-social-card { border:1px solid var(--border-soft); border-radius: 16px; padding: 16px; background: var(--surface-glass); display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; backdrop-filter: blur(8px); }
.mk-btn-grad { background: linear-gradient(135deg, var(--violet), var(--blue)); color:#fff; border:none; border-radius: 12px; font-weight: 700; padding: 11px 18px; box-shadow: 0 8px 26px rgba(124,58,237,0.28); transition: filter .2s ease, transform .1s ease; }
.mk-btn-grad:hover { filter: brightness(1.08); }
.mk-btn-grad:active { transform: translateY(1px); }
.mk-empty { text-align:center; padding: 40px 20px; border:1px dashed var(--border-soft); border-radius: 18px; color: var(--text-secondary); }
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: var(--sidebar-collapsed-w) 1fr !important; }
  .mk-hero h1 { font-size: 20px; }
}
@media (max-width: 1366px) { .mk-stat-grid { grid-template-columns: 1fr 1fr; } }


/* dark select fix */
select, .dark-select, .login-input { color-scheme: dark; }
select option, .dark-select option { background: #0D1322; color: #F8FAFC; }
select option:checked { background: #1e293b; }


/* ============================================================
   MitraKSB THEME — light mode overrides
   ============================================================ */
[data-theme='light'] body { background: linear-gradient(180deg, #F1F5F9, #E8EEF6 55%, #E2E8F0); background-attachment: fixed; }
[data-theme='light'] .app-shell { background: var(--bg-app); }
[data-theme='light'] .sidebar { background: #FFFFFF; box-shadow: 0 0 0 1px rgba(15,23,42,.04), 8px 0 30px rgba(15,23,42,.04); }
[data-theme='light'] .nav-item { color: #475569; }
[data-theme='light'] .nav-item:hover { background: rgba(26,79,184,.06); color: #0B1220; }
[data-theme='light'] .nav-item.active { background: rgba(26,79,184,.10); color: #123d8f; }
[data-theme='light'] .card, [data-theme='light'] .mk-stat, [data-theme='light'] .ai-raw-panel, [data-theme='light'] .accordion, [data-theme='light'] .settings-accordion, [data-theme='light'] .mk-social-card { background: #FFFFFF !important; border-color: rgba(15,23,42,.10) !important; color: #0B1220; }
[data-theme='light'] .card-title, [data-theme='light'] .page-title, [data-theme='light'] h1, [data-theme='light'] h2, [data-theme='light'] h3 { color: #0B1220; }
[data-theme='light'] .text-secondary, [data-theme='light'] .page-subtitle, [data-theme='light'] .card-subtitle { color: #475569; }
[data-theme='light'] input, [data-theme='light'] textarea, [data-theme='light'] select, [data-theme='light'] .login-input { background: #FFFFFF !important; color: #0B1220 !important; border-color: rgba(15,23,42,.14) !important; }
[data-theme='light'] .mk-select-list { background: #FFFFFF !important; border-color: rgba(26,79,184,.28) !important; box-shadow: 0 16px 40px rgba(15,23,42,.16) !important; }
[data-theme='light'] .mk-select-list [role='option'] { color: #0B1220 !important; }
[data-theme='light'] .mk-select-list [role='option'][aria-selected='true'] { background: rgba(26,79,184,.10) !important; color: #123d8f !important; }
[data-theme='light'] table { color: #0B1220; }
[data-theme='light'] th { color: #475569; }
[data-theme='light'] .btn-secondary { background: #F1F5F9 !important; color: #0B1220 !important; border-color: rgba(15,23,42,.14) !important; }
[data-theme='light'] .btn-ghost { color: #334155 !important; }
[data-theme='light'] .modal-box, [data-theme='light'] .modal-content { background: #FFFFFF; color: #0B1220; }
[data-theme='light'] .toast { background: #FFFFFF; color: #0B1220; border-color: rgba(15,23,42,.12); }
[data-theme='light'] .login-overlay { background: radial-gradient(ellipse 900px 600px at 50% -10%, rgba(26,79,184,.10), transparent 60%), #E2E8F0; }
[data-theme='light'] .login-card { background: #FFFFFF; border-color: rgba(15,23,42,.10); box-shadow: 0 24px 60px rgba(15,23,42,.12); }
[data-theme='light'] .login-card h2 { color: #0B1220; }
[data-theme='light'] .mk-hero { background: linear-gradient(135deg, rgba(26,79,184,.10), rgba(34,211,238,.06)); border-color: rgba(15,23,42,.10); }
[data-theme='light'] .ai-prompt-studio, [data-theme='light'] .ai-data-strip, [data-theme='light'] .ai-lock-bar { background: #FFFFFF; }
[data-theme='light'] .ai-raw-header, [data-theme='light'] .ai-prompt-studio-title, [data-theme='light'] .ai-raw-header > div { color: #0B1220 !important; }
[data-theme='light'] .settings-nav-item { color: #475569; }
[data-theme='light'] .settings-nav-item.active { background: rgba(26,79,184,.10); color: #123d8f; }
[data-theme='light'] .status-dot.nc { background: #94A3B8; }
[data-theme='light'] .page-breadcrumb { color: #64748B; }
.mk-theme-toggle { display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border-radius:10px; border:1px solid var(--border-soft); background:var(--surface-glass); color:var(--text-primary); font-size:12px; cursor:pointer; }
.mk-theme-toggle:hover { background: var(--surface-hover); }


/* (legacy collapsed-icon block removed — superseded by drawer rules below) */


/* settings responsive */
@media (max-width: 900px) { .settings-layout { grid-template-columns: 1fr !important; } .settings-panel { max-width: 100% !important; } }


/* ============================================================
   AUTHENTICATED APP — responsive drawer + overflow guards
   ============================================================ */
.app-menu-btn { display:none; position:fixed; top:12px; left:12px; z-index:120; width:42px; height:42px; border-radius:10px; border:1px solid var(--border-soft); background:var(--surface-glass); color:var(--text-primary); font-size:18px; align-items:center; justify-content:center; }
@media (max-width: 900px) {
  .app-menu-btn { display:inline-flex; }
  .sidebar,
  .sidebar.collapsed {
    position:fixed !important; top:0 !important; left:0 !important; right:auto !important;
    margin:0 !important; height:100vh; z-index:130;
    width:min(280px, 86vw) !important; max-width:100% !important;
    transform:translateX(-105%); transition:transform .2s ease;
    box-shadow:0 24px 60px rgba(0,0,0,.5); border-right:1px solid var(--border);
  }
  .sidebar.mobile-open { transform:translateX(0) !important; }
  .sidebar .logo-text, .sidebar .sidebar-sppg, .sidebar .sidebar-version { display:block; opacity:1; width:auto; height:auto; }
  .sidebar .nav-item { justify-content:flex-start; }
  .sidebar .nav-item span { display:inline; }
  .sidebar-overlay { position:fixed; inset:0; background:rgba(2,5,12,.6); z-index:110; display:none; }
  .main-content { padding-left:16px !important; padding-right:16px !important; padding-top:64px; }
  .main-content, .app-shell { max-width:100%; min-width:0; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns:1fr !important; }
}
/* keep tables from forcing page-wide overflow */
.card table, .table-wrap { max-width:100%; }
.table-wrap, .card > table { display:block; overflow-x:auto; white-space:nowrap; }
.app-shell, .main-content { min-width:0; }
.main-content > * { max-width:100%; }


/* ==========================================================
   MitraKSB Production Layout Guard
   Fix overflow/offside in workflow, forms and sidebar
   ========================================================== */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Main workspace must be allowed to shrink inside app shell */
#main-content,
#main-content > *,
.settings-layout,
.settings-body {
  min-width: 0;
  max-width: 100%;
}

/* Prevent grid/flex children from forcing parent wider */
#main-content [style*="display:grid"] > *,
#main-content [style*="display: grid"] > *,
#main-content [style*="display:flex"] > *,
#main-content [style*="display: flex"] > * {
  min-width: 0;
}

/* Form controls must stay inside their column */
#main-content textarea,
#main-content input,
#main-content select {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Prompt textarea */
.ai-prompt-textarea {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  resize: vertical;
}

/* Cards cannot bleed outside workspace */
#main-content .card {
  min-width: 0;
  max-width: 100%;
}

/* Sidebar navigation guard */
.sidebar,
.sidebar-nav,
.sidebar-menu,
nav {
  box-sizing: border-box;
}

.sidebar * {
  box-sizing: border-box;
  max-width: 100%;
}

/* Narrow screens */
@media (max-width: 1100px) {
  #main-content [style*="grid-template-columns:1fr 1fr"],
  #main-content [style*="grid-template-columns: 1fr 1fr"],
  #main-content [style*="grid-template-columns:1.2fr 0.8fr"],
  #main-content [style*="grid-template-columns: 1.2fr 0.8fr"] {
    grid-template-columns: 1fr !important;
  }
}


/* ==========================================================
   MitraKSB Canonical Centered Workspace
   Desktop content alignment for all authenticated pages
   ========================================================== */

:root {
  --workspace-max-w: 1380px;
}

/* Main area = remaining viewport beside sidebar */
.main-content {
  min-width: 0;
  padding-left: clamp(20px, 2.4vw, 40px);
  padding-right: clamp(20px, 2.4vw, 40px);
}

/*
 * Every page rendered directly into #main-content gets one
 * consistent centered workspace instead of drifting right.
 */
#main-content > * {
  width: 100%;
  max-width: var(--workspace-max-w);
  margin-left: auto;
  margin-right: auto;
  min-width: 0;
}

/* Header/body stay aligned to exactly the same horizontal axis */
#main-content .page-header,
#main-content .page-body {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* Large cards/grids must never escape the centered workspace */
#main-content .card,
#main-content .grid-2,
#main-content .grid-3,
#main-content .grid-4,
#main-content .grid-auto,
#main-content .settings-layout,
#main-content .settings-body {
  min-width: 0;
  max-width: 100%;
}

/* Medium screens: use all available workspace cleanly */
@media (max-width: 1500px) {
  :root {
    --workspace-max-w: 1240px;
  }
}

/* Tablet/mobile keeps existing responsive behavior */
@media (max-width: 1100px) {
  .main-content {
    padding-left: 18px;
    padding-right: 18px;
  }

  #main-content > * {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding-left: 16px;
    padding-right: 16px;
  }
}


/* ==========================================================
   MitraKSB Sidebar Alignment Fix
   Remove browser default UL indentation
   ========================================================== */

.sidebar-nav > ul {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.sidebar-nav > ul > li {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.sidebar-nav .nav-item {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  justify-content: flex-start;
}

.sidebar-nav .nav-divider {
  margin-left: 0;
  margin-right: 0;
}


/* =========================================================
   MitraKSB — Google OAuth Login
   ========================================================= */

.login-oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.login-oauth-divider::before,
.login-oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, .22);
}

.login-oauth-divider span {
  flex: 0 0 auto;
}

.google-login-btn {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 12px;
  background: rgba(255, 255, 255, .96);
  color: #0f172a;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  cursor: pointer;
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    background .18s ease;
}

.google-login-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, .55);
  box-shadow:
    0 10px 30px rgba(15, 23, 42, .16),
    0 0 0 3px rgba(59, 130, 246, .08);
  background: #ffffff;
}

.google-login-btn:active {
  transform: translateY(0);
}

.google-login-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, .26);
  color: #2563eb;
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

@media (prefers-color-scheme: dark) {
  .google-login-btn {
    background: rgba(255, 255, 255, .94);
    color: #0f172a;
  }
}

/* =========================================================
   MitraKSB LOGIN — BRAND + GOOGLE OAUTH FINAL
   ========================================================= */

.login-overlay {
  font-family: "Inter", "Plus Jakarta Sans", system-ui, -apple-system,
               BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.login-card {
  width: 400px;
  max-width: calc(100vw - 32px);
  padding: 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin: 0 0 24px;
}

.login-brand-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 230px;
  max-height: 64px;
  object-fit: contain;
  object-position: left center;
}

.login-card h2 {
  margin: 0 0 7px;
  color: #f8fafc;
  font-family: "Plus Jakarta Sans", "Inter", sans-serif;
  font-size: 21px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.login-card p {
  margin: 0 0 24px;
  color: #94a3b8;
  font-size: 12.5px;
  line-height: 1.55;
  font-weight: 450;
}

.login-card label {
  display: block;
  color: #a5b4c8 !important;
  font-family: "Inter", sans-serif;
  font-size: 12px !important;
  line-height: 1.4;
  font-weight: 500;
}

.login-input {
  width: 100%;
  margin-top: 7px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 500;
}

.login-btn {
  min-height: 46px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.login-oauth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 18px 0;
  color: #64748b;
  font-family: "Inter", sans-serif;
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
}

.login-oauth-divider::before,
.login-oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(148,163,184,.22);
}

.login-oauth-divider span {
  flex: 0 0 auto;
  padding: 0 3px;
}

.google-login-btn {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 46px;
  padding: 0 18px;
  margin: 0;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;

  border: 1px solid #d7dde7;
  border-radius: 10px;

  background: #ffffff;
  color: #172033;

  font-family: "Inter", sans-serif;
  font-size: 13.5px;
  line-height: 1;
  font-weight: 650;
  letter-spacing: -0.01em;

  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.14);

  transition:
    transform .16s ease,
    border-color .16s ease,
    box-shadow .16s ease,
    background .16s ease;
}

.google-login-btn:hover {
  background: #f8fafc;
  border-color: #93b4ee;
  box-shadow:
    0 8px 24px rgba(0,0,0,.20),
    0 0 0 3px rgba(59,130,246,.08);
  transform: translateY(-1px);
}

.google-login-btn:active {
  transform: translateY(0);
}

.google-login-icon {
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}

[data-theme="light"] .login-card h2 {
  color: #0f172a;
}

[data-theme="light"] .login-card p,
[data-theme="light"] .login-card label {
  color: #64748b !important;
}

@media (max-width: 520px) {
  .login-card {
    padding: 26px 22px;
  }

  .login-brand-logo {
    max-width: 205px;
    max-height: 58px;
  }
}

/* =========================================================
   MitraKSB — Billing Clean UI
   ========================================================= */

.billing-page-header {
  align-items: flex-start;
  gap: 18px;
}

.billing-page-subtitle {
  margin-top: 6px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.55;
}

.billing-page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.billing-stat-grid {
  margin-bottom: 18px;
}

.billing-stat {
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.billing-stat-note {
  margin-top: 7px;
  color: #64748b;
  font-size: 10.5px;
}

.billing-section {
  margin-bottom: 16px;
  padding: 20px;
}

.billing-section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.billing-section-title {
  font-size: 14px;
  font-weight: 800;
}

.billing-section-subtitle {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 11px;
}

.billing-tenant-grid {
  display: grid;
  grid-template-columns:
    repeat(2,minmax(0,1fr));
  gap: 12px;
}

.billing-tenant-card {
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 15px;
  background:
    linear-gradient(
      145deg,
      rgba(15,23,42,.62),
      rgba(15,23,42,.28)
    );
}

.billing-tenant-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.billing-tenant-name {
  color: #f8fafc;
  font-size: 13.5px;
  font-weight: 800;
}

.billing-tenant-meta {
  margin-top: 4px;
  color: #7f8da3;
  font-size: 10.5px;
}

.billing-status-pill {
  height: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.billing-status-pill.is-active {
  color: #86efac;
  background: rgba(34,197,94,.11);
  border: 1px solid rgba(34,197,94,.20);
}

.billing-status-pill.is-pending {
  color: #fbbf24;
  background: rgba(245,158,11,.10);
  border: 1px solid rgba(245,158,11,.20);
}

.billing-status-pill.is-suspended {
  color: #fca5a5;
  background: rgba(239,68,68,.10);
  border: 1px solid rgba(239,68,68,.18);
}

.billing-sub-grid {
  display: grid;
  grid-template-columns:
    repeat(3,minmax(0,1fr));
  gap: 8px;
  margin-top: 16px;
}

.billing-sub-item {
  padding: 10px;
  border: 1px solid rgba(148,163,184,.10);
  border-radius: 11px;
  background: rgba(2,6,23,.16);
}

.billing-sub-item span {
  display: block;
  color: #64748b;
  font-size: 9.5px;
  margin-bottom: 5px;
}

.billing-sub-item strong {
  color: #e5edf8;
  font-size: 11.5px;
}

.billing-tenant-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.billing-history-wrap {
  overflow-x: auto;
}

.billing-history-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  font-size: 10.5px;
}

.billing-history-table th {
  padding: 10px 8px;
  color: #64748b;
  font-size: 9.5px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}

.billing-history-table td {
  padding: 11px 8px;
  color: #b7c2d1;
  border-bottom:
    1px solid rgba(148,163,184,.07);
}

.billing-empty-state,
.billing-empty-cell {
  padding: 24px;
  color: #64748b;
  text-align: center;
}

@media (max-width:1050px) {
  .billing-tenant-grid {
    grid-template-columns:1fr;
  }
}

@media (max-width:720px) {
  .billing-page-header {
    flex-direction:column;
  }

  .billing-page-actions {
    width:100%;
    justify-content:flex-start;
  }

  .billing-sub-grid {
    grid-template-columns:1fr;
  }
}


/* =========================================================
   MitraKSB — Billing Dashboard Layout V3
   ========================================================= */

/* Semua blok billing punya lebar dan alignment yang sama */
.billing-page-header,
.billing-stat-grid,
.billing-section,
#manual-billing-anchor {
  width: 100%;
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}


/* ---------------------------------------------------------
   HEADER
   --------------------------------------------------------- */

.billing-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.billing-page-header .page-title {
  margin: 0;
}

.billing-page-subtitle {
  margin-top: 6px;
  max-width: 520px;
  color: #8290a5;
  font-size: 11.5px;
  line-height: 1.55;
}

.billing-page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.billing-page-actions .btn,
.billing-page-actions .mk-btn-grad {
  min-height: 40px;
  padding-left: 18px;
  padding-right: 18px;
  white-space: nowrap;
}


/* ---------------------------------------------------------
   TOP STATS
   --------------------------------------------------------- */

.billing-stat-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.billing-stat {
  min-width: 0;
  min-height: 98px;
  padding: 17px 18px !important;

  display: flex;
  flex-direction: column;
  justify-content: center;

  border-radius: 15px;
}

.billing-stat .k {
  margin-bottom: 6px;
  color: #64748b;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.billing-stat .v {
  margin: 0;
  color: #f8fafc;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 850;
  letter-spacing: -.025em;
}

.billing-stat-note {
  margin-top: 7px;
  color: #65738a;
  font-size: 9.5px;
  line-height: 1.35;
}


/* ---------------------------------------------------------
   SECTIONS
   --------------------------------------------------------- */

.billing-section {
  padding: 18px 20px !important;
  margin-top: 0;
  margin-bottom: 16px;
  border-radius: 16px;
}

#manual-billing-anchor {
  padding: 0;
}

#manual-billing-anchor .billing-section {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.billing-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.billing-section-title {
  color: #f8fafc;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -.015em;
}

.billing-section-subtitle {
  margin-top: 4px;
  color: #76859a;
  font-size: 10.5px;
  line-height: 1.45;
}


/* ---------------------------------------------------------
   DAPUR LIST
   Satu dapur = satu row horizontal penuh
   --------------------------------------------------------- */

.billing-tenant-grid {
  display: flex !important;
  flex-direction: column;
  width: 100%;
  gap: 10px;
}

.billing-tenant-card {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;

  display: grid;
  grid-template-columns:
    minmax(230px, 1.15fr)
    minmax(430px, 2fr)
    minmax(220px, auto);

  align-items: center;
  gap: 20px;

  padding: 16px 17px;

  border: 1px solid rgba(148,163,184,.13);
  border-radius: 14px;

  background:
    linear-gradient(
      135deg,
      rgba(15,23,42,.62),
      rgba(13,21,37,.38)
    );

  transition:
    border-color .16s ease,
    transform .16s ease,
    box-shadow .16s ease;
}

.billing-tenant-card:hover {
  border-color: rgba(59,130,246,.30);
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}


/* identitas dapur */

.billing-tenant-head {
  min-width: 0;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.billing-tenant-name {
  overflow: hidden;
  color: #f8fafc;
  font-size: 13.5px;
  line-height: 1.3;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.billing-tenant-meta {
  overflow: hidden;
  margin-top: 4px;
  color: #718096;
  font-size: 10px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* status */

.billing-status-pill {
  flex: 0 0 auto;

  padding: 4px 8px;
  border-radius: 999px;

  font-size: 8.5px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.billing-status-pill.is-active {
  color: #86efac;
  background: rgba(34,197,94,.10);
  border: 1px solid rgba(34,197,94,.20);
}

.billing-status-pill.is-pending {
  color: #fbbf24;
  background: rgba(245,158,11,.10);
  border: 1px solid rgba(245,158,11,.20);
}

.billing-status-pill.is-suspended {
  color: #fca5a5;
  background: rgba(239,68,68,.10);
  border: 1px solid rgba(239,68,68,.18);
}


/* paket / expiry / kredit */

.billing-sub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;

  min-width: 0;
  margin: 0;
}

.billing-sub-item {
  min-width: 0;
  min-height: 58px;

  display: flex;
  flex-direction: column;
  justify-content: center;

  padding: 9px 11px;

  border: 1px solid rgba(148,163,184,.09);
  border-radius: 10px;

  background: rgba(2,6,23,.18);
}

.billing-sub-item span {
  display: block;
  margin: 0 0 5px;

  color: #64748b;
  font-size: 9px;
  line-height: 1;
  font-weight: 600;
}

.billing-sub-item strong {
  display: block;

  overflow: hidden;

  color: #e7eef8;
  font-size: 11.5px;
  line-height: 1.25;
  font-weight: 750;

  text-overflow: ellipsis;
  white-space: nowrap;
}


/* actions */

.billing-tenant-actions {
  min-width: 210px;

  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;

  margin: 0;
}

.billing-tenant-actions .btn {
  min-height: 32px;
  padding: 6px 11px;
  white-space: nowrap;
}


/* ---------------------------------------------------------
   HISTORY
   --------------------------------------------------------- */

.billing-history-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
}

.billing-history-table {
  width: 100%;
  min-width: 960px;

  border-collapse: collapse;
  table-layout: auto;

  font-size: 10.5px;
}

.billing-history-table thead th {
  padding: 10px 9px;

  color: #61728d;
  font-size: 9px;
  line-height: 1.25;
  font-weight: 700;

  text-align: left;

  border-bottom: 1px solid rgba(148,163,184,.12);
}

.billing-history-table tbody td {
  padding: 12px 9px;

  color: #b5c0d0;
  font-size: 10.5px;
  line-height: 1.4;

  vertical-align: middle;

  border-bottom: 1px solid rgba(148,163,184,.07);
}

.billing-history-table tbody tr:last-child td {
  border-bottom: none;
}

.billing-history-table tbody tr:hover {
  background: rgba(59,130,246,.035);
}

.billing-history-table td strong {
  color: #e7eef8;
}

.billing-empty-state,
.billing-empty-cell {
  padding: 28px !important;
  color: #64748b !important;
  font-size: 11px;
  text-align: center !important;
}


/* ---------------------------------------------------------
   LIGHT MODE
   --------------------------------------------------------- */

[data-theme="light"] .billing-stat .v,
[data-theme="light"] .billing-section-title,
[data-theme="light"] .billing-tenant-name {
  color: #0f172a;
}

[data-theme="light"] .billing-tenant-card {
  background:
    linear-gradient(
      135deg,
      #ffffff,
      #f8fafc
    );
}

[data-theme="light"] .billing-sub-item {
  background: #f8fafc;
}

[data-theme="light"] .billing-sub-item strong,
[data-theme="light"] .billing-history-table td strong {
  color: #172033;
}


/* ---------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------- */

@media (max-width: 1200px) {
  .billing-stat-grid {
    grid-template-columns:
      repeat(2, minmax(0,1fr));
  }

  .billing-tenant-card {
    grid-template-columns:
      minmax(200px, 1fr)
      minmax(360px, 2fr);
  }

  .billing-tenant-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 760px) {
  .billing-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .billing-page-actions {
    justify-content: flex-start;
  }

  .billing-stat-grid {
    grid-template-columns: 1fr;
  }

  .billing-tenant-card {
    display: block;
  }

  .billing-sub-grid {
    grid-template-columns: 1fr;
    margin-top: 14px;
  }

  .billing-tenant-actions {
    justify-content: flex-start;
    margin-top: 14px;
  }

  .billing-section {
    padding: 15px !important;
  }
}


/* =========================================================
   MITRAKSB BILLING V4 — COMPACT ADMIN DASHBOARD
   ========================================================= */

.billing-v4-wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

.billing-v4-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.billing-v4-subtitle {
  margin-top: 5px;
  color: #76859a;
  font-size: 11.5px;
}

.billing-v4-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.billing-v4-actions .btn,
.billing-v4-actions .mk-btn-grad {
  min-height: 40px;
  padding: 0 17px;
  white-space: nowrap;
}


/* STATS */

.billing-v4-stats {
  display: grid;
  grid-template-columns:
    repeat(4,minmax(0,1fr));
  gap: 11px;
  margin-bottom: 16px;
}

.billing-v4-stat {
  min-width: 0;
  padding: 16px 17px;

  border: 1px solid var(--border-soft);
  border-radius: 14px;

  background: rgba(15,23,42,.55);
}

.billing-v4-stat span {
  display: block;

  color: #64748b;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.billing-v4-stat strong {
  display: block;

  margin-top: 7px;

  color: #f8fafc;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: -.025em;
}

.billing-v4-stat small {
  display: block;

  margin-top: 7px;

  color: #58677e;
  font-size: 9.5px;
}


/* PANEL */

.billing-v4-panel {
  width: 100%;
  box-sizing: border-box;

  margin-bottom: 15px;
  padding: 18px;

  border: 1px solid var(--border-soft);
  border-radius: 15px;

  background: rgba(15,23,42,.55);
}

.billing-v4-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  margin-bottom: 14px;
}

.billing-v4-panel-head h3 {
  margin: 0;

  color: #f8fafc;
  font-size: 13.5px;
  font-weight: 800;
}

.billing-v4-panel-head p {
  margin: 4px 0 0;

  color: #6f7e93;
  font-size: 10.5px;
}

.billing-v4-count {
  padding: 5px 9px;

  border: 1px solid rgba(59,130,246,.18);
  border-radius: 999px;

  background: rgba(37,99,235,.12);

  color: #60a5fa;
  font-size: 9px;
  font-weight: 700;
}


/* TABLE */

.billing-v4-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.billing-v4-table {
  width: 100%;
  min-width: 880px;

  border-collapse: collapse;

  font-size: 10.5px;
}

.billing-v4-table th {
  padding: 9px 10px;

  color: #607089;
  font-size: 9px;
  font-weight: 700;

  text-align: left;

  border-bottom:
    1px solid rgba(148,163,184,.12);
}

.billing-v4-table td {
  padding: 13px 10px;

  color: #aebacd;
  vertical-align: middle;

  border-bottom:
    1px solid rgba(148,163,184,.07);
}

.billing-v4-table tbody tr:last-child td {
  border-bottom: none;
}

.billing-v4-table tbody tr:hover {
  background: rgba(59,130,246,.035);
}

.billing-v4-name {
  color: #f1f5f9;
  font-size: 11.5px;
  font-weight: 750;
}

.billing-v4-meta {
  margin-top: 4px;

  color: #64748b;
  font-size: 9.5px;
}

.billing-v4-plan {
  display: inline-flex;

  padding: 4px 7px;

  border-radius: 7px;

  background: rgba(37,99,235,.10);

  color: #93c5fd;
  font-size: 9.5px;
  font-weight: 750;
}

.billing-v4-plan.empty {
  background: rgba(148,163,184,.08);
  color: #7b899c;
}

.billing-v4-credit-total {
  margin-left: 2px;
  color: #64748b;
}

.billing-v4-status {
  display: inline-flex;

  padding: 4px 7px;

  border-radius: 999px;

  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.billing-v4-status.active {
  color: #86efac;
  background: rgba(34,197,94,.10);
}

.billing-v4-status.pending {
  color: #fbbf24;
  background: rgba(245,158,11,.10);
}

.billing-v4-status.suspended {
  color: #fca5a5;
  background: rgba(239,68,68,.10);
}

.billing-v4-action-col,
.billing-v4-row-actions {
  text-align: right !important;
}

.billing-v4-row-actions {
  white-space: nowrap;
}

.billing-v4-row-actions .btn {
  margin-left: 5px;
}

.billing-v4-empty {
  padding: 28px !important;

  color: #64748b !important;
  text-align: center !important;
}

.billing-v4-history {
  margin-top: 0;
}

.billing-v4-error {
  color: #f87171;
  font-size: 11px;
}


/* LIGHT */

[data-theme="light"] .billing-v4-stat,
[data-theme="light"] .billing-v4-panel {
  background: #ffffff;
}

[data-theme="light"] .billing-v4-stat strong,
[data-theme="light"] .billing-v4-panel-head h3,
[data-theme="light"] .billing-v4-name {
  color: #0f172a;
}


/* RESPONSIVE */

@media (max-width: 1000px) {
  .billing-v4-stats {
    grid-template-columns:
      repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 720px) {
  .billing-v4-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .billing-v4-actions {
    justify-content: flex-start;
  }

  .billing-v4-stats {
    grid-template-columns: 1fr;
  }

  .billing-v4-panel {
    padding: 14px;
  }
}

/* =========================================================
   MitraKSB Billing V4 — Final Polish
   ========================================================= */

/* Semua bagian benar-benar satu garis/lebar */
.billing-v4-wrap {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
}

.billing-v4-wrap #manual-billing-anchor {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.billing-v4-wrap #manual-billing-anchor .billing-v4-panel {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box;
}


/* Header sedikit lebih compact */
.billing-v4-toolbar {
  align-items: center;
  margin-bottom: 18px;
}

.billing-v4-toolbar .page-title {
  font-size: 22px;
  letter-spacing: -.025em;
}

.billing-v4-actions {
  align-items: center;
}


/* Stats lebih refined */
.billing-v4-stats {
  gap: 12px;
  margin-bottom: 16px;
}

.billing-v4-stat {
  min-height: 92px;
  padding: 15px 17px;
}

.billing-v4-stat strong {
  font-size: 19px;
}


/* Panel */
.billing-v4-panel {
  padding: 17px 18px;
  border-radius: 14px;
}

.billing-v4-panel-head {
  margin-bottom: 12px;
}

.billing-v4-panel-head h3 {
  font-size: 13px;
}


/* Tabel utama lebih padat dan presisi */
.billing-v4-table th {
  padding-top: 9px;
  padding-bottom: 9px;
}

.billing-v4-table td {
  padding-top: 11px;
  padding-bottom: 11px;
}

.billing-v4-name {
  font-size: 11px;
}

.billing-v4-meta {
  font-size: 9px;
}


/* Paket badge */
.billing-v4-plan {
  min-width: 54px;
  justify-content: center;
  box-sizing: border-box;
}


/* Kolom aksi lebih rapi */
.billing-v4-action-col {
  width: 270px;
}

.billing-v4-row-actions {
  width: 270px;
  text-align: right !important;
}

.billing-v4-row-actions .btn {
  min-height: 30px;
  margin-left: 4px;
  padding: 5px 9px;
  font-size: 9.5px;
}

.billing-v4-row-actions .btn-primary {
  min-width: 86px;
}

/* Suspend jangan terlalu dominan */
.billing-v4-row-actions .btn:last-child {
  color: #fda4af;
}


/* Riwayat sejajar & lebih ringan */
.billing-v4-history {
  margin-top: 0 !important;
}

.billing-v4-history .billing-v4-table {
  min-width: 900px;
}

.billing-v4-history .billing-v4-table td {
  color: #9caabd;
}


/* Badge jumlah */
.billing-v4-count {
  min-width: 58px;
  text-align: center;
}


/* Hover lebih subtle */
.billing-v4-table tbody tr {
  transition: background .14s ease;
}

.billing-v4-table tbody tr:hover {
  background: rgba(59,130,246,.028);
}


/* Responsive */
@media (max-width: 900px) {
  .billing-v4-action-col,
  .billing-v4-row-actions {
    width: auto;
  }
}

/* =========================================================
   MitraKSB Mobile Overflow Fix — HP melebar fix
   ========================================================= */
.page-header { flex-wrap: wrap; }
.logo-grid,
.style-grid,
.billing-stat-grid,
.billing-sub-grid,
.ai-compose-grid,
.ai-mode-options { min-width: 0; }
@media (max-width: 900px) {
  .logo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .style-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .billing-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .billing-sub-grid { grid-template-columns: 1fr; }
  .ai-compose-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-mode-options { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio-layout { grid-template-columns: 1fr; height: auto; }
  .studio-panel, .studio-panel-right { height: auto; max-height: 40vh; }
}
@media (max-width: 640px) {
  .page-header { flex-direction: column; align-items: stretch; }
  .logo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .style-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .billing-stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ai-compose-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  img, video, canvas { max-width: 100%; height: auto; }
}

/* =========================================================
   MitraKSB Workflow Header Responsive Fix — 2026-09-16
   ========================================================= */

@media (max-width: 1280px) {
  .workflow-header {
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 12px 16px;
  }

  .workflow-title {
    flex: 0 0 auto;
    line-height: 1.15;
  }

  .step-indicators {
    order: 10;
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .step-indicator {
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  .workflow-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .workflow-title {
    font-size: 14px;
    max-width: 125px;
  }

  .step-indicators {
    gap: 3px;
  }

  .step-indicator {
    padding: 6px 8px;
    gap: 6px;
    font-size: 10px;
  }

  .step-num {
    width: 18px;
    height: 18px;
    font-size: 9px;
  }
}

/* =========================================================
   MitraKSB Workflow Header Responsive
   2026-09-16
   ========================================================= */

/* Laptop / layar menengah:
   Judul + Batal di atas, Step 1–6 di bawah */
@media (max-width: 1400px) {
  .workflow-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 10px;
    padding: 12px 18px;
  }

  .workflow-title {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .workflow-header > .btn {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    white-space: nowrap;
  }

  .step-indicators {
    grid-column: 1 / -1;
    grid-row: 2;

    width: 100%;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;

    overflow-x: auto;
    overflow-y: hidden;

    gap: 5px;
    padding: 2px 0 6px;

    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .step-indicator {
    flex: 0 0 auto;
  }
}


/* Tablet */
@media (max-width: 900px) {
  .workflow-header {
    padding: 10px 14px;
    row-gap: 8px;
  }

  .workflow-title {
    font-size: 15px;
  }

  .step-indicator {
    padding: 6px 9px;
    gap: 6px;
    font-size: 10.5px;
  }

  .step-num {
    width: 19px;
    height: 19px;
    font-size: 9px;
  }
}


/* HP */
@media (max-width: 640px) {
  .workflow-header {
    padding: 9px 10px;
    column-gap: 8px;
  }

  .workflow-title {
    font-size: 13.5px;
    line-height: 1.25;
  }

  .workflow-header > .btn {
    padding-left: 9px;
    padding-right: 9px;
    font-size: 10.5px;
  }

  .step-indicators {
    gap: 3px;
    padding-bottom: 5px;
  }

  .step-indicator {
    padding: 5px 7px;
    gap: 5px;
    font-size: 10px;
  }

  .step-num {
    width: 18px;
    height: 18px;
    font-size: 9px;
  }
}
