:root {
  --bg: #091321;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-muted: #f4f7fb;
  --panel-strong: #ffffff;
  --text: #122033;
  --muted: #6f7c8f;
  --line: #e3ebf5;
  --primary: #285f98;
  --primary-dark: #1d4b7b;
  --success: #1f9d63;
  --danger: #d84d4d;
  --warning: #9b6400;
  --shadow: 0 24px 80px rgba(12, 21, 38, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Rubik", system-ui, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(40, 95, 152, 0.18), transparent 28%),
    linear-gradient(180deg, #eef4fb 0%, #f9fbfd 100%);
  color: var(--text);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.panel,
.stat-card {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(480px, 100%);
  border-radius: 28px;
  padding: 32px;
}

.login-card h1 {
  margin: 18px 0 12px;
  font-size: 28px;
}

.login-hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #0f1a30 0%, #12213a 100%);
  color: #fff;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-badge {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2f75ba 0%, #1a4270 100%);
  color: #fff;
  box-shadow: 0 18px 38px rgba(8, 25, 48, 0.24);
  overflow: hidden;
}

.brand-icon,
.nav-icon,
.header-pill-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.brand-icon {
  width: 24px;
  height: 24px;
}

.brand-logo-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle,
.sidebar-footer-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  padding: 14px 16px;
  border-radius: 16px;
  transition: 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-links a.active,
.nav-links a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

.nav-logout {
  margin-top: 8px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-footer-value {
  margin-top: 8px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.content {
  padding: 30px;
  min-width: 0;
}

body.admin-mobile-nav-open {
  overflow: hidden;
}

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

.content-header-primary {
  display: flex;
  align-items: center;
  gap: 14px;
}

.content-header h1 {
  margin: 6px 0 0;
  font-size: 32px;
}

.page-eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.header-admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(16, 39, 70, 0.06);
}

.mobile-nav-toggle,
.sidebar-backdrop {
  display: none;
}

.header-admin-pill strong,
.header-admin-pill span {
  display: block;
}

.header-admin-pill strong {
  font-size: 14px;
}

.header-admin-pill span {
  color: var(--muted);
  font-size: 12px;
}

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

.stat-card {
  border-radius: var(--radius);
  padding: 22px;
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
}

.stat-value {
  margin-top: 12px;
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
}

.panel {
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
}

.panel-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.panel-copy {
  color: var(--muted);
  line-height: 1.8;
  margin: 0;
}

.toolbar,
.action-row,
.stack,
.inline-actions,
.media-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stack {
  flex-direction: column;
}

.stacked-form {
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toolbar input,
.toolbar select,
.field input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.table input,
.table select,
.table textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-muted);
  font: inherit;
  color: var(--text);
}

.table input,
.table select,
.table textarea {
  margin-top: 8px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-grid .action-row {
  grid-column: 1 / -1;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 12px 26px rgba(40, 95, 152, 0.24);
}

.btn-secondary {
  background: #e7eef6;
  color: var(--primary);
}

.btn-ghost {
  background: #f7fafc;
  color: var(--text);
  border: 1px solid var(--line);
}

.alert {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
}

.alert-danger {
  background: rgba(216, 77, 77, 0.08);
  color: var(--danger);
}

.alert-success {
  background: rgba(31, 157, 99, 0.08);
  color: var(--success);
}

.table-panel {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.table th,
.table td {
  text-align: right;
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.table a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}

.pill-success {
  background: rgba(31, 157, 99, 0.12);
  color: var(--success);
}

.pill-danger {
  background: rgba(216, 77, 77, 0.12);
  color: var(--danger);
}

.pill-warning {
  background: rgba(255, 174, 0, 0.16);
  color: var(--warning);
}

.muted-copy {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  padding: 18px;
  border-radius: 18px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
}

.metric-title {
  color: var(--muted);
  font-size: 13px;
}

.metric-copy {
  margin-top: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.section-heading {
  margin: 0 0 14px;
  font-size: 18px;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.span-2 {
  grid-column: 1 / -1;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
}

.checkbox-card input {
  width: auto;
  margin: 0;
}

.code-chip {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  font-weight: 600;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.attachment-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  padding: 12px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.attachment-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
}

.attachment-name {
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.media-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media-thumb-link {
  display: inline-flex;
  width: fit-content;
}

.media-thumb,
.table-media-thumb {
  display: block;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--panel-muted);
}

.media-thumb {
  width: 120px;
  height: 120px;
}

.table-media-thumb {
  width: 64px;
  height: 64px;
}

.media-thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 64px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--panel-muted);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
}

.admin-audio-preview {
  width: 220px;
  max-width: 100%;
  height: 36px;
}

.gift-create-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gift-create-grid .span-2 {
  grid-column: span 2;
}

.file-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

@media (max-width: 1280px) {
  .stats-grid,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .admin-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(88vw, 320px);
    min-height: 100vh;
    gap: 18px;
    z-index: 120;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
  }

  .admin-mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100;
    border: 0;
    background: rgba(7, 16, 29, 0.54);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .admin-mobile-nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel-strong);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(16, 39, 70, 0.06);
  }

  .content {
    padding: 16px;
  }

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

  .content-header-primary {
    align-items: flex-start;
  }

  .detail-grid,
  .metric-grid,
  .stats-grid,
  .form-grid,
  .gift-create-grid,
  .checkbox-grid,
  .attachment-grid {
    grid-template-columns: 1fr;
  }

  .gift-create-grid .span-2 {
    grid-column: 1 / -1;
  }

  .toolbar,
  .action-row,
  .inline-actions,
  .media-inline {
    flex-direction: column;
  }

  .header-admin-pill {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-links a {
    padding: 13px 14px;
  }

  .panel,
  .stat-card,
  .login-card {
    padding: 18px;
    border-radius: 20px;
  }

  .content-header h1 {
    font-size: 26px;
  }

  .stat-value {
    font-size: 30px;
  }

  .table th,
  .table td {
    padding: 14px 10px;
  }
}

@media (max-width: 560px) {
  .login-page {
    padding: 14px;
  }

  .login-card h1 {
    font-size: 24px;
  }

  .brand-badge {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-subtitle,
  .sidebar-footer-label,
  .login-hint,
  .page-eyebrow {
    font-size: 12px;
  }

  .panel-title,
  .section-heading {
    font-size: 17px;
  }

  .content-header h1 {
    font-size: 22px;
  }

  .stat-value,
  .metric-copy {
    font-size: 24px;
  }

  .btn {
    width: 100%;
  }

  .table {
    min-width: 680px;
  }

  .table-media-thumb {
    width: 56px;
    height: 56px;
  }
}
