/* =================================================================
   ADMIN PANEL STYLESHEET
   Extends the portal/marketing design system. Same tokens, same fonts,
   admin-specific components below.
   ================================================================= */

:root {
  --ink: #0F0F0F;
  --ink-soft: #1F1F1F;
  --ink-deep: #050505;
  --red: #C8102E;
  --red-deep: #8B0A1F;
  --red-wash: #FBEDEF;
  --paper: #FFFFFF;
  --paper-deep: #F7F5F0;
  --paper-warm: #FAFAF7;
  --muted: #6B6B6B;
  --muted-soft: #9A968E;
  --hairline: #E5E5E0;
  --hairline-light: #EEEEE8;
  --success: #2A7D4F;
  --warning: #C78A1F;
  --info: #2563eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper-warm);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

.serif { font-family: 'Fraunces', Georgia, serif; font-optical-sizing: auto; }
.mono { font-family: 'IBM Plex Mono', 'SF Mono', Consolas, monospace; }
.emph { font-style: italic; color: var(--red); font-variation-settings: 'SOFT' 100, 'WONK' 1; }

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
}

h1, h2, h3, h4 { font-family: 'Fraunces', serif; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }

/* =================================================================
   AUTH (admin login)
   ================================================================= */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-side {
  background: var(--ink-deep);
  color: var(--paper);
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 30%, rgba(200, 16, 46, 0.18), transparent 60%);
  pointer-events: none;
}
.auth-side-inner { position: relative; z-index: 1; max-width: 480px; }
.auth-side .logo {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.auth-side .logo .dot { width: 6px; height: 6px; background: var(--red); border-radius: 50%; display: inline-block; }
.auth-side .badge-admin {
  display: inline-block;
  margin-top: 24px;
  padding: 4px 10px;
  background: var(--red);
  color: var(--paper);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-radius: 2px;
}
.auth-side .display {
  font-family: 'Fraunces', serif;
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1;
  letter-spacing: -0.035em;
  margin: 32px 0 24px;
}
.auth-side .lead {
  font-size: 16px;
  color: #B5B5B5;
  line-height: 1.7;
  max-width: 44ch;
}
.auth-side .footer {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #6a6a6a;
  text-transform: uppercase;
}

.auth-main {
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--paper);
}
.auth-main-inner { max-width: 440px; margin: 0 auto; width: 100%; }
.auth-main h1 { font-size: clamp(32px, 4vw, 44px); margin-bottom: 12px; }
.auth-main .subtitle { color: var(--muted); font-size: 16px; margin-bottom: 40px; line-height: 1.6; }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-main { padding: 40px 24px; min-height: 100vh; }
}

/* =================================================================
   ADMIN LAYOUT — sidebar + main (flexbox)
   ================================================================= */
.admin {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  position: relative;
}

.sidebar {
  background: var(--ink-deep);
  color: var(--paper);
  padding: 24px 0;
  width: 248px;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-self: flex-start;
}
.sidebar-brand {
  padding: 0 24px 24px;
  border-bottom: 1px solid #1f1f1f;
  margin-bottom: 24px;
}
.sidebar-brand .logo {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.sidebar-brand .logo .dot { width: 5px; height: 5px; background: var(--red); border-radius: 50%; display: inline-block; }
.sidebar-brand .role {
  display: block;
  margin-top: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 500;
}
.sidebar-brand .role::before { content: '◆ '; }

.sidebar-label {
  padding: 0 24px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: #6a6a6a;
  text-transform: uppercase;
  margin-bottom: 8px;
  margin-top: 8px;
  font-weight: 500;
}
.sidebar-nav { list-style: none; padding: 0; margin-bottom: 16px; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 24px;
  color: #cccccc;
  font-size: 13px;
  transition: all 0.15s;
  position: relative;
}
.sidebar-nav li a:hover { color: var(--paper); background: rgba(255,255,255,0.03); }
.sidebar-nav li a.active { color: var(--paper); background: rgba(200, 16, 46, 0.14); }
.sidebar-nav li a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
}
.sidebar-nav .icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: currentColor;
  opacity: 0.85;
}
.sidebar-nav .badge {
  margin-left: auto;
  background: var(--red);
  color: var(--paper);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 2px;
  letter-spacing: 0.05em;
}
.sidebar-foot {
  margin-top: auto;
  padding: 16px 24px 0;
  border-top: 1px solid #1f1f1f;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user .avatar {
  width: 32px;
  height: 32px;
  background: var(--red);
  border-radius: 50%;
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}
.sidebar-user .who { min-width: 0; flex: 1; overflow: hidden; }
.sidebar-user .name { font-size: 12px; color: var(--paper); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .role-tag { font-size: 10px; color: #8a8a8a; font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.05em; text-transform: uppercase; margin-top: 2px; }
.sidebar-user .menu-trigger { color: #8a8a8a; padding: 4px; }
.sidebar-user .menu-trigger:hover { color: var(--paper); }

/* Main column */
.main {
  flex: 1;
  min-width: 0;
  background: var(--paper-warm);
  overflow-x: hidden;
}
.main-topbar {
  padding: 14px 32px;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.main-topbar .breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.main-topbar .breadcrumb a { color: var(--muted); }
.main-topbar .breadcrumb a:hover { color: var(--red); }
.main-topbar .breadcrumb .sep { color: var(--hairline); }
.main-topbar .breadcrumb .current { color: var(--ink); }
.main-topbar .actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 2px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  position: relative;
}
.icon-btn:hover { background: var(--paper-deep); border-color: var(--hairline); }
.icon-btn.has-alert::after {
  content: '';
  position: absolute;
  top: 8px; right: 8px;
  width: 7px; height: 7px;
  background: var(--red);
  border: 2px solid var(--paper);
  border-radius: 50%;
}

.main-content { padding: 32px; max-width: 1400px; width: 100%; }

/* Page header */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.page-header h1 { font-size: clamp(28px, 3vw, 36px); letter-spacing: -0.025em; line-height: 1; }
.page-header .subtitle { color: var(--muted); font-size: 13px; margin-top: 8px; max-width: 64ch; }
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* =================================================================
   FORMS
   ================================================================= */
.form-field { margin-bottom: 18px; }
.form-label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  border: 1px solid var(--hairline);
  padding: 10px 12px;
  font-size: 14px;
  background: var(--paper);
  outline: none;
  font-family: 'Instrument Sans', sans-serif;
  color: var(--ink);
  transition: all 0.15s;
  border-radius: 2px;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.08);
}
.form-textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.form-help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
  display: none;
}
.form-error.shown { display: block; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Inline editable fields (for CMS) */
.editable {
  width: 100%;
  border: 1px solid transparent;
  padding: 6px 10px;
  margin: -6px -10px;
  border-radius: 2px;
  font: inherit;
  color: inherit;
  background: transparent;
  transition: all 0.15s;
  outline: none;
  resize: none;
  display: block;
}
.editable:hover { border-color: var(--hairline); background: var(--paper); }
.editable:focus { border-color: var(--red); background: var(--paper); box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.08); }

/* =================================================================
   BUTTONS
   ================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: 2px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--red); color: var(--paper); }
.btn-primary:hover { background: var(--red-deep); }
.btn-primary:disabled { background: var(--muted); cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--hairline); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: var(--ink-soft); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red); color: var(--paper); }
.btn-block { width: 100%; }
.btn-large { padding: 14px 24px; font-size: 14px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn .arrow { transition: transform 0.15s; }
.btn:hover .arrow { transform: translateX(2px); }

/* =================================================================
   PANELS / CARDS
   ================================================================= */
.panel {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 2px;
  overflow: hidden;
}
.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.panel-header h3 { font-size: 15px; letter-spacing: -0.01em; }
.panel-header .actions a, .panel-header .actions button {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
}
.panel-body { padding: 20px; }
.panel-body.flush { padding: 0; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.kpi {
  background: var(--paper);
  border: 1px solid var(--hairline);
  padding: 20px;
  border-radius: 2px;
  position: relative;
}
.kpi .kpi-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.kpi .kpi-num {
  font-family: 'Fraunces', serif;
  font-size: 38px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 10px 0;
}
.kpi .kpi-delta {
  font-size: 12px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.05em;
  color: var(--success);
}
.kpi .kpi-delta.down { color: var(--red); }
.kpi .kpi-delta.neutral { color: var(--muted); }

/* =================================================================
   FILTERS BAR
   ================================================================= */
.filters {
  background: var(--paper);
  border: 1px solid var(--hairline);
  padding: 14px 16px;
  border-radius: 2px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-search {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.filter-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--hairline);
  background: var(--paper-deep);
  border-radius: 2px;
  font-size: 13px;
  outline: none;
}
.filter-search input:focus { border-color: var(--ink); background: var(--paper); }
.filter-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.filter-select {
  padding: 8px 28px 8px 12px;
  border: 1px solid var(--hairline);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236B6B6B' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  border-radius: 2px;
  font-size: 13px;
  outline: none;
  appearance: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
}
.filter-select:focus { border-color: var(--ink); }
.filter-pill {
  background: var(--ink);
  color: var(--paper);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 10px 6px 12px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.filter-pill .x { cursor: pointer; opacity: 0.7; }
.filter-pill .x:hover { opacity: 1; }
.filter-clear {
  background: none;
  border: 0;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 10px;
}
.filter-clear:hover { color: var(--red); }

/* =================================================================
   DATA TABLES
   ================================================================= */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead tr { border-bottom: 1px solid var(--hairline); background: var(--paper-deep); }
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--ink); }
.data-table tbody tr {
  border-bottom: 1px solid var(--hairline-light);
  transition: background 0.1s;
}
.data-table tbody tr:hover { background: var(--paper-deep); }
.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  vertical-align: middle;
}
.data-table .col-name {
  font-weight: 500;
  color: var(--ink);
}
.data-table .row-actions { display: flex; gap: 4px; justify-content: flex-end; }

.cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cell-avatar {
  width: 32px; height: 32px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}
.cell-avatar.red { background: var(--red); }
.cell-avatar.muted { background: var(--paper-deep); color: var(--muted); border: 1px solid var(--hairline); }
.cell-user .name { font-weight: 500; color: var(--ink); }
.cell-user .meta { font-size: 11px; color: var(--muted); margin-top: 1px; font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.03em; }

.row-action {
  width: 28px; height: 28px;
  border-radius: 2px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.row-action:hover { color: var(--red); background: var(--paper-deep); }
.row-action.danger:hover { color: var(--red); background: var(--red-wash); }

/* =================================================================
   FILE ICONS (re-used from portal)
   ================================================================= */
.file-icon {
  width: 32px; height: 40px;
  background: var(--paper-deep);
  border: 1px solid var(--hairline);
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  font-weight: 500;
  color: var(--muted);
  flex-shrink: 0;
  letter-spacing: 0.05em;
}
.file-icon[data-type="pdf"] { color: var(--red); border-color: var(--red); background: var(--red-wash); }
.file-icon[data-type="docx"], .file-icon[data-type="doc"] { color: var(--info); border-color: var(--info); background: #EEF4FF; }
.file-icon[data-type="xlsx"], .file-icon[data-type="csv"] { color: var(--success); border-color: var(--success); background: #EBF4EE; }
.file-icon[data-type="png"], .file-icon[data-type="jpg"], .file-icon[data-type="jpeg"] { color: #9333ea; border-color: #9333ea; background: #F5EEFB; }

/* =================================================================
   BADGES & PILLS
   ================================================================= */
.badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 2px;
  font-weight: 500;
  display: inline-block;
  white-space: nowrap;
}
.badge-red { background: var(--red); color: var(--paper); }
.badge-dark { background: var(--ink); color: var(--paper); }
.badge-outline { background: transparent; color: var(--muted); border: 1px solid var(--hairline); }
.badge-success { background: #EBF4EE; color: var(--success); }
.badge-warn { background: #FBF3E0; color: var(--warning); }
.badge-info { background: #EEF4FF; color: var(--info); }
.badge-mute { background: var(--paper-deep); color: var(--muted); }

/* =================================================================
   STATUS DOTS
   ================================================================= */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.status-dot.active { background: var(--success); }
.status-dot.pending { background: var(--warning); }
.status-dot.inactive { background: var(--muted); }
.status-dot.invited { background: var(--info); }

/* =================================================================
   CMS BLOCKS — section editor
   ================================================================= */
.block {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 2px;
  margin-bottom: 16px;
  overflow: hidden;
  transition: all 0.15s;
}
.block:hover { border-color: var(--ink); }
.block-header {
  padding: 12px 16px;
  background: var(--paper-deep);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.block-handle {
  cursor: grab;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
}
.block-handle:hover { color: var(--ink); }
.block-type {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 500;
}
.block-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.block-actions { display: flex; gap: 4px; align-items: center; }
.block-body { padding: 20px; }
.block-collapsed .block-body { display: none; }
.block-add {
  border: 1px dashed var(--hairline);
  background: transparent;
  border-radius: 2px;
  padding: 18px;
  text-align: center;
  width: 100%;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 8px;
}
.block-add:hover { border-color: var(--red); color: var(--red); background: var(--paper); }

/* Rich text toolbar */
.rt-toolbar {
  display: flex;
  gap: 2px;
  padding: 6px;
  background: var(--paper-deep);
  border: 1px solid var(--hairline);
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  flex-wrap: wrap;
}
.rt-btn {
  width: 28px; height: 28px;
  border-radius: 2px;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.1s;
}
.rt-btn:hover { background: var(--paper); }
.rt-btn.active { background: var(--ink); color: var(--paper); }
.rt-sep { width: 1px; background: var(--hairline); margin: 4px 4px; }

.rt-content {
  border: 1px solid var(--hairline);
  border-radius: 0 0 2px 2px;
  padding: 14px 16px;
  min-height: 120px;
  background: var(--paper);
  font-size: 14px;
  line-height: 1.65;
  outline: none;
}
.rt-content:focus { border-color: var(--ink); }
.rt-content p { margin-bottom: 12px; }
.rt-content p:last-child { margin-bottom: 0; }
.rt-content em { font-style: italic; color: var(--red); }

/* =================================================================
   TOASTS
   ================================================================= */
.toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--paper);
  padding: 14px 18px;
  border-radius: 2px;
  border-left: 3px solid var(--red);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  max-width: 340px;
  pointer-events: auto;
  animation: slideIn 0.25s ease;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.toast.success { border-left-color: var(--success); }
.toast-body { flex: 1; }
.toast strong { display: block; margin-bottom: 1px; font-weight: 600; font-size: 13px; }
.toast span { color: #cccccc; font-size: 12px; }
.toast .close { color: #8a8a8a; cursor: pointer; padding: 2px; }
.toast .close:hover { color: var(--paper); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* =================================================================
   MODAL
   ================================================================= */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,15,15,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.shown { display: flex; }
.modal {
  background: var(--paper);
  width: 520px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 2px;
  position: relative;
}
.modal.lg { width: 720px; }
.modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 18px; letter-spacing: -0.015em; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
}
.modal-close:hover { color: var(--ink); background: var(--paper-deep); }
.modal-body { padding: 24px 28px; }
.modal-foot {
  padding: 16px 28px;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--paper-deep);
}

/* =================================================================
   TABS
   ================================================================= */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 24px;
}
.tab {
  padding: 12px 20px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--red); border-bottom-color: var(--red); }

/* =================================================================
   ACTIVITY FEED (used in dashboard + user detail)
   ================================================================= */
.activity-list { list-style: none; padding: 0; }
.activity-item {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline-light);
  align-items: flex-start;
}
.activity-item:last-child { border-bottom: 0; }
.activity-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--paper-deep);
  border: 1px solid var(--hairline);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
  flex-shrink: 0;
}
.activity-icon.upload { color: var(--success); }
.activity-icon.user { color: var(--info); }
.activity-body { flex: 1; min-width: 0; }
.activity-title { font-size: 13px; color: var(--ink); }
.activity-title strong { font-weight: 600; }
.activity-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 2px;
}

/* =================================================================
   TWO-COLUMN LAYOUT (e.g. user detail with sidebar)
   ================================================================= */
.split {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
}
.split-2-1 { grid-template-columns: 2fr 1fr; }
.split-1-2 { grid-template-columns: 1fr 2fr; }

/* =================================================================
   EMPTY STATE
   ================================================================= */
.empty-state {
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state .icon {
  font-family: 'Fraunces', serif;
  font-size: 56px;
  line-height: 1;
  color: var(--hairline);
  margin-bottom: 16px;
  font-weight: 300;
}
.empty-state h3 { color: var(--ink); margin-bottom: 6px; font-size: 18px; }
.empty-state p { font-size: 13px; }

/* =================================================================
   UTILITIES
   ================================================================= */
.divider { height: 1px; background: var(--hairline); margin: 20px 0; }
.text-muted { color: var(--muted); }
.text-red { color: var(--red); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-sm { gap: 8px; } .gap-md { gap: 16px; } .gap-lg { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 2px; }

/* =================================================================
   MOBILE
   ================================================================= */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .split, .split-2-1, .split-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .admin { display: block; }
  .sidebar {
    position: fixed;
    top: 0; left: -280px;
    width: 248px;
    height: 100vh;
    z-index: 200;
    transition: left 0.3s;
    align-self: auto;
  }
  .sidebar.open { left: 0; }
  .main { width: 100%; }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
  }
  .sidebar-backdrop.shown { display: block; }
  .main-topbar { padding: 12px 16px; }
  .main-content { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .mobile-menu-trigger { display: inline-flex !important; }
  .data-table .hide-mobile { display: none; }
  .data-table th, .data-table td { padding: 10px 8px; font-size: 12px; }
  .page-header { flex-direction: column; align-items: flex-start; }
}
.mobile-menu-trigger { display: none; }
@media (min-width: 901px) { .hide-desktop { display: none !important; } }
