/* ============================================================
   Noctysphy Admin Console — Blue/White Tech (shared tokens)
   ============================================================ */
:root {
  --primary: #1668dc;
  --primary-strong: #0f5bd0;
  --primary-deep: #0b3d91;
  --accent: #00b8d4;
  --bg: #f3f7fe;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --ink: #0a1f44;
  --ink-2: #33507e;
  --ink-3: #7189b0;
  --line: rgba(22, 104, 220, 0.14);
  --line-soft: rgba(22, 104, 220, 0.07);
  --glow: rgba(22, 104, 220, 0.22);
  --grad-primary: linear-gradient(135deg, #3d9bff 0%, #1668dc 55%, #0b3d91 100%);
  --shadow-sm: 0 2px 10px rgba(11, 61, 145, 0.06);
  --shadow-md: 0 8px 30px rgba(11, 61, 145, 0.1);
  --shadow-lg: 0 24px 60px rgba(11, 61, 145, 0.16);
  --shadow-glow: 0 8px 30px rgba(22, 104, 220, 0.28);
  --font-sans: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Code", Consolas, monospace;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
.hidden { display: none !important; }
.icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 24px; border-radius: var(--r-md); font-size: 14px; font-weight: 600; letter-spacing: 0.03em; transition: all 0.25s ease; white-space: nowrap; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: var(--grad-primary); color: #fff; box-shadow: var(--shadow-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(22, 104, 220, 0.36); }
.btn-primary:disabled { opacity: 0.6; transform: none; cursor: not-allowed; }
.btn-ghost { border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); }
.btn-ghost:hover { border-color: rgba(22, 104, 220, 0.45); color: var(--primary); }
.btn-danger { background: #fff1f0; color: #d4380d; border: 1px solid #ffccc7; }
.btn-danger:hover { background: #ffccc7; }
.btn-sm { padding: 7px 15px; font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); transition: all 0.2s; }
.icon-btn:hover { color: var(--primary); background: rgba(22, 104, 220, 0.07); }
.icon-btn.danger:hover { color: #d4380d; background: #fff1f0; }

/* ---------- login ---------- */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; }
.login-bg-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(22,104,220,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(22,104,220,0.05) 1px, transparent 1px); background-size: 40px 40px; -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, #000, transparent); mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, #000, transparent); }
.login-card { position: relative; width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 44px 40px; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; }
.brand-mark { width: 44px; height: 44px; border-radius: 13px; background: var(--grad-primary); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-glow); }
.brand-mark .icon { width: 23px; height: 23px; }
.login-title { font-size: 19px; font-weight: 800; letter-spacing: 0.06em; }
.login-sub { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.26em; color: var(--ink-3); margin-top: 2px; }
.field { display: block; margin-bottom: 20px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.field input, .field textarea, .field select { width: 100%; padding: 11px 15px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-soft); font-size: 14.5px; outline: none; transition: border-color 0.25s, box-shadow 0.25s; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22, 104, 220, 0.12); background: #fff; }
.field textarea { resize: vertical; min-height: 110px; line-height: 1.8; }
.field-hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.form-error { color: #d4380d; font-size: 13px; min-height: 20px; margin-bottom: 10px; }
.login-back { display: block; text-align: center; margin-top: 22px; font-size: 13px; color: var(--ink-3); transition: color 0.2s; }
.login-back:hover { color: var(--primary); }

/* ---------- shell ---------- */
.admin-app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid var(--line-soft); }
.sb-name { font-weight: 800; font-size: 15px; letter-spacing: 0.05em; }
.sb-sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.24em; color: var(--ink-3); margin-top: 1px; }
.side-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: var(--r-sm); font-size: 14px; color: var(--ink-2); transition: all 0.22s; }
.side-nav a:hover { background: rgba(22, 104, 220, 0.06); color: var(--primary); }
.side-nav a.active { background: rgba(22, 104, 220, 0.1); color: var(--primary); font-weight: 700; }
.sidebar-foot { padding: 14px 12px; border-top: 1px solid var(--line-soft); }
.side-link { display: flex; align-items: center; gap: 9px; padding: 9px 14px; font-size: 13px; color: var(--ink-3); border-radius: var(--r-sm); transition: all 0.2s; }
.side-link:hover { color: var(--primary); background: rgba(22, 104, 220, 0.06); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 32px; height: 64px; background: var(--surface-blur, rgba(255,255,255,0.86)); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line-soft); }
.topbar-title { font-size: 18px; font-weight: 800; letter-spacing: 0.03em; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); background: var(--surface-soft); border: 1px solid var(--line-soft); padding: 6px 14px; border-radius: 100px; }
.admin-view { padding: 32px; flex: 1; }

/* ---------- dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 24px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm); }
.stat-card::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad-primary); opacity: 0.85; }
.stat-card .sc-icon { width: 42px; height: 42px; border-radius: 12px; background: rgba(22, 104, 220, 0.08); color: var(--primary); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.stat-card b { display: block; font-size: 28px; font-weight: 800; color: var(--primary-deep); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-card span { font-size: 12.5px; color: var(--ink-3); letter-spacing: 0.06em; }
.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
.panel-head h3 { font-size: 15.5px; font-weight: 700; }
.panel-body { padding: 22px; }
.panel-body.tight { padding: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 12px; letter-spacing: 0.1em; color: var(--ink-3); font-weight: 600; padding: 13px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-soft); }
.data-table td { padding: 13px 18px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(22, 104, 220, 0.03); }
.td-cover { width: 56px; }
.td-cover img { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: var(--bg); }
.td-title { font-weight: 600; }
.td-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }
.td-actions .icon-btn { width: 32px; height: 32px; }
.td-actions .icon-btn .icon { width: 16px; height: 16px; }
.mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 3px 11px; border-radius: 100px; font-weight: 600; letter-spacing: 0.04em; }
.badge-green { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.badge-grey { background: #f5f5f5; color: #8c8c8c; border: 1px solid #e8e8e8; }
.badge-blue { background: rgba(22, 104, 220, 0.08); color: var(--primary); border: 1px solid rgba(22, 104, 220, 0.2); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar-left { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filter-select { padding: 9px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; outline: none; }
.filter-select:focus { border-color: var(--primary); }

/* ---------- upload zone ---------- */
.upload-zone { border: 2px dashed rgba(22, 104, 220, 0.3); border-radius: var(--r-md); padding: 34px 24px; text-align: center; color: var(--ink-3); background: var(--surface-soft); transition: all 0.25s; cursor: pointer; margin-bottom: 22px; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: rgba(22, 104, 220, 0.05); color: var(--primary); }
.upload-zone .uz-icon { width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 14px; background: rgba(22, 104, 220, 0.09); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.upload-zone p { font-size: 14px; }
.upload-zone .uz-hint { font-size: 12px; margin-top: 6px; color: var(--ink-3); }
.upload-progress { height: 6px; border-radius: 4px; background: var(--line-soft); overflow: hidden; margin-top: 14px; display: none; }
.upload-progress.show { display: block; }
.upload-progress div { height: 100%; width: 0%; background: var(--grad-primary); border-radius: 4px; transition: width 0.2s; }
.file-chosen { font-size: 13px; color: var(--primary); margin-top: 10px; }

/* ---------- modal ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10, 31, 68, 0.42); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-box { width: min(560px, 100%); max-height: 90vh; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateY(14px) scale(0.98); transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.modal-overlay.open .modal-box { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 26px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { font-size: 17px; font-weight: 800; }
.modal-body { padding: 26px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 18px 26px; border-top: 1px solid var(--line-soft); }
.cover-preview { width: 100%; aspect-ratio: 1; max-width: 240px; border-radius: var(--r-md); overflow: hidden; background: var(--bg); border: 1px solid var(--line-soft); margin-bottom: 14px; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview .empty-cover { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--ink-3); }

/* ---------- misc ---------- */
.empty-row td { text-align: center; color: var(--ink-3); padding: 44px 0 !important; font-size: 13.5px; }
.toast { position: fixed; left: 50%; bottom: 32px; z-index: 200; transform: translate(-50%, 16px); opacity: 0; background: var(--ink); color: #fff; font-size: 13.5px; padding: 11px 22px; border-radius: 100px; box-shadow: var(--shadow-lg); transition: all 0.3s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink-2); padding: 4px 0; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--primary); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.settings-grid .field.full { grid-column: 1 / -1; }
.loading-pulse { text-align: center; color: var(--ink-3); padding: 60px 0; font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .admin-app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; width: 236px; transform: translateX(-105%); transition: transform 0.3s; }
  .sidebar.open { transform: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row, .settings-grid { grid-template-columns: 1fr; }
  .admin-view { padding: 20px; }
  .topbar { padding: 0 20px; }
}
