:root {
  --bg-deep: #0b0e14;
  --bg-surface: #121721;
  --bg-elevated: #19202e;
  --bg-input: #0e131b;
  --border: #252f42;
  --border-focus: #38bdf8;
  --text-main: #f1f5f9;
  --text-sec: #94a3b8;
  --text-muted: #64748b;
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-blue: #38bdf8;
  --danger: #f43f5e;
  --amber: #f59e0b;
  --radius-lg: 14px;
  --radius-md: 10px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: 'Lora', Georgia, serif;
  font-variant-numeric: lining-nums;
  letter-spacing: -0.015em;
}

p { margin: 0; }
a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8em;
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 5px;
}

.hidden { display: none !important; }
.muted { color: var(--text-sec); font-size: 0.875rem; }

/* AUTH LOCK GATE */
.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 15%, rgba(16, 185, 129, 0.12), transparent 55%),
              radial-gradient(circle at 80% 80%, rgba(56, 189, 248, 0.08), transparent 50%),
              var(--bg-deep);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.auth-logo-wrap {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
}

.auth-mark { width: 100%; height: 100%; }

.auth-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 6px;
}

.auth-title {
  font-size: 1.9rem;
  margin-bottom: 8px;
}

.auth-sub {
  font-size: 0.88rem;
  color: var(--text-sec);
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pwd-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pwd-input-wrap input {
  width: 100%;
  padding: 12px 68px 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.95rem;
}

.pwd-eye-btn {
  position: absolute;
  right: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-sec);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
}

.auth-error {
  color: var(--danger);
  font-size: 0.82rem;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
}

.auth-footer {
  margin-top: 22px;
  font-size: 0.82rem;
}

/* MAIN SHELL LAYOUT */
.admin-shell {
  display: grid;
  grid-template-columns: 255px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
}

.brand-title {
  font-family: 'Lora', serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
}

.nav-group-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sec);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-main);
}

.nav-item.active {
  background: rgba(16, 185, 129, 0.13);
  border-color: rgba(16, 185, 129, 0.35);
  color: #fff;
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  text-align: center;
}

.nav-pill {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  background: var(--bg-elevated);
  padding: 2px 7px;
  border-radius: 99px;
  color: var(--text-sec);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-sec);
  padding: 0 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* MAIN AREA & TOPBAR */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 23, 33, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.page-heading {
  font-size: 1.35rem;
}

.sync-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* TAB PANELS */
.tab-panel {
  display: none;
  padding: 26px 28px 60px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  flex-direction: column;
  gap: 22px;
}

.tab-panel.active {
  display: flex;
}

/* CARDS & GRIDS */
.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card.accent-border {
  border-color: var(--accent-blue);
  box-shadow: 0 12px 32px rgba(56, 189, 248, 0.1);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.overview-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.32);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 4px;
}

.banner-actions {
  display: flex;
  gap: 10px;
}

.project-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.proj-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.proj-stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
}

.proj-stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.proj-stat-metric {
  font-family: 'Lora', serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: #fff;
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
}

/* FORMS & INPUTS */
.form-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.field-span-2 { grid-column: 1 / -1; }
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sec);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
}

input[type="color"] {
  width: 100%;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  padding: 3px;
  cursor: pointer;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none !important;
}

.btn-primary {
  background: var(--accent);
  color: #041f16;
}
.btn-primary:hover { background: #34d399; }

.btn-secondary {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent-blue);
}
.btn-secondary:hover { background: rgba(56, 189, 248, 0.25); }

.btn-danger {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fb7185;
}
.btn-danger:hover { background: rgba(244, 63, 94, 0.25); }

.btn-ghost {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-sec);
}
.btn-ghost:hover {
  border-color: var(--text-sec);
  color: var(--text-main);
}

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-xs { padding: 4px 9px; font-size: 0.73rem; border-radius: 7px; }
.btn-full { width: 100%; }

.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.mono-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-sec);
  border: 1px solid var(--border);
}

/* BULK BAR & FILTER PILLS */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.pills-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-sec);
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.pill-btn.active {
  background: var(--text-main);
  color: var(--bg-deep);
  border-color: var(--text-main);
}

.search-input {
  min-width: 230px;
}

/* STORE ADMIN PRODUCT GRID */
.store-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 16px;
}

.store-prod-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.store-prod-card.is-hidden {
  opacity: 0.52;
}

.store-prod-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #000;
}

.store-prod-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.store-prod-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #34d399;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 99px;
}

.store-prod-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.store-prod-title {
  font-weight: 700;
  font-size: 0.94rem;
}

.inline-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-price-row span {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--accent);
}

.inline-price-input {
  width: 105px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

/* NEWS ADMIN LIST */
.news-admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.news-admin-row {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.news-admin-row.is-pinned {
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.07);
}

.news-admin-info {
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.news-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
}

.tag-yang {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  padding: 2px 8px;
  border-radius: 99px;
}

.tag-yin {
  background: rgba(244, 63, 94, 0.16);
  color: #fb7185;
  padding: 2px 8px;
  border-radius: 99px;
}

.tag-pin {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  padding: 2px 8px;
  border-radius: 99px;
}

.news-row-title {
  font-family: 'Lora', serif;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
}

/* QUICK ACTIONS & AUDIT LOG */
.quick-actions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-action-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.15s ease;
}

.quick-action-btn:hover {
  border-color: var(--accent);
}

.quick-action-btn span {
  font-size: 0.78rem;
  color: var(--text-sec);
}

.audit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 310px;
  overflow-y: auto;
}

.audit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 0.8rem;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-sec);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.resource-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resource-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 0.83rem;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.78);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  width: 100%;
  max-width: 640px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
}

.modal-head, .modal-foot {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-foot {
  border-bottom: none;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
  gap: 10px;
}

.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 75vh;
  overflow-y: auto;
}

.pm-preview-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: center;
}

.pm-preview-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.pm-preview-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* TABLE */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  color: var(--text-sec);
  font-size: 0.75rem;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #10b981;
  color: #041f16;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.22s ease;
  z-index: 200;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; }
  .pm-preview-row { grid-template-columns: 1fr; }
}
