@import 'tailwindcss';
@import './themes.css';
@import './components.css';
@config '../../tailwind.config.js';
@source '../../src/views/**/*.ejs';
@source '../../public/admin/js/**/*.js';

:root {
  color-scheme: light;
  --admin-bg: #f4f6fb;
  --admin-surface: #ffffff;
  --admin-text: #202b43;
  --admin-muted: #657188;
  --admin-line: #dde3ef;
  --admin-primary: #4b46cf;
  --admin-soft: #eeedff;
  --admin-shadow: 0 18px 60px rgb(27 36 69 / 9%);
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --admin-bg: #101726;
  --admin-surface: #182236;
  --admin-text: #e6ecf9;
  --admin-muted: #a9b6cd;
  --admin-line: #303d55;
  --admin-primary: #a09cff;
  --admin-soft: #2d2b51;
  --admin-shadow: 0 18px 60px rgb(0 0 0 / 20%);
}

@layer base {
  html {
    min-height: 100%;
    background: var(--admin-bg);
    font-family: var(--font-sans);
    text-rendering: optimizeLegibility;
  }

  body {
    min-width: 320px;
    min-height: 100dvh;
    margin: 0;
    color: var(--admin-text);
    background: var(--admin-bg);
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
  }
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
a {
  color: var(--admin-primary);
  text-decoration: none;
}
:focus-visible {
  outline: 3px solid #7c80fa;
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(1.7rem, 2.5vw, 2.25rem);
  line-height: 1.2;
  font-weight: 720;
  letter-spacing: -0.045em;
}
h2 {
  font-size: 1.35rem;
  font-weight: 680;
  letter-spacing: -0.025em;
}
h3 {
  font-size: 1rem;
  font-weight: 650;
}
.muted {
  color: var(--admin-muted);
}
.eyebrow {
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  color: var(--admin-primary);
  margin-bottom: 0.8rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: -80px;
  left: 1rem;
  z-index: 100;
  background: var(--admin-surface);
  padding: 1rem;
}
.skip-link:focus {
  top: 1rem;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  font-weight: 650;
  border: 1px solid transparent;
  border-radius: 9px;
  white-space: nowrap;
}
.button.primary {
  color: #fff;
  background: #4b46cf;
  border-color: #4b46cf;
  box-shadow: 0 3px 8px rgb(75 70 207 / 12%);
}
.button.primary:hover {
  background: #3d38b5;
}
.button.secondary {
  background: var(--admin-surface);
  border-color: var(--admin-line);
  color: var(--admin-text);
}
.button.quiet {
  color: var(--admin-primary);
  background: transparent;
}
.button.secondary:hover,
.button.quiet:hover {
  background: var(--admin-soft);
}
.full-width {
  width: 100%;
}
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.admin-layout {
  display: flex;
  min-height: 100dvh;
}
.sidebar {
  width: 244px;
  flex: 0 0 244px;
  background: #151d35;
  color: #bec8df;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  color: #f8faff;
  padding: 1.6rem 1.3rem 1.8rem;
}
.brand strong {
  display: block;
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.brand small {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.19em;
  color: #98a8ce;
  margin-top: 0.2rem;
}
.brand-mark {
  height: 38px;
  width: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  background: #7771f8;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 800;
}
.side-navigation {
  overflow-y: auto;
  padding: 0 0.8rem 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: #465278 transparent;
  flex: 1;
}
.nav-group {
  margin-bottom: 1.25rem;
}
.nav-group-label {
  text-transform: uppercase;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  font-weight: 700;
  color: #8f9cbd;
  padding: 0.5rem 0.75rem;
}
.nav-group a {
  color: #bac5e0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
  min-height: 42px;
  margin-top: 3px;
}
.nav-group a:hover {
  background: #202a46;
  color: #fff;
}
.nav-group a[aria-current='page'] {
  background: #7771f8;
  color: #fff;
  font-weight: 650;
}
.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.8;
}
.sidebar-footer {
  padding: 1.2rem 1.5rem;
  font-size: 0.7rem;
  color: #8f9cbd;
  border-top: 1px solid #29334e;
}
.workspace {
  margin-left: 244px;
  width: calc(100% - 244px);
  min-width: 0;
}
.topbar {
  min-height: 76px;
  border-bottom: 1px solid var(--admin-line);
  background: var(--admin-surface);
  padding: 1rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.topbar-label {
  font-size: 0.8rem;
  color: var(--admin-muted);
}
.account-name {
  font-size: 0.8rem;
  margin: 0 0.5rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-toggle {
  display: none;
}
.main-content {
  padding: 2.3rem 2.5rem 4rem;
  max-width: 1600px;
  margin: 0 auto;
  outline: none;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.8rem;
}
.page-heading .muted {
  font-size: 0.88rem;
  margin-top: 0.7rem;
}
.panel {
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 3px 12px rgb(27 36 69 / 2%);
}
.panel > .detail-section {
  padding: 1.5rem;
}
.panel > .button {
  margin: 1.25rem;
}
.notice {
  padding: 1rem 1.2rem;
  font-size: 0.82rem;
  line-height: 1.6;
  background: var(--admin-soft);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  margin: 1rem 0;
  overflow-wrap: anywhere;
}
.notice.error {
  color: #b23549;
  background: #fff2f4;
  border-color: #f4cdd3;
}
.filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1.25rem 0;
}
input,
select,
textarea {
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  color: var(--admin-text);
  min-height: 42px;
  max-width: 100%;
  font-size: 0.84rem;
}
textarea {
  resize: vertical;
  min-height: 120px;
}
.filters > input {
  flex: 1;
  min-width: 160px;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--admin-muted);
}
.table-scroll {
  overflow: auto;
}
table {
  width: 100%;
  text-align: left;
  border-collapse: collapse;
  font-size: 0.8rem;
}
th {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 650;
  background: var(--admin-bg);
  color: var(--admin-muted);
  padding: 1rem 1.1rem;
  white-space: nowrap;
}
td {
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--admin-line);
  max-width: 320px;
  min-width: 100px;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
tbody tr:hover {
  background: var(--admin-bg);
}
.badge {
  display: inline-flex;
  border-radius: 6px;
  background: var(--admin-soft);
  color: var(--admin-primary);
  padding: 0.2rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 650;
}
.badge[data-status='active'],
.badge[data-status='completed'],
.badge[data-status='published'],
.badge[data-status='verified'],
.badge[data-status='posted'] {
  background: #e4f5ee;
  color: #236950;
}
.badge[data-status='rejected'],
.badge[data-status='failed'],
.badge[data-status='banned'],
.badge[data-status='critical'] {
  background: #ffe9ed;
  color: #a12a41;
}
.badge[data-status='pending'],
.badge[data-status='held'],
.badge[data-status='under_review'],
.badge[data-status='high'] {
  background: #fff2d8;
  color: #8c6116;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-top: 1px solid var(--admin-line);
  font-size: 0.75rem;
}
.table-note {
  padding: 1rem 1.1rem;
  font-size: 0.72rem;
  border-top: 1px solid var(--admin-line);
}
.empty-state,
.loading-state {
  padding: 4rem 1.5rem;
  text-align: center;
}
.empty-state p {
  margin: 0.8rem 0 1.2rem;
  font-size: 0.87rem;
}
.loading-state {
  color: var(--admin-muted);
}
.quick-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.quick-link {
  padding: 1.15rem 1.3rem;
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  color: var(--admin-text);
}
.quick-link strong {
  display: block;
  font-size: 0.88rem;
}
.quick-link span {
  display: block;
  font-size: 0.68rem;
  color: var(--admin-muted);
  margin-top: 0.7rem;
}
.quick-link:hover {
  border-color: var(--admin-primary);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  margin-top: 1.1rem;
}
.stat-card {
  padding: 1.5rem;
  border-radius: 14px;
  border: 1px solid var(--admin-line);
  background: var(--admin-surface);
}
.stat-card > p {
  font-size: 0.8rem;
}
.stat-card small {
  font-size: 0.68rem;
}
.stat-value {
  display: block;
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  font-weight: 720;
  margin: 1rem 0 0.3rem;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.dashboard-body > .panel {
  margin-top: 1rem;
}
.modal {
  width: min(820px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  background: var(--admin-surface);
  color: var(--admin-text);
  border: 1px solid var(--admin-line);
  border-radius: 18px;
  box-shadow: var(--admin-shadow);
  padding: 0;
}
.modal::backdrop {
  background: rgb(10 17 35 / 66%);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--admin-line);
  gap: 1rem;
}
.modal-body {
  padding: 1.5rem;
}
.modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--admin-line);
}
.detail-section + .detail-section {
  margin-top: 1.2rem;
}
.detail-section h3 {
  margin-bottom: 0.8rem;
}
.detail-grid {
  display: grid;
  gap: 0.85rem 1.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}
dt {
  color: var(--admin-muted);
  font-size: 0.67rem;
  margin-bottom: 0.3rem;
}
dd {
  margin: 0;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}
.detail-grid .detail-grid {
  grid-template-columns: 1fr;
}
.detail-grid > div:has(.detail-section) {
  grid-column: 1 / -1;
}
.preserve-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.record-summary {
  border-left: 3px solid var(--admin-primary);
  padding: 0.2rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.82rem;
}
.record-summary p {
  font-size: 0.72rem;
  margin-top: 0.45rem;
}
.record-summary .badge {
  margin-top: 0.5rem;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
}
.form-field:has(fieldset),
.form-field:has(textarea) {
  grid-column: 1 / -1;
}
.scalar-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.scalar-field label {
  font-size: 0.75rem;
  font-weight: 600;
}
.scalar-field small {
  font-size: 0.67rem;
  line-height: 1.5;
}
.field-heading {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
  font-size: 0.74rem;
  font-weight: 600;
}
.field-mode {
  color: var(--admin-muted);
  font-size: 0.73rem;
}
.nested-fields {
  border: 1px solid var(--admin-line);
  padding: 1rem;
  border-radius: 10px;
  min-width: 0;
}
.nested-fields > .form-field {
  margin-bottom: 1rem;
}
legend {
  padding: 0 0.5rem;
  font-size: 0.75rem;
  color: var(--admin-muted);
}
.array-row {
  display: flex;
  align-items: end;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.array-row > .form-field {
  flex: 1;
  min-width: 0;
}
.modal-body form > [type='submit'] {
  margin-top: 1.3rem;
}
.child-record {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--admin-line);
  font-size: 0.82rem;
}
.review-change h3 {
  margin-bottom: 1.2rem;
}
.login-layout {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: radial-gradient(ellipse at 20% 15%, #e5e3ff 0, transparent 45%), var(--admin-bg);
}
.login-card {
  width: min(100%, 440px);
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 22px;
  padding: 2.3rem;
  box-shadow: var(--admin-shadow);
}
.login-card .brand-mark {
  margin-bottom: 1.8rem;
  width: 45px;
  height: 45px;
}
.login-card h1 {
  margin-bottom: 0.8rem;
}
.login-card > .muted {
  font-size: 0.85rem;
  line-height: 1.7;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.6rem;
}
.login-form label {
  font-size: 0.77rem;
  font-weight: 600;
  margin-top: 0.5rem;
}
.login-form > [type='submit'] {
  margin-top: 0.9rem;
}
.login-footnote {
  font-size: 0.68rem !important;
  text-align: center;
  margin-top: 1.6rem;
}
.activity-chart {
  margin: 1.5rem 0;
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 14px;
  padding: 1.4rem;
}
.activity-chart figcaption {
  font-size: 0.85rem;
  font-weight: 650;
  margin-bottom: 1rem;
}
.activity-chart svg {
  width: 100%;
  height: auto;
}
.activity-chart text {
  fill: var(--admin-muted);
  font-size: 12px;
}
.chart-grid {
  stroke: var(--admin-line);
  stroke-width: 1px;
}
.chart-line {
  fill: none;
  stroke: var(--admin-primary);
  stroke-width: 3px;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}
.media-card {
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  padding: 0.7rem;
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}
.media-card img {
  width: 100%;
  height: 130px;
  object-fit: contain;
  background: var(--admin-bg);
  border-radius: 6px;
}
.media-card p {
  margin: 0.7rem 0;
}
.media-preview {
  display: block;
  max-width: 100%;
  max-height: 350px;
  object-fit: contain;
  margin: 0 auto 1.5rem;
  border-radius: 10px;
}
.boot-state {
  padding: 5rem;
  text-align: center;
}
@media (max-width: 1100px) {
  .sidebar {
    width: 220px;
    flex-basis: 220px;
  }
  .workspace {
    margin-left: 220px;
    width: calc(100% - 220px);
  }
  .main-content,
  .topbar {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  .quick-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .sidebar {
    display: none;
    inset: 76px auto 0 0;
    width: 270px;
    box-shadow: var(--admin-shadow);
  }
  .sidebar.is-open {
    display: flex;
  }
  .workspace {
    margin-left: 0;
    width: 100%;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .topbar {
    padding: 0.8rem 1rem;
  }
  .topbar-label,
  .account-name {
    display: none;
  }
  .main-content {
    padding: 1.6rem 1rem 3rem;
  }
  .page-heading {
    align-items: flex-start;
  }
  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .modal-body,
  .modal-header,
  .modal-footer {
    padding: 1rem;
  }
  .login-card {
    padding: 1.6rem;
  }
}
@media (max-width: 400px) {
  .stat-grid,
  .quick-links {
    grid-template-columns: 1fr;
  }
  .topbar .button {
    font-size: 0.72rem;
    padding: 0.5rem 0.65rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
