﻿:root {
  --bg-body: #fafafa;
  --bg-surface: #ffffff;
  --zinc-50: #fafafa;
  --zinc-100: #f4f4f5;
  --zinc-200: #e4e4e7;
  --zinc-300: #d4d4d8;
  --zinc-400: #a1a1aa;
  --zinc-500: #71717a;
  --zinc-600: #52525b;
  --zinc-700: #3f3f46;
  --zinc-800: #27272a;
  --zinc-900: #18181b;
  --emerald-500: #10b981;
  --amber-500: #f59e0b;
  --rose-500: #ef4444;
  --rose-600: #e11d48;
  --brand-gold: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 8px 16px rgba(0,0,0,0.02);
  --shadow-dropdown: 0 4px 6px -1px rgba(0,0,0,0.05), 0 10px 25px -5px rgba(0,0,0,0.05);
  --shadow-modal: 0 25px 50px -12px rgba(0,0,0,0.15);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-cinematic: cubic-bezier(0.16, 1, 0.2, 1);
  --sidebar-w: 220px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif;
  background: var(--bg-body);
  color: var(--zinc-900);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-height: 100%;
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }
svg { display: block; flex-shrink: 0; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }

/* Buttons */
.btn {
  height: 36px; padding: 0 16px; border-radius: 6px; font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; border: 1px solid transparent; outline: none;
  transition: all 0.2s var(--ease-out); user-select: none; background: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--zinc-900); color: #fff; }
.btn-primary:hover { background: var(--zinc-800); }
.btn-outline { background: #fff; border-color: var(--zinc-200); color: var(--zinc-900); box-shadow: var(--shadow-sm); }
.btn-outline:hover { background: var(--zinc-50); border-color: var(--zinc-300); }
.btn-ghost { color: var(--zinc-600); }
.btn-ghost:hover { background: var(--zinc-100); color: var(--zinc-900); }
.btn-danger { background: var(--rose-600); color: #fff; }
.btn-danger:hover { background: var(--rose-500); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* Forms */
.input, .textarea, .select-native {
  height: 36px; padding: 0 12px; border-radius: 6px; font-size: 14px;
  background: #fff; border: 1px solid var(--zinc-200); color: var(--zinc-900);
  transition: all 0.2s ease; outline: none; width: 100%; box-shadow: var(--shadow-sm);
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 96px; }
.input::placeholder, .textarea::placeholder { color: var(--zinc-400); }
.input:hover, .textarea:hover, .select-native:hover { border-color: var(--zinc-300); }
.input:focus, .textarea:focus, .select-native:focus {
  border-color: var(--zinc-400); box-shadow: 0 0 0 1px var(--zinc-300);
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 500; color: var(--zinc-600); }
.field .hint { font-size: 12px; color: var(--zinc-400); }
.field.has-error .input, .field.has-error .textarea { border-color: var(--rose-500); }
.field .error { font-size: 12px; color: var(--rose-500); }

/* Cards / badges / chips */
.card {
  background: var(--bg-surface); border: 1px solid var(--zinc-200);
  border-radius: 12px; padding: 24px; box-shadow: var(--shadow-card);
}
.card-flush { padding: 0; overflow: hidden; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card-desc { font-size: 13px; color: var(--zinc-500); margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px;
  border-radius: 6px; background: var(--zinc-100); color: var(--zinc-700); font-size: 12px; font-weight: 500;
}
.chip.high-contrast { background: var(--zinc-900); color: #fff; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--zinc-500); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--zinc-300); }
.status-dot.success { background: var(--emerald-500); }
.status-dot.error { background: var(--rose-500); }
.status-dot.warn { background: var(--amber-500); }
.status-dot.muted { background: var(--zinc-300); }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--zinc-500); padding: 12px 16px;
  border-bottom: 1px solid var(--zinc-200); background: var(--zinc-50);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--zinc-100); vertical-align: middle; }
.table tr:hover td { background: var(--zinc-50); }
.table .text-right { text-align: right; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* Layout shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: #fff;
  border-right: 1px solid var(--zinc-200); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 18px;
  border-bottom: 1px solid var(--zinc-100);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--zinc-900);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-text { font-weight: 650; font-size: 15px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--zinc-400); font-weight: 500; }
.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-section {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--zinc-400); padding: 12px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border-radius: 6px; color: var(--zinc-600); font-size: 14px; font-weight: 500;
  transition: all 0.15s var(--ease-out); margin-bottom: 2px;
}
.nav-item:hover { background: var(--zinc-50); color: var(--zinc-900); }
.nav-item.active { background: var(--zinc-100); color: var(--zinc-900); }
.nav-item svg { width: 16px; height: 16px; opacity: 0.7; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--zinc-200); background: rgba(255,255,255,0.85);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-pill {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px;
  border-radius: 8px; border: 1px solid var(--zinc-200); background: #fff;
}
.avatar {
  width: 28px; height: 28px; border-radius: 6px; background: var(--zinc-100);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--zinc-600);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.content { padding: 28px; flex: 1; }
.content-narrow { max-width: 960px; }
.content-wide { max-width: 1200px; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.page-header p { color: var(--zinc-500); font-size: 14px; margin-top: 4px; }
.breadcrumbs { display: flex; gap: 8px; font-size: 13px; color: var(--zinc-400); margin-bottom: 8px; }
.breadcrumbs a:hover { color: var(--zinc-700); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { padding: 20px; }
.stat-label { font-size: 12px; color: var(--zinc-500); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 28px; font-weight: 650; letter-spacing: -0.03em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: 12px; color: var(--zinc-400); margin-top: 6px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--zinc-500); }
.divider { height: 1px; background: var(--zinc-200); margin: 20px 0; }

.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .empty-icon { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--zinc-300); }
.empty-title { font-weight: 600; margin-bottom: 4px; }
.empty-desc { color: var(--zinc-500); font-size: 13px; margin-bottom: 16px; }

/* Auth */
.auth-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  perspective: 2500px; position: relative; overflow: hidden; padding: 24px;
}
.auth-body::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(to right, var(--zinc-200) 1px, transparent 1px),
    linear-gradient(to bottom, var(--zinc-200) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 0%, black 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, black 10%, transparent 70%);
  opacity: 0.4; pointer-events: none;
}
.auth-card {
  position: relative; z-index: 1; width: 100%; max-width: 400px;
  background: #fff; border: 1px solid rgba(228,228,231,0.6); border-radius: 20px;
  padding: 40px 36px; box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 8px 24px rgba(0,0,0,0.04), 0 24px 48px rgba(0,0,0,0.05);
  animation: emerge 1.2s var(--ease-cinematic) both;
}
@keyframes emerge {
  from { opacity: 0; transform: translateZ(-800px) translateY(80px) rotateX(12deg); filter: blur(12px); }
  to { opacity: 1; transform: none; filter: none; }
}
.auth-logo {
  width: 44px; height: 44px; border-radius: 12px; background: var(--zinc-50);
  border: 1px solid var(--zinc-200); display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px;
}
.auth-title { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.auth-sub { color: var(--zinc-500); margin: 6px 0 28px; font-size: 14px; }
.auth-footer { margin-top: 24px; text-align: center; font-size: 13px; color: var(--zinc-500); }
.auth-footer a { color: var(--zinc-900); font-weight: 500; }

/* Marketing home */
.marketing { background: var(--bg-body); }
.m-nav {
  max-width: 1100px; margin: 0 auto; padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.m-hero {
  max-width: 1100px; margin: 0 auto; padding: 72px 24px 96px;
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center;
}
.m-hero h1 {
  font-size: clamp(36px, 5vw, 52px); font-weight: 700; letter-spacing: -0.03em;
  line-height: 1.1; margin: 16px 0 16px;
}
.m-hero .lead { font-size: 16px; color: var(--zinc-500); max-width: 420px; margin-bottom: 28px; }
.m-visual {
  height: 360px; border-radius: 16px; border: 1px solid var(--zinc-200);
  background:
    linear-gradient(145deg, #fff 0%, var(--zinc-50) 100%),
    repeating-linear-gradient(90deg, transparent, transparent 31px, var(--zinc-100) 32px);
  box-shadow: var(--shadow-card); position: relative; overflow: hidden;
}
.m-visual-panel {
  position: absolute; left: 40px; right: 40px; top: 48px; bottom: 48px;
  border-radius: 12px; background: #fff; border: 1px solid var(--zinc-200);
  padding: 20px; box-shadow: var(--shadow-card);
}
.m-section { max-width: 1100px; margin: 0 auto; padding: 0 24px 80px; }
.m-section h2 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin-bottom: 8px; }
.plan-card {
  padding: 28px; display: flex; flex-direction: column; gap: 12px; height: 100%;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}
.plan-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-dropdown); }
.plan-price { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; }
.plan-price span { font-size: 14px; font-weight: 500; color: var(--zinc-500); }
.plan-specs { list-style: none; display: flex; flex-direction: column; gap: 8px; color: var(--zinc-600); font-size: 13px; margin: 8px 0 16px; }
.plan-specs li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--zinc-100); padding-bottom: 8px; }

/* Secret field */
.secret {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px;
}
.secret-value { letter-spacing: 0.02em; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--zinc-500); }
.kv dd { font-weight: 500; word-break: break-all; }

/* Toast */
.toast-wrap {
  position: fixed; top: 20px; right: 20px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  min-width: 260px; max-width: 360px; padding: 12px 16px; border-radius: 8px;
  background: var(--zinc-900); color: #fff; font-size: 13px; box-shadow: var(--shadow-modal);
  animation: toast-in 0.35s var(--ease-out);
}
.toast.success { box-shadow: inset 3px 0 0 var(--emerald-500), var(--shadow-modal); }
.toast.error { box-shadow: inset 3px 0 0 var(--rose-500), var(--shadow-modal); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Overlay / dialog */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 80;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.overlay.is-open { display: flex; }
.dialog {
  background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 440px;
  box-shadow: var(--shadow-modal); animation: dialog-in 0.3s var(--ease-cinematic);
}
.dialog-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.dialog-desc { font-size: 13px; color: var(--zinc-500); margin-bottom: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.alert {
  padding: 12px 14px; border-radius: 8px; border: 1px solid var(--zinc-200);
  background: var(--zinc-50); font-size: 13px; margin-bottom: 16px;
}
.alert.warn { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.alert.error { border-color: #fecdd3; background: #fff1f2; color: #9f1239; }
.alert.success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }

.panel-cred {
  border: 1px solid var(--zinc-200); border-radius: 12px; padding: 20px;
  background: linear-gradient(180deg, #fff, var(--zinc-50));
}
.panel-cred h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.panel-cred .note { font-size: 12px; color: var(--zinc-500); margin-bottom: 16px; }

@media (max-width: 960px) {
  .stat-grid, .grid-3, .m-hero { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 20px; }
}


/* ---- Slider captcha ---- */
.slider-captcha { display: flex; flex-direction: column; gap: 8px; width: 260px; max-width: 100%; }
.slider-captcha .slider-stage {
  position: relative; width: 260px; max-width: 100%; height: 90px;
  border: 1px solid var(--zinc-200); border-radius: 8px; overflow: hidden;
  background: var(--zinc-100);
}
.slider-captcha .slider-bg { display: block; user-select: none; -webkit-user-drag: none; }
.slider-captcha .slider-piece {
  position: absolute; top: 30px; left: 0; width: 28px; height: 28px;
  border-radius: 5px; background: #52525b; border: 2px solid #27272a;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35); cursor: grab; touch-action: none;
  transition: box-shadow .15s ease;
}
.slider-captcha .slider-piece:active { cursor: grabbing; }
.slider-captcha.is-verified .slider-piece { border-color: var(--emerald-500); }
.slider-captcha .slider-track {
  position: relative; width: 100%; height: 36px;
  background: var(--zinc-100); border: 1px solid var(--zinc-200);
  border-radius: 8px; overflow: hidden;
}
.slider-captcha .slider-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: rgba(16, 185, 129, 0.18); pointer-events: none;
}
.slider-captcha .slider-handle {
  position: absolute; left: 0; top: 0; width: 44px; height: 100%;
  background: var(--bg-surface); border-right: 1px solid var(--zinc-200);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--zinc-600); cursor: grab; touch-action: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.slider-captcha .slider-handle:active { cursor: grabbing; }
.slider-captcha.is-verified .slider-handle { color: var(--emerald-500); border-right-color: var(--emerald-500); }
.slider-captcha .slider-tip {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 12px; color: var(--zinc-400);
  pointer-events: none; transition: opacity .2s ease;
}
.slider-captcha .slider-state { min-height: 16px; font-size: 12px; line-height: 16px; }
.slider-captcha .slider-state.ok { color: var(--emerald-500); }
.slider-captcha .slider-state.bad { color: var(--rose-600); }
