/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Colors – warm neutral palette */
  --color-bg:          #f8f6f2;
  --color-bg-raised:   #ffffff;
  --color-bg-sunken:   #f1ede6;
  --color-bg-hover:    #f5f0ea;
  --color-bg-active:   #ede5db;

  --color-text:        #1a1410;
  --color-text-secondary: #6b5d52;
  --color-text-tertiary:  #9a8a7d;
  --color-text-inverse: #ffffff;

  --color-primary:     #c04e1a;
  --color-primary-hover: #a84216;
  --color-primary-subtle: #fdf0ea;
  --color-primary-text: #9e3d12;

  --color-border:      #e8ddd1;
  --color-border-subtle: #f0e8de;
  --color-border-strong: #d4c4b4;

  --color-danger:      #c4362c;
  --color-danger-hover: #a82e25;
  --color-danger-subtle: #fef2f1;

  --color-success:     #18794e;
  --color-success-subtle: #edf9f0;

  --color-warning:     #d97706;
  --color-warning-subtle: #fffbeb;
  --color-warning-border: #fde68a;

  --color-info:        #2563eb;
  --color-info-subtle: #eff6ff;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.875rem;
  --text-md:   1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.05em;
  --tracking-widest: 0.1em;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radii */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(30, 18, 10, 0.04);
  --shadow-sm:  0 1px 3px rgba(30, 18, 10, 0.06), 0 1px 2px rgba(30, 18, 10, 0.04);
  --shadow-md:  0 4px 12px rgba(30, 18, 10, 0.07), 0 1px 3px rgba(30, 18, 10, 0.04);
  --shadow-lg:  0 12px 32px rgba(30, 18, 10, 0.08), 0 2px 6px rgba(30, 18, 10, 0.04);
  --shadow-ring: 0 0 0 3px rgba(192, 78, 26, 0.15);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover { color: var(--color-primary-hover); }

h1, h2, h3, h4 {
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--color-bg-sunken);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--color-primary-text);
  font-size: var(--text-xs);
}

/* ── App Shell ────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-bg-raised);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand-icon svg { width: 18px; height: 18px; }

.sidebar-brand-text {
  font-weight: 700;
  font-size: var(--text-md);
  letter-spacing: var(--tracking-tight);
}

.sidebar-brand-sub {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-3);
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  padding: var(--space-4) var(--space-3) var(--space-2);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
  margin-bottom: 2px;
}

.sidebar-link:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.sidebar-link.active {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  font-weight: 600;
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.55;
}

.sidebar-link:hover svg,
.sidebar-link.active svg {
  opacity: 1;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border-subtle);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

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

.sidebar-user-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  background: none;
  border: none;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  display: flex;
  align-items: center;
}

.sidebar-logout:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.sidebar-logout svg { width: 16px; height: 16px; }

/* ── Main Content Area ────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.page-container {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-8) var(--space-16);
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  margin-bottom: var(--space-8);
}

.page-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.page-eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-2);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.page-description {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  max-width: 60ch;
  line-height: var(--leading-relaxed);
}

/* ── Flash Messages ───────────────────────────────────────── */
.flash {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  animation: flash-in var(--duration-slow) var(--ease-out);
}

.flash--info {
  background: var(--color-info-subtle);
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.flash--success {
  background: var(--color-success-subtle);
  border: 1px solid #bbf7d0;
  color: var(--color-success);
}

.flash--warning {
  background: var(--color-warning-subtle);
  border: 1px solid var(--color-warning-border);
  color: #92400e;
}

.flash--error {
  background: var(--color-danger-subtle);
  border: 1px solid #fecaca;
  color: var(--color-danger);
}

/* Default flash style (backwards compat) */
.flash:not([class*="flash--"]) {
  background: var(--color-warning-subtle);
  border: 1px solid var(--color-warning-border);
  color: #92400e;
}

.flash-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-title {
  font-size: var(--text-md);
  font-weight: 650;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

.card-body {
  padding: var(--space-5) var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-bg-sunken);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ── Metric Cards ─────────────────────────────────────────── */
.metric-card {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-primary);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.metric-card-icon svg {
  width: 20px;
  height: 20px;
}

.metric-card-icon--members {
  background: #ede9fe;
  color: #7c3aed;
}

.metric-card-icon--volumes {
  background: #e0f2fe;
  color: #0284c7;
}

.metric-card-icon--tokens {
  background: #fef3c7;
  color: #d97706;
}

.metric-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.metric-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.metric-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-top: var(--space-4);
  color: var(--color-primary);
}

.metric-link svg {
  width: 14px;
  height: 14px;
  transition: transform var(--duration-fast) var(--ease-out);
}

.metric-link:hover svg {
  transform: translateX(3px);
}

/* ── Grid Layouts ─────────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid-sidebar {
  grid-template-columns: 380px 1fr;
  align-items: start;
}

@media (max-width: 800px) {
  .grid-sidebar { grid-template-columns: 1fr; }
}

/* ── Stack ────────────────────────────────────────────────── */
.stack    { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-6); }
.stack-xs { display: flex; flex-direction: column; gap: var(--space-1); }

/* ── Row ──────────────────────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* ── Form Controls ────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.form-input,
.form-select {
  font: inherit;
  font-size: var(--text-base);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-bg-raised);
  color: var(--color-text);
  transition: all var(--duration-fast) var(--ease-out);
  outline: none;
  width: 100%;
}

.form-input:hover,
.form-select:hover {
  border-color: var(--color-text-tertiary);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-ring);
}

.form-input::placeholder {
  color: var(--color-text-tertiary);
}

/* Legacy support - style bare inputs/selects inside labels */
label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
}

input:not([type="checkbox"]):not([type="radio"]):not(.form-input),
select:not(.form-select) {
  font: inherit;
  font-size: var(--text-base);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-bg-raised);
  color: var(--color-text);
  transition: all var(--duration-fast) var(--ease-out);
  outline: none;
  width: 100%;
}

input:not([type="checkbox"]):not([type="radio"]):not(.form-input):hover,
select:not(.form-select):hover {
  border-color: var(--color-text-tertiary);
}

input:not([type="checkbox"]):not([type="radio"]):not(.form-input):focus,
select:not(.form-select):focus {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-ring);
}

/* ── Buttons ──────────────────────────────────────────────── */
button, .btn {
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
  line-height: var(--leading-normal);
  white-space: nowrap;
}

.btn-primary,
button:not(.btn):not(.ghost):not(.danger):not(.btn-ghost):not(.btn-danger):not(.btn-sm):not(.sidebar-logout) {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn-primary:hover,
button:not(.btn):not(.ghost):not(.danger):not(.btn-ghost):not(.btn-danger):not(.btn-sm):not(.sidebar-logout):hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.12);
  transform: translateY(-1px);
}

.btn-primary:active,
button:not(.btn):not(.ghost):not(.danger):not(.btn-ghost):not(.btn-danger):not(.btn-sm):not(.sidebar-logout):active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn-ghost, .ghost {
  background: var(--color-bg-sunken);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover, .ghost:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn-danger, .danger {
  background: var(--color-danger);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-xs);
}

.btn-danger:hover, .danger:hover {
  background: var(--color-danger-hover);
  box-shadow: var(--shadow-sm);
}

.btn-sm {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: var(--space-2);
  background: transparent;
  color: var(--color-text-tertiary);
  border: none;
}

.btn-icon:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

/* ── Links styled as buttons ──────────────────────────────── */
.ghost-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,0.12);
}

.ghost-link:hover {
  background: var(--color-primary-hover);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* ── Tables ───────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead th {
  text-align: left;
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-tertiary);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--duration-fast) var(--ease-out);
}

tbody tr:hover {
  background: var(--color-bg-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  line-height: var(--leading-normal);
}

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

.badge--revoked {
  background: var(--color-bg-sunken);
  color: var(--color-text-tertiary);
}

.badge--pending {
  background: var(--color-warning-subtle);
  color: var(--color-warning);
}

.badge--owner {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}

.badge--admin {
  background: #ede9fe;
  color: #7c3aed;
}

.badge--member {
  background: var(--color-bg-sunken);
  color: var(--color-text-secondary);
}

.badge--free {
  background: var(--color-bg-sunken);
  color: var(--color-text-secondary);
}

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

.badge--enterprise {
  background: #fce7f3;
  color: #be185d;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* ── Volume Cards ─────────────────────────────────────────── */
.volume-card {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--duration-normal) var(--ease-out);
}

.volume-card:hover {
  box-shadow: var(--shadow-sm);
}

.volume-card + .volume-card {
  margin-top: var(--space-3);
}

.volume-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.volume-name {
  font-weight: 650;
  font-size: var(--text-md);
}

.volume-prefix {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  background: var(--color-bg-sunken);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: var(--space-3);
}

.volume-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-subtle);
  margin-top: var(--space-3);
}

/* ── Credentials List ─────────────────────────────────────── */
.cred-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-bg-sunken);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.cred-item + .cred-item {
  margin-top: var(--space-2);
}

.cred-key {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.cred-expires {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-left: auto;
}

/* ── Invite Item ──────────────────────────────────────────── */
.invite-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-bg-sunken);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.invite-item + .invite-item {
  margin-top: var(--space-2);
}

.invite-email {
  font-weight: 500;
  color: var(--color-text);
}

.invite-token {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* ── Dividers ─────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  margin: var(--space-5) 0;
}

/* ── Empty States ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  color: var(--color-text-tertiary);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  color: var(--color-border-strong);
}

.empty-state-title {
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.empty-state-desc {
  font-size: var(--text-sm);
  max-width: 32ch;
  margin: 0 auto;
}

/* ── Plan Cards ───────────────────────────────────────────── */
.plan-card {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
}

.plan-card:hover {
  border-color: var(--color-border-strong);
}

.plan-card.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.plan-card-name {
  font-weight: 700;
  font-size: var(--text-md);
  margin-bottom: var(--space-1);
  text-transform: capitalize;
}

.plan-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background:
    radial-gradient(ellipse at 20% 50%, rgba(192, 78, 26, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(192, 78, 26, 0.03) 0%, transparent 50%),
    var(--color-bg);
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.login-logo-icon {
  width: 44px;
  height: 44px;
  background: var(--color-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-md);
}

.login-logo-icon svg { width: 24px; height: 24px; }

.login-logo-text {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

.login-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.login-subtitle {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.login-card {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
}

.login-providers {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.login-provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong);
  background: var(--color-bg-raised);
  color: var(--color-text);
  font-weight: 600;
  font-size: var(--text-base);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.login-provider-btn:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-text-tertiary);
  color: var(--color-text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.login-provider-btn--primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.login-provider-btn--primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-text-inverse);
}

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

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.login-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-weight: 600;
  font-size: var(--text-base);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.login-submit-btn:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

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

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  margin: var(--space-2) 0;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--color-border);
}

/* ── Invite Page ──────────────────────────────────────────── */
.invite-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.invite-container {
  width: 100%;
  max-width: 440px;
}

.invite-card {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.invite-card h1 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
}

.invite-details {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-bg-sunken);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
}

.invite-card button {
  width: 100%;
}

.invite-card p {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

/* ── Token Reveal ─────────────────────────────────────────── */
.token-reveal {
  background: var(--color-bg-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  word-break: break-all;
  line-height: var(--leading-relaxed);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

/* ── Section Divider ──────────────────────────────────────── */
.section-divider {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--color-text-tertiary);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border-subtle);
  margin-top: var(--space-6);
  margin-bottom: var(--space-4);
}

/* ── Stripe Connection Card ───────────────────────────────── */
.stripe-card {
  background: linear-gradient(135deg, #635bff 0%, #7a73ff 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  color: white;
  text-align: center;
}

.stripe-card h2 {
  color: white;
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.stripe-card p {
  opacity: 0.85;
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.stripe-card a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  background: white;
  color: #635bff;
  font-weight: 700;
  font-size: var(--text-sm);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.stripe-card a:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: #635bff;
}

/* ── Utility Classes ──────────────────────────────────────── */
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary  { color: var(--color-text-tertiary); }
.text-sm        { font-size: var(--text-sm); }
.text-xs        { font-size: var(--text-xs); }
.text-center    { text-align: center; }
.font-mono      { font-family: var(--font-mono); }
.font-medium    { font-weight: 500; }
.font-semibold  { font-weight: 600; }
.font-bold      { font-weight: 700; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-raised);
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .page-container {
    padding: var(--space-5) var(--space-4) var(--space-10);
  }

  .grid-sidebar {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) {
  .mobile-header { display: none; }
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: slide-up var(--duration-slow) var(--ease-out);
}

/* ── Scrollbar (Webkit) ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-tertiary);
}

/* ── Old compat (keep panel working for invite page etc.) ── */
.panel {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.panel.narrow {
  max-width: 540px;
}
