:root {
  --navy: #0b1f3a;
  --navy-2: #102b4d;
  --gold: #c99a3d;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #6c7688;
  --line: #e6eaf0;
  --danger: #c0392b;
  --success: #1f8f5f;
  --shadow: 0 18px 50px rgba(11, 31, 58, .10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(201,154,61,.22), transparent 32%),
    radial-gradient(circle at 80% 80%, rgba(16,43,77,.18), transparent 34%),
    linear-gradient(135deg, #f8fafc, #eef3f8);
}

.login-card {
  width: min(460px, 100%);
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 28px;
  padding: 34px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: var(--gold);
  font-weight: 900;
  letter-spacing: .08em;
  box-shadow: 0 12px 30px rgba(11,31,58,.22);
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 13px;
}

.eyebrow {
  margin: 18px 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, h3 {
  margin: 0;
  color: var(--navy);
}

h1 {
  font-size: 36px;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 20px;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.form-stack {
  margin-top: 28px;
  display: grid;
  gap: 12px;
}

label {
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  color: var(--text);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(201,154,61,.9);
  box-shadow: 0 0 0 4px rgba(201,154,61,.13);
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 900;
  cursor: pointer;
  transition: .18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  box-shadow: 0 10px 24px rgba(11,31,58,.18);
}

.btn.ghost {
  color: var(--navy);
  background: #edf1f6;
}

.btn.full {
  width: 100%;
  margin-top: 8px;
}

.error-text {
  min-height: 18px;
  color: var(--danger);
  font-weight: 700;
  margin: 0;
}

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: var(--navy);
  color: #fff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.side-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.side-brand span {
  display: block;
  color: rgba(255,255,255,.62);
  font-size: 12px;
  margin-top: 3px;
}

nav {
  display: grid;
  gap: 10px;
}

.nav-item {
  text-align: left;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 13px 14px;
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.78);
  font-weight: 800;
  cursor: pointer;
}

.nav-item.active {
  background: #fff;
  color: var(--navy);
}

.user-box {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  background: rgba(255,255,255,.06);
}

.user-box span, .user-box small {
  display: block;
}

.user-box small {
  color: rgba(255,255,255,.65);
  margin: 4px 0 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.main {
  padding: 28px;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar .eyebrow {
  margin: 0 0 6px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(11,31,58,.05);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 30px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 10px 28px rgba(11,31,58,.05);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.search {
  max-width: 380px;
}

.archive-list {
  display: grid;
  gap: 12px;
}

.archive-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  background: #fff;
}

.archive-card h4 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 16px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  background: #eef2f7;
  color: #344054;
}

.badge.gold {
  background: rgba(201,154,61,.14);
  color: #8a641d;
}

.badge.green {
  background: rgba(31,143,95,.12);
  color: var(--success);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  background: #fafbfc;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.full-row {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel-head {
    flex-direction: column;
  }

  .search {
    max-width: none;
  }

  .upload-grid {
    grid-template-columns: 1fr;
  }

  .archive-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .main {
    padding: 18px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}

.category-box {
  display: grid;
  gap: 8px;
}

.side-label {
  margin: 4px 0 2px;
  color: rgba(255,255,255,.58);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.cat-item {
  text-align: left;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: rgba(255,255,255,.72);
  font-weight: 800;
  cursor: pointer;
}

.cat-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.cat-item.active {
  background: rgba(201,154,61,.18);
  color: #f6d28a;
  border-color: rgba(201,154,61,.28);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 18, 35, .66);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(1100px, 100%);
  max-height: 90vh;
  overflow: hidden;
  background: #fff;
  border-radius: 26px;
  box-shadow: 0 24px 80px rgba(0,0,0,.24);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

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

.modal-head .eyebrow {
  margin: 0 0 6px;
}

.preview-body {
  min-height: 520px;
  background: #f8fafc;
  overflow: auto;
  padding: 18px;
}

.preview-body iframe {
  width: 100%;
  height: 68vh;
  border: 0;
  border-radius: 16px;
  background: #fff;
}

.preview-body img {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  margin: 0 auto;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(11,31,58,.12);
}

.preview-note {
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.modal-actions {
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .category-box {
    grid-template-columns: 1fr 1fr;
  }

  .modal {
    padding: 12px;
  }

  .preview-body {
    min-height: 420px;
  }
}
