/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --dark:     #0f1117;
  --surface:  #1a1d27;
  --surface2: #222638;
  --border:   #2e3248;
  --accent:   #4f6ef7;
  --accent2:  #7c9dff;
  --success:  #2ec27e;
  --error:    #e05252;
  --warning:  #e09b2e;
  --text:     #e8eaf0;
  --text-mid: #9194a8;
  --text-dim: #5c5f73;
  --mono:     'Courier New', monospace;
  --sans:     -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius:   8px;
  --shadow:   0 4px 24px rgba(0,0,0,0.35);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--text); }

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

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-icon { font-size: 24px; color: var(--accent); line-height: 1; }
.brand-name { font-weight: 600; font-size: 0.95rem; letter-spacing: 0.02em; }
.brand-sub  { font-size: 0.7rem; color: var(--text-dim); letter-spacing: 0.05em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-mid);
  font-size: 0.88rem;
  transition: all 0.15s;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent); color: white; }
.nav-icon { font-size: 1rem; width: 16px; text-align: center; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.logout-btn {
  font-size: 0.82rem;
  color: var(--text-dim);
  transition: color 0.15s;
}
.logout-btn:hover { color: var(--error); }

/* ── Main content ────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: 220px;
  min-height: 100vh;
}

.content-wrap { padding: 32px 36px; max-width: 1100px; }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
.page-sub   { color: var(--text-mid); font-size: 0.88rem; margin-top: 2px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-header h2 { font-size: 0.95rem; font-weight: 600; letter-spacing: 0.01em; }

/* ── Stats ───────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-card.accent { border-color: var(--accent); background: rgba(79,110,247,0.08); }
.stat-number { font-family: 'Courier New', monospace; font-size: 1.8rem; font-weight: 600; color: var(--accent2); }
.stat-label  { font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(46,50,72,0.5);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  line-height: 1;
}

.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: #3d5be0; color: white; }

.btn-outline { background: transparent; color: var(--text-mid); border-color: var(--border); }
.btn-outline:hover { border-color: var(--text-mid); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-danger { background: transparent; color: var(--error); border-color: rgba(224,82,82,0.3); }
.btn-danger:hover { background: rgba(224,82,82,0.1); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 500; color: var(--text-mid); margin-bottom: 6px; letter-spacing: 0.02em; }
.form-group small { display: block; font-size: 0.76rem; color: var(--text-dim); margin-top: 4px; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  padding: 10px 14px;
  transition: border-color 0.15s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus { border-color: var(--accent); }

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

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }

/* Toggle */
.toggle-row { display: flex; align-items: center; }
.toggle-label { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 0.875rem; color: var(--text-mid); }
.toggle-label input { display: none; }
.toggle-switch {
  width: 40px; height: 22px;
  background: var(--border);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  top: 3px; left: 3px;
  transition: transform 0.2s;
}
.toggle-label input:checked + .toggle-switch { background: var(--accent); }
.toggle-label input:checked + .toggle-switch::after { transform: translateX(18px); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
  border: 1px solid;
}

.alert-success { background: rgba(46,194,126,0.1); border-color: rgba(46,194,126,0.3); color: #5de0a0; }
.alert-error   { background: rgba(224,82,82,0.1); border-color: rgba(224,82,82,0.3); color: #f08080; }
.alert-warning { background: rgba(224,155,46,0.1); border-color: rgba(224,155,46,0.3); color: #f0c070; }

/* ── Badge ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(79,110,247,0.15);
  color: var(--accent2);
  letter-spacing: 0.04em;
  font-family: 'Courier New', monospace;
}

/* ── Info box ────────────────────────────────────────────────────────────── */
.info-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 0.85rem;
}

.info-success { border-color: rgba(46,194,126,0.4); color: #5de0a0; background: rgba(46,194,126,0.07); }
.info-error   { border-color: rgba(224,82,82,0.4);  color: #f08080; background: rgba(224,82,82,0.07); }

.info-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.82rem; }
.info-row span:first-child { color: var(--text-dim); }
.info-row span:last-child  { font-weight: 500; font-family: 'Courier New', monospace; font-size: 0.8rem; }

/* ── Info list ───────────────────────────────────────────────────────────── */
.info-list { display: flex; flex-direction: column; gap: 16px; }
.info-item { display: flex; gap: 14px; align-items: flex-start; }
.info-dot  { color: var(--accent); font-size: 1.1rem; margin-top: 1px; flex-shrink: 0; }
.info-item strong { display: block; font-size: 0.875rem; margin-bottom: 2px; }
.info-item p { font-size: 0.8rem; color: var(--text-mid); }

/* ── Partners grid ───────────────────────────────────────────────────────── */
.partners-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.partner-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.partner-name   { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.partner-detail { font-size: 0.78rem; color: var(--accent2); font-family: 'Courier New', monospace; }
.partner-email  { font-size: 0.76rem; color: var(--text-dim); margin-top: 4px; word-break: break-all; }

/* ── Preset buttons ──────────────────────────────────────────────────────── */
.preset-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Two-col layout ──────────────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }

/* ── Settings grid ───────────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.setting-note  { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 16px; line-height: 1.5; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); }
.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 480px;
  max-width: 95vw;
  box-shadow: var(--shadow);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 1.1rem; }
.modal-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1.1rem; }
.modal-close:hover { color: var(--text); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-icon  { font-size: 2.5rem; color: var(--text-dim); margin-bottom: 12px; }
.empty-state p { color: var(--text-mid); margin-bottom: 16px; }

/* ── Mono helper ─────────────────────────────────────────────────────────── */
.mono { font-family: 'Courier New', monospace; font-size: 0.82rem; }

/* ── Hidden ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── LOGIN PAGE ──────────────────────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--dark); }
.login-wrap { display: flex; width: 840px; max-width: 95vw; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }

.login-card { flex: 1; padding: 48px 40px; }
.login-brand { margin-bottom: 36px; }
.login-icon  { font-size: 2.5rem; display: block; margin-bottom: 12px; }
.login-brand h1 { font-size: 1.5rem; font-weight: 600; }
.login-brand p  { color: var(--text-dim); font-size: 0.85rem; margin-top: 4px; }

.login-form .form-group { margin-bottom: 20px; }
.login-form input { font-size: 0.95rem; padding: 12px 16px; }

.login-visual {
  width: 260px;
  background: linear-gradient(160deg, #1a1d27 0%, #0f1117 100%);
  border-left: 1px solid var(--border);
  padding: 40px 28px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}

.visual-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.4;
}

.visual-text { position: relative; }
.v-line {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--text-dim);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.04em;
}
.v-line:last-child { border-bottom: none; color: var(--accent2); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .brand-name, .brand-sub, .nav-item span:not(.nav-icon), .sidebar-footer { display: none; }
  .sidebar-brand { justify-content: center; padding: 16px; }
  .nav-item { justify-content: center; }
  .main-content { margin-left: 60px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .settings-grid, .two-col { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .content-wrap { padding: 20px; }
}
