:root {
  --background: #f4f7fb;
  --foreground: #1a3239;
  --muted: #53727f;
  --muted-bg: #edf4f8;
  --card: rgba(255, 255, 255, 0.86);
  --card-foreground: #1a3239;
  --border: rgba(26, 50, 57, 0.12);
  --input: rgba(26, 50, 57, 0.16);
  --primary: #213349;
  --primary-foreground: #fdfaf6;
  --secondary: #e7d5c2;
  --secondary-foreground: #213349;
  --accent: #1181c8;
  --accent-foreground: #f5fbff;
  --accent-soft: rgba(17, 129, 200, 0.12);
  --ring: rgba(17, 129, 200, 0.18);
  --success: #0f766e;
  --danger: #b42318;
  --warning: #b26b16;
  --radius: 1.1rem;
  --shadow: 0 18px 40px rgba(33, 51, 73, 0.08);
  --shadow-lg: 0 26px 70px rgba(17, 129, 200, 0.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(17, 129, 200, 0.18), transparent 24%),
    linear-gradient(180deg, #f0f6fa 0%, #f8fbfd 220px, #f4f7fb 100%);
  color: var(--foreground);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
.container, .page-shell { width: min(1200px, calc(100% - 32px)); margin: 0 auto; }
.page-noise {
  position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image:
    linear-gradient(rgba(33, 51, 73, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 51, 73, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at center, black 28%, transparent 80%);
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid rgba(26, 50, 57, 0.08);
  background: rgba(248, 251, 253, 0.8);
  backdrop-filter: blur(16px);
}
.topbar-inner { display:flex; align-items:center; justify-content:space-between; gap:16px; min-height: 76px; }
.brand { display:flex; align-items:center; gap:14px; font-weight: 700; }
.brand-logo {
  width: 172px; max-width: 42vw; height: auto; filter: drop-shadow(0 10px 24px rgba(33, 51, 73, 0.08));
  flex-shrink: 0;
}
.brand-logo-admin { width: 128px; }
.brand-copy-inline { min-width: 0; }
.brand-copy-inline small { letter-spacing: 0.06em; text-transform: uppercase; }
.brand-copy { line-height: 1.2; }
.brand-copy small { display:block; color:var(--muted); font-weight:500; margin-top:2px; }
.nav-links { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.nav-link {
  padding: 10px 14px; border-radius: 999px; color: var(--muted); font-weight: 700;
  border: 1px solid transparent;
}
.nav-link.active, .nav-link:hover { background: rgba(231, 213, 194, 0.52); border-color: rgba(33, 51, 73, 0.08); color: var(--foreground); }
.hero { padding: 46px 0 24px; }
.hero-home { padding-top: 54px; }
.hero-card, .card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.72);
  border-radius: calc(var(--radius) + 8px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.hero-card { padding: 34px; }
.hero-grid { display:grid; grid-template-columns: 1.15fr .85fr; gap: 28px; }
.eyebrow {
  display:inline-flex; align-items:center; gap:8px; padding: 7px 12px;
  background: rgba(231, 213, 194, 0.6); color: var(--primary); border-radius:999px; font-size:12px; font-weight:800;
  border: 1px solid rgba(33, 51, 73, 0.08);
}
.hero h1, .page-title { margin: 14px 0 12px; font-size: clamp(2rem, 5vw, 3.3rem); line-height: 1.05; letter-spacing: -0.03em; }
.hero p.lead { margin: 0; color: var(--muted); font-size: 1.05rem; max-width: 60ch; }
.hero-panel { position: relative; min-height: 280px; display:grid; place-items:center; }
.hero-orbit {
  position:absolute; inset: 18px 0 auto auto; width: 260px; height:260px; border-radius:50%;
  background: radial-gradient(circle, rgba(17,129,200,0.24), rgba(17,129,200,0.04) 50%, transparent 68%);
  filter: blur(6px);
}
.hero-panel-card { position:relative; overflow:hidden; width:min(100%, 390px); min-height: 250px; background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(235,245,251,.86)); }
.grid-lines {
  position:absolute; inset:0; pointer-events:none;
  background-image:
    linear-gradient(rgba(17, 129, 200, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 129, 200, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.75), transparent 92%);
}
.hero-metrics, .hero-stats { display:grid; gap: 12px; }
.hero-metrics { margin-top: 18px; position:relative; z-index:1; }
.metric-card, .stat-tile {
  padding: 18px; background: rgba(255,255,255,.72); border-radius: 20px; border:1px solid rgba(26, 50, 57, 0.08);
}
.metric-card strong, .stat-tile strong { display:block; font-size: 1.35rem; margin-bottom: 4px; }
.metric-card span, .stat-tile span { color: var(--muted); font-size: 14px; }
.metric-accent { background: linear-gradient(135deg, rgba(17,129,200,.14), rgba(231,213,194,.52)); }
.section { padding: 18px 0 28px; }
.section-head { display:flex; align-items:end; justify-content:space-between; gap:16px; margin-bottom: 18px; }
.section-head h2 { margin:0; font-size:1.42rem; letter-spacing: -0.02em; }
.section-head p { margin:6px 0 0; color:var(--muted); }
.area-grid, .stats-grid, .script-grid, .detail-grid, .dashboard-cards, .feature-grid {
  display:grid; gap:16px;
}
.area-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stats-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.feature-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.script-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items:start; }
.detail-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items:start; }
.dashboard-cards { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.surface {
  background: var(--card);
  border:1px solid rgba(255,255,255,.74);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.surface.pad { padding: 20px; }
.inset-panel { background: linear-gradient(180deg, rgba(17,129,200,.06), rgba(255,255,255,.74)); border: 1px solid rgba(17,129,200,.12); }
.node-card, .post-card {
  display:flex; flex-direction:column; gap:14px; padding:20px; transition:.2s ease;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(245,250,252,.96));
}
.node-card:hover, .post-card:hover, .surface.hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tech-card { position: relative; overflow:hidden; }
.tech-card::after {
  content:""; position:absolute; inset:auto -20% -45% auto; width:160px; height:160px; border-radius:50%;
  background: radial-gradient(circle, rgba(17,129,200,.16), transparent 70%);
}
.node-card-top, .row-between { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.badge, .pill {
  display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border-radius:999px;
  border:1px solid rgba(26, 50, 57, 0.08); background:rgba(255,255,255,.74); color:var(--secondary-foreground); font-size:12px; font-weight:800;
}
.badge.primary { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.badge.success { background: rgba(15, 118, 110, .1); color: var(--success); border-color: rgba(15, 118, 110, .16); }
.badge.warning { background: rgba(178, 107, 22, .1); color: var(--warning); border-color: rgba(178, 107, 22, .18); }
.muted { color: var(--muted); }
.prose { color: var(--foreground); }
.prose p:first-child { margin-top: 0; }
.prose img { border-radius: 18px; margin: 16px 0; }
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px; border-radius: 12px; border:1px solid var(--border);
  padding: 10px 14px; cursor:pointer; transition: .15s ease; font-weight: 800; background: rgba(255,255,255,.76); color: var(--foreground);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: var(--primary-foreground); border-color: transparent; }
.btn-secondary { background: rgba(231, 213, 194, 0.52); color: var(--secondary-foreground); border-color: rgba(33, 51, 73, 0.08); }
.btn-danger { background: #fff1f2; color: var(--danger); border-color: #fecdd3; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 12px; border-radius: 10px; font-size: 14px; }
.btn-full { width:100%; }
.table-wrap { overflow:auto; border:1px solid rgba(26, 50, 57, 0.08); border-radius: 18px; }
table { width:100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom:1px solid rgba(26, 50, 57, 0.08); text-align:left; vertical-align: top; }
th { font-size: 13px; color: var(--muted); background: rgba(231, 213, 194, 0.22); }
tr:last-child td { border-bottom: 0; }
.table-row-link { cursor:pointer; }
.table-row-link:hover { background: rgba(17,129,200,.04); }
.form-grid { display:grid; gap:16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-group { display:grid; gap:8px; }
.label { font-weight: 800; font-size: 14px; }
.input, .textarea, .select {
  width:100%; border:1px solid var(--input); background:rgba(255,255,255,.88); color:var(--foreground);
  border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}
.textarea { min-height: 140px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: rgba(17, 129, 200, 0.36); box-shadow: 0 0 0 4px var(--ring);
}
.checkbox-list { display:flex; flex-wrap:wrap; gap:10px; }
.check-chip {
  display:inline-flex; align-items:center; gap:8px; border:1px solid var(--border); background:#fff; padding: 8px 12px; border-radius: 999px;
}
.page-actions, .toolbar, .stack { display:flex; gap:12px; flex-wrap:wrap; align-items:center; }
.sidebar-card { position: sticky; top: 92px; }
.empty { padding: 28px; text-align:center; color:var(--muted); }
.footer { padding: 30px 0 44px; color: var(--muted); }
.footer-grid { display:flex; justify-content:space-between; align-items:flex-start; gap: 20px; flex-wrap: wrap; }
.footer-brand { display:flex; align-items:center; gap:14px; }
.footer-logo { width: 148px; }
.footer-meta { display:grid; gap: 6px; text-align:right; }
.kicker { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.feature-card { min-height: 180px; background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(247, 251, 253, .96)); }
.feature-index { display:inline-flex; padding: 5px 10px; border-radius:999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }
.feature-card h3 { margin: 16px 0 8px; font-size: 1.15rem; }
.admin-shell { display:grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.admin-sidebar {
  border-right: 1px solid rgba(26, 50, 57, 0.08); background: rgba(248, 251, 253, 0.82); backdrop-filter: blur(16px); padding: 24px 18px; position: sticky; top:0; height:100vh; overflow:auto;
}
.admin-main { padding: 24px; }
.admin-brand { display:flex; align-items:center; gap:12px; margin-bottom: 22px; }
.admin-nav { display:grid; gap:8px; }
.admin-nav a {
  padding: 12px 14px; border-radius: 14px; color: var(--muted); font-weight: 800; border:1px solid transparent;
}
.admin-nav a.active, .admin-nav a:hover { background: rgba(231, 213, 194, 0.52); border-color: rgba(33, 51, 73, 0.08); color: var(--foreground); }
.admin-topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom: 22px; }
.stat-card { padding: 20px; }
.stat-card .title { color: var(--muted); font-size: 14px; }
.stat-card .value { font-size: 2rem; font-weight: 800; margin-top: 8px; }
.flash-stack { display:grid; gap:12px; margin-bottom: 16px; }
.alert {
  padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(26, 50, 57, 0.08); background: rgba(255,255,255,.82); box-shadow: var(--shadow);
}
.alert-danger { border-color: #fecaca; background: #fff5f5; color: #991b1b; }
.alert-success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.alert-warning { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.pagination { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top: 18px; flex-wrap:wrap; }
.tabs { display:flex; gap:10px; flex-wrap:wrap; }
.search-bar {
  display:flex; gap:10px; align-items:center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.8);
}
.search-bar input { border: none; outline: none; width: 100%; background: transparent; }
.login-shell { min-height: 100vh; display:grid; place-items:center; padding: 28px; }
.login-grid { width:min(1040px, 100%); display:grid; grid-template-columns: 1.1fr .9fr; gap: 24px; }
.login-art { padding: 30px; min-height: 480px; background: linear-gradient(135deg, #1a3239 0%, #213349 55%, #1181c8 100%); color: white; }
.login-form { padding: 30px; }
.help-list { display:grid; gap: 14px; margin-top: 24px; }
.help-list .surface { padding: 18px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); border-color: rgba(255,255,255,.12); box-shadow:none; }
.hero-detail-shell { background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(243,248,252,.95)); }

.node-stack { align-items: stretch; }
.node-module { width: min(1120px, 100%); margin: 0 auto; }
@media (max-width: 980px) {
  .stats-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid, .script-grid, .detail-grid, .login-grid { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-card { position: static; }
  .footer-meta { text-align:left; }
}
@media (max-width: 640px) {
  .stats-grid-4 { grid-template-columns: 1fr; }
  .hero-card, .surface.pad, .node-card, .post-card, .login-art, .login-form { padding: 20px; }
  .form-grid.two { grid-template-columns: 1fr; }
  .topbar-inner, .admin-topbar, .hero-detail-head { align-items:flex-start; flex-direction:column; }
  .page-shell, .container { width:min(100% - 20px, 1200px); }
  .brand-logo { width: 124px; }
}
