/* ── Design tokens ────────────────────────────────────────────── */
:root {
  --bg:          #0D0D0D;
  --bg2:         #141414;
  --bg3:         #1A1A1A;
  --bg4:         #222222;
  --border:      rgba(255,255,255,0.08);
  --border2:     rgba(255,255,255,0.14);
  --text:        #F0EDE6;
  --muted:       #888880;
  --accent:      #C8B97A;
  --accent2:     #E8D9A0;
  --accent-dim:  rgba(200,185,122,0.12);
  --accent-dim2: rgba(200,185,122,0.20);
  --danger:      #E07070;
  --success:     #7EC8A0;
  --radius:      12px;
  --radius-sm:   8px;
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ───────────────────────────────────────────────── */
h1, h2, h3 { font-family: 'DM Serif Display', serif; font-weight: 400; }

/* ── Layout ───────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Top nav ──────────────────────────────────────────────────── */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #0D0D0D; font-weight: 600; font-size: 14px;
}
.logo-text { font-family: 'DM Serif Display', serif; font-size: 18px; color: var(--text); }
.logo-text span { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-badge {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px; font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--accent-dim2);
}

/* ── Main layout ──────────────────────────────────────────────── */
.main-layout { display: flex; flex: 1; }

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-height: calc(100vh - 60px);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg);
  position: sticky; top: 60px;
  align-self: flex-start;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}
.sidebar-section {
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.1em; color: var(--muted);
  text-transform: uppercase;
  padding: 0.75rem 0.5rem 0.25rem;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--muted);
  cursor: pointer; transition: all 0.15s;
  border: 1px solid transparent;
  user-select: none;
}
.sidebar-item:hover { background: var(--bg3); color: var(--text); }
.sidebar-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-dim2);
}
.sidebar-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-count {
  margin-left: auto;
  background: var(--bg4);
  font-size: 11px; padding: 1px 7px;
  border-radius: 20px; color: var(--muted);
}

/* ── Content ──────────────────────────────────────────────────── */
.content { flex: 1; padding: 2rem; overflow-y: auto; min-width: 0; }

/* ── Screens ──────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; }

/* ── Page header ──────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; margin-bottom: 4px; }
.page-header p { font-size: 14px; color: var(--muted); }
.page-header-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-bottom: 1.5rem;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  cursor: pointer; border: none;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}
.btn-primary  { background: var(--accent); color: #0D0D0D; }
.btn-primary:hover { background: var(--accent2); }
.btn-outline  { background: transparent; color: var(--text); border: 1px solid var(--border2); }
.btn-outline:hover  { background: var(--bg3); }
.btn-ghost    { background: transparent; color: var(--muted); border: 1px solid transparent; }
.btn-ghost:hover    { color: var(--text); background: var(--bg3); }
.btn-danger   { background: rgba(224,112,112,0.12); color: var(--danger); border: 1px solid rgba(224,112,112,0.2); }
.btn-sm  { padding: 6px 14px; font-size: 13px; }
.btn-lg  { padding: 13px 28px; font-size: 15px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ── Stats row ────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.stat-value { font-family: 'DM Serif Display', serif; font-size: 1.8rem; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Form section title ───────────────────────────────────────── */
.form-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dynamic-title { color: var(--text); opacity: 0.7; }

/* ── Generator layout ─────────────────────────────────────────── */
.gen-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) { .gen-layout { grid-template-columns: 1fr; } }

/* ── Form panel ───────────────────────────────────────────────── */
.form-panel {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.form-panel h2 { font-size: 1.1rem; margin-bottom: 1.25rem; }

.form-row { margin-bottom: 1rem; }
.form-row label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border 0.15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus { border-color: var(--accent); }
.form-row textarea { resize: vertical; min-height: 80px; }
.form-row select option { background: var(--bg3); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Contract type grid ───────────────────────────────────────── */
.contract-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 1.25rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}
.type-section-label {
  grid-column: 1 / -1;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.1em; color: var(--muted);
  text-transform: uppercase;
  padding: 10px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.type-section-label:first-child { border-top: none; margin-top: 0; padding-top: 4px; }
.type-section-label.accent { color: var(--accent); }

.contract-type-btn {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 8px;
  text-align: center; cursor: pointer;
  transition: all 0.15s; font-size: 12.5px; color: var(--muted);
  user-select: none;
}
.contract-type-btn:hover { border-color: var(--accent-dim2); color: var(--text); }
.contract-type-btn.selected {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.ct-icon { font-size: 20px; display: block; margin-bottom: 4px; }

/* ── Preview panel ────────────────────────────────────────────── */
.preview-panel {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  display: flex; flex-direction: column;
  position: sticky; top: 80px;
}
.preview-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.preview-header h2 { font-size: 1.1rem; }
.preview-actions { display: flex; gap: 8px; }
.preview-body {
  flex: 1;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1.5rem;
  min-height: 420px; max-height: 680px;
  font-size: 13px; line-height: 1.9; color: var(--muted);
  overflow-y: auto;
  font-family: 'DM Serif Display', serif;
}
.preview-body.has-content { color: var(--text); }
.preview-body p { margin-bottom: 12px; text-align: justify; }
.preview-placeholder {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; text-align: center; gap: 12px;
  color: var(--muted); font-family: 'DM Sans', sans-serif;
  min-height: 380px;
}
.preview-placeholder svg { width: 40px; height: 40px; opacity: 0.3; }

/* ── Generating state ─────────────────────────────────────────── */
.generating {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; padding: 3rem; min-height: 380px;
}
.spinner {
  width: 36px; height: 36px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 14px; color: var(--muted); }
.typing-dots::after {
  content: '';
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0%, 20%  { content: ''; }
  40%      { content: '.'; }
  60%      { content: '..'; }
  80%, 100%{ content: '...'; }
}

/* ── History ──────────────────────────────────────────────────── */
.search-bar {
  position: relative; margin-bottom: 1.25rem;
}
.search-bar input {
  width: 100%; background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 9px 12px 9px 38px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; outline: none;
  transition: border 0.15s;
}
.search-bar input:focus { border-color: var(--accent); }
.search-bar svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted); pointer-events: none;
}

.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 12px;
  transition: border-color 0.15s;
}
.history-item:hover { border-color: var(--border2); }
.history-icon {
  width: 38px; height: 38px;
  background: var(--accent-dim);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.history-info { flex: 1; min-width: 0; }
.history-title { font-size: 14px; font-weight: 500; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: 12px; color: var(--muted); }
.history-actions { display: flex; gap: 8px; align-items: center; }
.status-badge { font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 20px; }
.status-ok { background: rgba(126,200,160,0.12); color: var(--success); }
.status-pending { background: rgba(200,185,122,0.12); color: var(--accent); }

/* ── Pricing ──────────────────────────────────────────────────── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px; margin: 2rem 0;
}
.price-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  position: relative;
}
.price-card.featured { border-color: var(--accent); }
.price-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #0D0D0D;
  font-size: 11px; font-weight: 600;
  padding: 3px 14px; border-radius: 20px; white-space: nowrap;
}
.price-name { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.price-value { font-family: 'DM Serif Display', serif; font-size: 2.5rem; margin-bottom: 4px; }
.price-value span { font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--muted); }
.price-desc { font-size: 12.5px; color: var(--muted); margin-bottom: 1.25rem; }
.price-features { list-style: none; margin-bottom: 1.5rem; }
.price-features li { font-size: 13px; color: var(--muted); padding: 5px 0; display: flex; align-items: center; gap: 8px; }
.price-features li::before { content: '✓'; color: var(--success); font-weight: 600; font-size: 12px; }
.price-features li.no::before { content: '✕'; color: var(--muted); }

/* ── Screen transitions ───────────────────────────────────────── */
.screen.active { display: block; animation: screenIn 0.22s ease; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Hamburger button (mobile) ───────────────────────────────── */
.hamburger {
  display: none; flex-direction: column; justify-content: center;
  gap: 5px; width: 36px; height: 36px; padding: 6px;
  background: transparent; border: none; cursor: pointer;
  border-radius: var(--radius-sm);
}
.hamburger:hover { background: var(--bg3); }
.hamburger span {
  display: block; width: 18px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: all 0.2s;
}

/* ── Sidebar overlay (mobile) ────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 149;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── Landing page ─────────────────────────────────────────────── */
#screen-auth {
  padding: 0 !important;
  display: none;
  min-height: calc(100vh - 60px);
}
#screen-auth.active { display: flex; flex-direction: column; animation: none; }

.landing {
  display: grid;
  grid-template-columns: 1fr 440px;
  min-height: calc(100vh - 60px);
  align-items: start;
}

/* Left hero */
.landing-hero {
  padding: 3rem 3.5rem 3rem 3rem;
  display: flex; flex-direction: column; gap: 2rem;
  position: sticky; top: 60px; max-height: calc(100vh - 60px);
  overflow-y: auto;
}

.landing-logo {
  display: flex; align-items: center; gap: 10px;
}
.landing-logo-text {
  font-family: 'DM Serif Display', serif;
  font-size: 20px; color: var(--text);
}
.landing-logo-text span { color: var(--accent); }

.landing-headline {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.2; color: var(--text);
  font-family: 'DM Serif Display', serif; font-weight: 400;
}
.landing-headline em {
  font-style: normal; color: var(--accent);
}

.landing-sub {
  font-size: 15px; color: var(--muted);
  line-height: 1.7; max-width: 520px;
}

/* Stats row */
.landing-stats {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); width: fit-content;
}
.landing-stat { text-align: center; }
.landing-stat-n {
  display: block; font-family: 'DM Serif Display', serif;
  font-size: 1.5rem; color: var(--accent); line-height: 1;
}
.landing-stat-l { font-size: 11px; color: var(--muted); }
.landing-stat-div { width: 1px; height: 32px; background: var(--border2); }

/* Feature cards */
.landing-features {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.landing-feat {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  transition: border-color .15s;
}
.landing-feat:hover { border-color: var(--border2); }
.landing-feat-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }
.landing-feat strong { font-size: 13px; display: block; margin-bottom: 3px; }
.landing-feat p { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0; }

/* Type preview pills */
.landing-types-wrap { }
.landing-types-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.landing-types {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.landing-types span {
  font-size: 11.5px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 3px 10px; color: var(--muted);
}

/* How it works steps */
.landing-steps {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.landing-step {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px;
  flex: 1; min-width: 130px;
}
.landing-step-n {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #0D0D0D;
  font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.landing-step strong { font-size: 12.5px; display: block; margin-bottom: 1px; }
.landing-step p { font-size: 11px; color: var(--muted); margin: 0; }
.landing-step-arrow { font-size: 18px; color: var(--muted); flex-shrink: 0; }

/* Footer links */
.landing-footer {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted); padding-top: .5rem;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.landing-footer-dot { opacity: .4; }
.landing-footer-link { color: var(--muted); text-decoration: none; }
.landing-footer-link:hover { color: var(--accent); }

/* Right auth panel */
.landing-auth {
  min-height: calc(100vh - 60px);
  border-left: 1px solid var(--border);
  background: var(--bg2);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 3rem 2.5rem;
  position: sticky; top: 60px;
}
.landing-auth-inner { width: 100%; max-width: 380px; }

.auth-card-title { margin-bottom: 1.5rem; }
.auth-card-title h2 { font-size: 1.4rem; margin-bottom: 4px; }
.auth-card-title p  { font-size: 13px; color: var(--muted); }

/* Auth card itself */
.auth-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.auth-tab {
  display: flex; background: var(--bg4);
  border-radius: var(--radius-sm); padding: 3px;
  margin-bottom: 1.5rem;
}
.auth-tab-btn {
  flex: 1; padding: 7px; text-align: center;
  font-size: 13.5px; cursor: pointer;
  border-radius: 6px; transition: all 0.15s; color: var(--muted);
}
.auth-tab-btn.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* Google button */
.btn-google {
  width: 100%; justify-content: center;
  background: var(--bg); border: 1px solid var(--border2);
  color: var(--text); margin-bottom: 4px;
  transition: background .15s;
}
.btn-google:hover { background: var(--bg3); }

/* Auth divider */
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 12px; margin: 1rem 0;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Full-width auth button */
.btn-auth { width: 100%; justify-content: center; margin-top: .5rem; }

/* Password toggle wrapper */
.pass-wrap {
  position: relative;
}
.pass-wrap input { padding-right: 40px; }
.pass-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px; line-height: 0;
  transition: color .15s;
}
.pass-toggle:hover { color: var(--text); }
.pass-toggle.visible { color: var(--accent); }

/* Auth footer text */
.auth-footer { text-align: center; margin-top: 1rem; font-size: 12px; color: var(--muted); }

/* Trial notice */
.auth-trial-note {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: rgba(126,200,160,.07);
  border: 1px solid rgba(126,200,160,.2);
  border-radius: var(--radius-sm);
}
.auth-trial-note svg { color: var(--success); flex-shrink: 0; }

/* ── Dashboard improvements ───────────────────────────────────── */
.dash-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 1.5rem;
}
.dash-greeting { font-size: 1.5rem; margin: 0; }

/* Usage progress bar */
.stat-progress-track {
  height: 5px; background: var(--bg4); border-radius: 3px;
  margin-top: 8px; overflow: hidden;
}
.stat-progress-bar {
  height: 100%; background: var(--accent);
  border-radius: 3px; transition: width .6s ease;
}
.stat-progress-bar.warn { background: var(--danger); }

/* Quick actions */
.dash-quick-actions {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-bottom: 1.75rem;
}
.dash-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem .75rem;
  cursor: pointer; transition: all .15s; color: var(--muted);
  font-size: 12px; font-weight: 500; text-align: center;
}
.dash-action-btn:hover {
  border-color: var(--accent-dim2); color: var(--text);
  background: var(--accent-dim); transform: translateY(-1px);
}
.dash-action-icon { font-size: 1.5rem; }

@media (max-width: 600px) {
  .dash-quick-actions { grid-template-columns: repeat(2, 1fr); }
}

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 2rem;
  max-width: 480px; width: 100%;
  transform: translateY(16px); transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal h2 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.modal p { font-size: 13.5px; color: var(--muted); margin-bottom: 1.5rem; }
.modal-price { font-family: 'DM Serif Display', serif; font-size: 2rem; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Toast ────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg4); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 12px 18px;
  font-size: 13.5px; z-index: 2000;
  transform: translateY(60px); opacity: 0;
  transition: all 0.3s; max-width: 320px;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: rgba(126,200,160,0.4); }
.toast.error   { border-color: rgba(224,112,112,0.4); }

/* ── Upgrade CTA ──────────────────────────────────────────────── */
.upgrade-cta {
  background: var(--accent-dim);
  border: 1px solid var(--accent-dim2);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.5rem;
  text-align: center; color: var(--muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.empty-state p { margin-bottom: 16px; }

/* ── Divider ──────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }

/* ── Link ─────────────────────────────────────────────────────── */
a.link { color: var(--accent); text-decoration: none; }
a.link:hover { text-decoration: underline; }

/* ── Responsive (legacy small breakpoint — sidebar now handled by 768px drawer) ── */
@media (max-width: 700px) {
  .content     { padding: 1rem; }
  .topnav      { padding: 0 1rem; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .gen-layout  { grid-template-columns: 1fr; }
}

/* ── Print / PDF ──────────────────────────────────────────────── */
@media print {
  .topnav, .sidebar, .form-panel, .preview-header,
  .btn, .toast, .modal-overlay { display: none !important; }
  .preview-body {
    border: none; padding: 0;
    color: #111; background: white;
    font-family: Georgia, serif;
    font-size: 13px; line-height: 1.9;
    max-height: none;
  }
}

/* ══════════════════════════════════════════════════════════════
   Auth extras — Google button, divider
   ══════════════════════════════════════════════════════════════ */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: var(--bg3);
  color: var(--text);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: background 0.15s, border-color 0.15s;
}
.btn-google:hover { background: var(--bg4); border-color: var(--border2); }

.auth-divider {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 0.75rem 0;
  color: var(--muted); font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ══════════════════════════════════════════════════════════════
   Chat FAB + Panel
   ══════════════════════════════════════════════════════════════ */
.chat-fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 200;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #000;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(200,185,122,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(200,185,122,0.5); }
.chat-fab .chat-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.chat-panel {
  position: fixed; bottom: 5rem; right: 1.5rem; z-index: 199;
  width: 340px; max-height: 520px;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
  transform: translateY(20px) scale(0.95);
  opacity: 0; pointer-events: none;
  transition: transform 0.2s, opacity 0.2s;
}
.chat-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: all; }

.chat-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.chat-body {
  flex: 1; overflow-y: auto; padding: 0.75rem 1rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.chat-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex; gap: 0.5rem; align-items: flex-end;
  flex-shrink: 0;
}
.chat-input {
  flex: 1; resize: none;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 13px; padding: 0.5rem 0.75rem;
  line-height: 1.4;
}
.chat-input:focus { outline: none; border-color: var(--accent); }
.chat-send { flex-shrink: 0; align-self: flex-end; }
.chat-empty {
  color: var(--muted); font-size: 13px; text-align: center;
  margin: auto; padding: 1.5rem 0; line-height: 1.6;
}

/* Chat messages */
.chat-msg { display: flex; flex-direction: column; max-width: 80%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.theirs { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: 0.5rem 0.75rem; border-radius: 12px;
  font-size: 13px; line-height: 1.5; word-break: break-word;
}
.chat-msg.mine .chat-bubble   { background: var(--accent); color: #000; border-bottom-right-radius: 4px; }
.chat-msg.theirs .chat-bubble { background: var(--bg3); color: var(--text); border-bottom-left-radius: 4px; }
.chat-meta { font-size: 10px; color: var(--muted); margin-top: 3px; }

/* Chat inbox (admin) */
.chat-inbox-header { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0 0 0.5rem; }
.chat-thread-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.5rem; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.12s;
}
.chat-thread-item:hover { background: var(--bg3); }
.chat-thread-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-dim2); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.chat-thread-info { flex: 1; min-width: 0; }
.chat-thread-name { font-size: 13px; font-weight: 500; }
.chat-thread-preview { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-unread-dot {
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--accent); color: #000;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.chat-back-btn {
  background: none; border: none; color: var(--accent); font-size: 12px;
  cursor: pointer; padding: 0 0 0.5rem; align-self: flex-start;
}
.chat-back-btn:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════
   Admin panel
   ══════════════════════════════════════════════════════════════ */
.admin-tabs {
  display: flex; gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.admin-tab-btn {
  padding: 0.6rem 1.25rem;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.admin-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-tab-btn:hover:not(.active) { color: var(--text); }

.admin-stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
  margin-bottom: 1.25rem;
}
.admin-stat {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  font-size: 12px; color: var(--muted);
}
.admin-stat span { display: block; font-size: 1.75rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }

.admin-search-wrap { margin-bottom: 1rem; }
.admin-search-wrap input {
  width: 100%; padding: 0.6rem 0.9rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13px;
}
.admin-search-wrap input:focus { outline: none; border-color: var(--accent); }

.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.admin-table th {
  text-align: left; padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border2);
  color: var(--muted); font-weight: 500; white-space: nowrap;
}
.admin-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg3); }

.admin-plan-select {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 12px;
  padding: 0.25rem 0.4rem; cursor: pointer;
}
.admin-plan-select:focus { outline: none; border-color: var(--accent); }

.admin-badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 100px; font-size: 11px; font-weight: 500;
}
/* ══════════════════════════════════════════════════════════════
   Contract type search bar + category filter pills
   ══════════════════════════════════════════════════════════════ */
.type-search-wrap {
  margin-bottom: 12px;
}

.type-search-bar {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
  min-height: 40px;
}
.type-search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,185,122,0.10), 0 2px 16px rgba(200,185,122,0.07);
}

.type-search-icon {
  position: absolute;
  left: 13px;
  width: 15px; height: 15px;
  color: var(--muted);
  pointer-events: none;
  transition: color 0.2s;
  flex-shrink: 0;
}
.type-search-bar:focus-within .type-search-icon { color: var(--accent); }

.type-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 10px 10px 38px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  width: 100%;
  min-width: 0;
}
.type-search-bar input::placeholder { color: var(--muted); font-size: 13px; }

.type-search-count {
  font-size: 11px;
  color: var(--muted);
  padding: 0 12px;
  white-space: nowrap;
  font-weight: 500;
  border-left: 1px solid var(--border);
  display: flex;
  align-items: center;
  align-self: stretch;
  background: var(--bg2);
  letter-spacing: 0.02em;
}

/* ── Category filter pills ─────────────────────────────────── */
.cat-filter-pills {
  display: flex;
  gap: 6px;
  padding: 10px 0 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-wrap: nowrap;
}
.cat-filter-pills::-webkit-scrollbar { display: none; }

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
  line-height: 1;
}
.cat-pill:hover {
  border-color: rgba(200,185,122,0.35);
  color: var(--text);
  background: var(--bg4);
  transform: translateY(-1px);
}
.cat-pill.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 1px rgba(200,185,122,0.15);
}
.cat-pill.active:hover { transform: none; }

.cat-pill-count {
  background: rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  line-height: 1.6;
}
.cat-pill.active .cat-pill-count {
  background: rgba(200,185,122,0.22);
  color: var(--accent);
}

.provider-local  { background: rgba(126,200,160,0.15); color: var(--success); }
.provider-google { background: rgba(66,133,244,0.15);  color: #6aabff; }
.provider-both   { background: rgba(200,185,122,0.15); color: var(--accent); }
.provider-demo   { background: var(--bg4); color: var(--muted); }

/* ══════════════════════════════════════════════════════════════
   Profile screen
   ══════════════════════════════════════════════════════════════ */

/* Hero banner */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}
.profile-avatar-wrap { flex-shrink: 0; }
.profile-avatar-ring {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 2px solid var(--accent-dim2);
  overflow: hidden;
  position: relative;
  background: var(--bg4);
}
.profile-avatar-initials {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  font-family: 'DM Serif Display', serif;
}
.profile-avatar-photo {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.profile-hero-info { flex: 1; min-width: 0; }
.profile-hero-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-hero-email {
  font-size: 13px; color: var(--muted);
  margin-bottom: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-hero-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.profile-provider-badge {
  font-size: 11px; font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--muted);
}

/* Grid layout */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-hero { flex-direction: column; text-align: center; }
}

/* Card */
.profile-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.profile-card-info {
  /* Info card spans 1 column */
}
.profile-card-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14px;
  margin-bottom: 0.25rem;
  color: var(--text);
}
.profile-card-title svg { color: var(--accent); flex-shrink: 0; }

/* Info rows */
.profile-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.profile-info-row:last-of-type { border-bottom: none; }
.profile-info-label { color: var(--muted); }
.profile-info-value { font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════════════════════
   STORAGE SCREEN
═══════════════════════════════════════════════════════════════════════════════ */

/* Expiry warning banner */
.expiry-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 180, 0, 0.12);
  border: 1px solid rgba(255, 180, 0, 0.35);
  color: #e6a817;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  transition: opacity .3s;
}
.expiry-banner:hover { opacity: .85; }

/* Section title */
.storage-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 1rem;
}
.storage-section-title svg { color: var(--accent); flex-shrink: 0; }

/* Providers grid */
.storage-providers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

/* Cloud provider card */
.cloud-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.cloud-card--connected {
  border-color: rgba(80, 220, 140, 0.45);
  box-shadow: 0 0 0 1px rgba(80, 220, 140, 0.15) inset;
}
.cloud-card-icon { font-size: 1.75rem; flex-shrink: 0; }
.cloud-card-body { flex: 1; min-width: 0; }
.cloud-card-name { font-weight: 600; font-size: 14px; }
.cloud-card-account {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cloud-card--connected .cloud-card-account { color: #50dc8c; }
.cloud-card-actions { flex-shrink: 0; }

/* Contract list items */
.storage-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.625rem;
  transition: border-color .2s;
}
.storage-item:hover { border-color: var(--border2); }
.storage-item--expired { opacity: .55; }
.storage-item-icon { font-size: 1.5rem; flex-shrink: 0; padding-top: 2px; }
.storage-item-body { flex: 1; min-width: 0; }
.storage-item-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.storage-item-meta  { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.storage-item-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.storage-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

/* Expiry badges */
.expiry-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.expiry-badge--ok      { background: rgba(80, 220, 140, 0.15); color: #50dc8c; border: 1px solid rgba(80,220,140,.3); }
.expiry-badge--urgent  { background: rgba(255, 180, 0, 0.15);  color: #e6a817; border: 1px solid rgba(255,180,0,.3); }
.expiry-badge--expired { background: rgba(255, 80, 80, 0.15);  color: #ff5050; border: 1px solid rgba(255,80,80,.3); }

/* Cloud backup badges */
.cloud-backup-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
}

/* Upload button in storage list */
.cloud-upload-btn { min-width: 120px; text-align: center; }

@media (max-width: 600px) {
  .storage-providers-grid { grid-template-columns: 1fr; }
  .storage-item { flex-wrap: wrap; }
  .storage-item-actions { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SUPER ADMIN PANEL
═══════════════════════════════════════════════════════════════════════════════ */

/* Header */
.sa-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; gap: 1rem; }
.sa-title  { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 10px; margin: 0; }
.sa-crown  { font-size: 1.4rem; }
.sa-subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Tabs */
.sa-tabs {
  display: flex; gap: 4px; margin-bottom: 1.5rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px; overflow-x: auto;
}
.sa-tab-btn {
  flex-shrink: 0; padding: 8px 16px; border-radius: calc(var(--radius) - 2px);
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s; white-space: nowrap;
}
.sa-tab-btn:hover  { background: var(--bg3); color: var(--text); }
.sa-tab-btn.active { background: var(--accent); color: #000; font-weight: 600; }

.sa-body { min-height: 300px; }
.sa-loading { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; padding: 2rem 0; }

/* KPI cards */
.sa-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.sa-kpi-grid--sm { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.sa-kpi {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1rem;
  position: relative; overflow: hidden;
}
.sa-kpi::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; border-radius: 3px 0 0 3px;
}
.sa-kpi--blue::before   { background: #60a5fa; }
.sa-kpi--green::before  { background: #34d399; }
.sa-kpi--purple::before { background: #a78bfa; }
.sa-kpi--gold::before   { background: #f59e0b; }
.sa-kpi--teal::before   { background: #2dd4bf; }
.sa-kpi--orange::before { background: #fb923c; }
.sa-kpi--red::before    { background: #f87171; }
.sa-kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.sa-kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.sa-kpi-sub   { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Charts */
.sa-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.sa-chart-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  flex: 1;
}
.sa-chart-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .75rem; }

/* Filters */
.sa-filter-row { display: flex; gap: 8px; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.sa-search-input, .sa-filter-input {
  flex: 1; min-width: 180px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); padding: 8px 12px; font-size: 13px;
}
.sa-filter-select {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); padding: 8px 10px; font-size: 13px;
}

/* Table */
.sa-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.sa-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sa-table thead { background: var(--bg3); }
.sa-table th { padding: 10px 12px; text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sa-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sa-table tbody tr:last-child td { border-bottom: none; }
.sa-table tbody tr:hover { background: var(--bg3); }
.sa-row--banned { opacity: .5; }
.sa-num { text-align: right; font-variant-numeric: tabular-nums; }

/* User cell */
.sa-user-cell  { display: flex; align-items: center; gap: 10px; }
.sa-user-name  { font-weight: 500; font-size: 13px; }
.sa-user-email { font-size: 11px; color: var(--muted); }

/* Provider badges */
.sa-provider-badge { font-size: 10px; padding: 1px 6px; border-radius: 20px; }
.sa-provider-badge--google { background: rgba(66,133,244,.2); color: #60a5fa; }
.sa-provider-badge--local  { background: rgba(167,139,250,.2); color: #a78bfa; }
.sa-provider-badge--both   { background: rgba(52,211,153,.2); color: #34d399; }
.sa-provider-badge--demo   { background: rgba(251,191,36,.2); color: #fbbf24; }

/* Generic badges */
.sa-badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.sa-badge--green  { background: rgba(52,211,153,.2);  color: #34d399; border: 1px solid rgba(52,211,153,.3); }
.sa-badge--blue   { background: rgba(96,165,250,.2);  color: #60a5fa; border: 1px solid rgba(96,165,250,.3); }
.sa-badge--red    { background: rgba(248,113,113,.2); color: #f87171; border: 1px solid rgba(248,113,113,.3); }
.sa-badge--purple { background: rgba(167,139,250,.2); color: #a78bfa; border: 1px solid rgba(167,139,250,.3); }
.sa-badge--gold   { background: rgba(245,158,11,.2);  color: #f59e0b; border: 1px solid rgba(245,158,11,.3); }

/* Inline select */
.sa-inline-select {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 6px; color: var(--text); padding: 4px 8px; font-size: 12px; cursor: pointer;
}

/* Action buttons */
.sa-action-btns { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; }
.sa-btn--danger { color: #f87171 !important; }
.sa-btn--danger:hover { background: rgba(248,113,113,.1) !important; }

/* Plans grid */
.sa-plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.sa-plan-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0 1.25rem 1.25rem;
  position: relative; overflow: hidden;
  transition: border-color .2s;
}
.sa-plan-card:hover { border-color: var(--plan-color, var(--border2)); }
.sa-plan-card--inactive { opacity: .55; }
.sa-plan-color-bar { height: 3px; background: var(--plan-color, #888); margin: 0 -1.25rem 1.25rem; }
.sa-plan-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .75rem; }
.sa-plan-name  { font-weight: 700; font-size: 16px; }
.sa-plan-id    { font-size: 11px; color: var(--muted); font-family: monospace; }
.sa-plan-price { font-size: 1.3rem; font-weight: 700; }
.sa-plan-features { display: flex; flex-direction: column; gap: 4px; margin-bottom: .75rem; }
.sa-plan-feat { font-size: 12px; color: var(--muted); }
.sa-plan-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: .75rem; }
.sa-plan-meta span { font-size: 11px; color: var(--muted); background: var(--bg3); padding: 2px 8px; border-radius: 20px; }
.sa-plan-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.sa-stripe-badge { font-size: 11px; color: var(--muted); margin-bottom: .5rem; padding: 3px 8px; background: var(--bg3); border-radius: 6px; }
.sa-stripe-badge--warn { color: #f59e0b; }

/* Reports */
.sa-reports-tabs { display: flex; gap: 4px; margin-bottom: 1.25rem; }
.sa-report-tab-btn {
  padding: 8px 18px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg2); color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all .15s;
}
.sa-report-tab-btn:hover { background: var(--bg3); color: var(--text); }
.sa-report-tab-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* Settings */
.sa-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.sa-settings-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.sa-settings-card-title { font-weight: 600; font-size: 14px; margin-bottom: 1rem; }
.sa-stripe-status { font-size: 13px; }
.sa-form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Mini modal overlay */
.sa-mini-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; backdrop-filter: blur(4px);
}
.sa-mini-modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 1.75rem;
  width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.sa-mini-modal--wide { max-width: 600px; }
.sa-mini-modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 1rem; }
.sa-modal-form { display: flex; flex-direction: column; gap: .75rem; }

/* Sidebar Super Admin item glow */
.sidebar-item--superadmin { color: #f59e0b !important; }
.sidebar-item--superadmin.active, .sidebar-item--superadmin:hover { background: rgba(245,158,11,.1) !important; }
.sidebar-item--superadmin svg { stroke: #f59e0b !important; }

/* Responsive */
@media (max-width: 900px) {
  .sa-charts-row   { grid-template-columns: 1fr; }
  .sa-settings-grid { grid-template-columns: 1fr; }
  .sa-plans-grid   { grid-template-columns: 1fr; }
  .sa-form-2col    { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .sa-kpi-grid { grid-template-columns: 1fr 1fr; }
  .sa-tabs { gap: 2px; padding: 2px; }
  .sa-tab-btn { padding: 7px 10px; font-size: 11px; }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE / RESPONSIVE — global breakpoints
   ══════════════════════════════════════════════════════════════ */

/* ── Tablet (≤ 768px): slide-in sidebar ──────────────────────── */
@media (max-width: 768px) {
  /* Show hamburger */
  .hamburger { display: flex; }

  /* Sidebar becomes a fixed drawer */
  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform .25s ease;
    border-right: 1px solid var(--border2);
    box-shadow: 4px 0 24px rgba(0,0,0,.4);
    width: 260px;
    min-height: unset;
    max-height: unset;
  }
  .sidebar.sidebar--open { transform: translateX(0); }

  /* Content fills full width */
  .content { width: 100%; min-width: 0; padding: 1.25rem; }

  /* Topnav adjustments */
  .nav-right .nav-badge { display: none; }
  #upgrade-btn { padding: 6px 10px; min-width: 0; font-size: 12px; }

  /* Landing: stack panels */
  .landing {
    grid-template-columns: 1fr;
    min-height: unset;
  }
  .landing-hero {
    position: static; max-height: unset;
    padding: 2rem 1.5rem 1.5rem;
  }
  .landing-auth {
    position: static;
    min-height: unset;
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 1.5rem 1.25rem 2rem;
  }

  /* Dash quick actions: 2 columns */
  .dash-quick-actions { grid-template-columns: 1fr 1fr; }

  /* Generator: stack form over preview */
  .gen-layout { grid-template-columns: 1fr; }

  /* Profile grid */
  .profile-grid { grid-template-columns: 1fr; }

  /* Admin / Superadmin tables scroll horizontally */
  .admin-table-wrap, .sa-table-wrap { overflow-x: auto; }
}

/* ── Phone (≤ 480px): tighter spacing ───────────────────────── */
@media (max-width: 480px) {
  .topnav { padding: 0 .75rem; gap: .5rem; }
  .logo-text { font-size: 15px; }

  .content { padding: .875rem; }

  .landing-headline { font-size: clamp(1.4rem, 7vw, 1.9rem); }
  .landing-stats { flex-wrap: wrap; gap: .75rem; }
  .landing-features { grid-template-columns: 1fr; }
  .landing-steps { flex-direction: column; align-items: stretch; }
  .landing-step-arrow { display: none; }

  .dash-quick-actions { grid-template-columns: 1fr 1fr; }
  .dash-greeting { font-size: 1.2rem; }

  .stats-row { grid-template-columns: 1fr 1fr; }

  .sa-kpi-grid { grid-template-columns: 1fr 1fr; }

  .modal-overlay .modal { padding: 1.25rem; }
  .modal-overlay { padding: .5rem; }

  /* Auth card full-width on tiny screens */
  .landing-auth { padding: 1rem .75rem 1.5rem; }

  /* History item wraps on narrow screens */
  .history-item { flex-wrap: wrap; gap: .5rem; }
  .history-meta { font-size: 11px; }

  /* Form grid: always 1 column on phones */
  .form-grid-2 { grid-template-columns: 1fr; }

  /* Pricing: single column */
  .pricing-grid { grid-template-columns: 1fr; }

  /* Page header adjusts */
  .page-header h1 { font-size: 1.3rem; }
  .page-header-row { flex-direction: column; align-items: flex-start; }
}

/* ── Ultra-wide (≥ 1400px): give landing more breathing room ─── */
@media (min-width: 1400px) {
  .landing { grid-template-columns: 1fr 500px; }
  .landing-hero { padding: 4rem 5rem 3rem 4rem; }
}
