:root {
  --ink: #14131a;
  --ink-soft: #4b4b57;
  --muted: #6f7280;
  --accent: #0f766e;
  --accent-2: #e76f51;
  --accent-3: #2563eb;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --surface-ghost: rgba(255, 255, 255, 0.45);
  --border: rgba(20, 19, 26, 0.12);
  --shadow: 0 24px 60px rgba(18, 24, 40, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --header-height: 88px;
  --sidebar-width: 260px;
}

@font-face {
  font-family: "SomethingShine";
  src: url("/assets/fonts/SomethingShine.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 20%, rgba(240, 220, 190, 0.6), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(184, 219, 220, 0.65), transparent 50%),
    linear-gradient(135deg, #f7f3ea 0%, #f2f6f4 45%, #f9efe4 100%);
  min-height: 100vh;
  overflow-y: scroll;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(20, 19, 26, 0.08) 1px, transparent 1px);
  background-size: 120px 120px;
  opacity: 0.35;
  pointer-events: none;
  z-index: -1;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent-3);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Space Grotesk", "Sora", sans-serif;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem 0;
}

p {
  margin: 0 0 1rem 0;
  color: var(--ink-soft);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-height);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.brand-mark {
  font-family: "SomethingShine", "Space Grotesk", sans-serif;
  font-size: 2rem;
  color: var(--ink);
}

.brand-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  font-weight: 600;
  white-space: nowrap;
}

.app-nav a {
  padding: 0.4rem 0.6rem;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.app-nav a:hover,
.app-nav a[aria-current="page"] {
  background: var(--surface-ghost);
  color: var(--ink);
}

.app-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-pill {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-ghost);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.nav-toggle {
  display: none;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
}

.app-body {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 1.5rem;
  padding: 1.5rem 2rem 3rem;
}

.app-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  align-self: start;
  width: var(--sidebar-width);
  max-height: calc(100vh - var(--header-height) - 3rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.sidebar-section + .sidebar-section {
  margin-top: 1.5rem;
}

.sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.sidebar-link {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--ink);
  transition: all 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: var(--surface-ghost);
  color: var(--accent-3);
}

.app-main {
  min-width: 0;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.page-lead {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 640px;
}

.app-card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.builder-card {
  padding-top: 1.25rem;
}

.app-card--glass {
  background: var(--surface);
  backdrop-filter: blur(12px);
}

.app-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.app-card__title {
  font-size: 1.2rem;
  margin: 0;
}

.announcement-card {
  border-left: 4px solid var(--accent-2);
}

.announcement-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.announcement-nav {
  display: flex;
  gap: 0.5rem;
}

.announcement-count {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-ghost);
}

.announcement-slider {
  position: relative;
  overflow: hidden;
}

.announcement-track {
  display: flex;
  transition: transform 0.6s ease;
  will-change: transform;
}

.announcement-slide {
  flex: 0 0 100%;
  padding: 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.9), rgba(245, 247, 250, 0.85));
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.08);
}

.announcement-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.announcement-body {
  margin-top: 0.35rem;
  color: var(--ink-soft);
  white-space: pre-line;
}

.announcement-meta {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.announcement-dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.announcement-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-ghost);
  transition: transform 0.2s ease, background 0.2s ease;
}

.announcement-dot.is-active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  transform: scale(1.1);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.stat-card {
  padding: 1.2rem;
  border-radius: var(--radius-md);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.85) 0%, rgba(240, 246, 248, 0.8) 100%);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
}

.tier-locked {
  opacity: 0.6;
}

.tier-locked input {
  cursor: not-allowed;
}

.tier-lock {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

.table {
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(248, 248, 250, 0.85);
  padding: 0.85rem;
}

.table tbody td {
  padding: 0.9rem;
  border-top: 1px solid rgba(20, 19, 26, 0.08);
  color: var(--ink-soft);
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.6);
}

.dataTables_wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  background: var(--surface-strong);
  font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_info {
  color: var(--muted);
  font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  margin: 0 0.15rem;
  color: var(--ink);
  background: var(--surface-ghost);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--accent-3);
  border-color: var(--accent-3);
  color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: var(--accent-3);
  color: var(--accent-3) !important;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field--full {
  grid-column: 1 / -1;
}

.form-field label {
  font-weight: 600;
  color: var(--ink);
}

.form-control,
.form-select,
input,
select,
textarea {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(20, 19, 26, 0.2);
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  background: #ffffff;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-hint {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.btn {
  border-radius: 999px;
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-3);
  border-color: var(--accent-3);
}

.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-outline-primary {
  border-color: var(--accent-3);
  color: var(--accent-3);
}

.btn-outline-primary:hover {
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent-3);
}

.btn-danger,
.btn-outline-danger {
  border-color: #e11d48;
  color: #e11d48;
}

.btn-danger {
  background: #e11d48;
  color: #ffffff;
}

.btn-danger:hover {
  background: #be123c;
  border-color: #be123c;
}

.btn-outline-danger:hover {
  background: rgba(225, 29, 72, 0.12);
}

.thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 12px;
  margin-right: 0.5rem;
  border: 1px solid var(--border);
}

.tab-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.tab-group .tab a {
  display: inline-flex;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(20, 19, 26, 0.15);
  background: var(--surface-ghost);
  font-weight: 600;
  color: var(--ink-soft);
  transition: all 0.2s ease;
}

.tab-group .tab.active a,
.tab-group .tab a:hover {
  background: var(--accent-3);
  border-color: var(--accent-3);
  color: #ffffff;
}

.app-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  z-index: 50;
  padding: 1.5rem;
}

.app-modal.is-hidden {
  display: none;
}

.app-modal__card {
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow);
}

.popup-body {
  color: var(--ink-soft);
  white-space: pre-line;
}

.app-modal__actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.stagger > * {
  animation: float-in 0.6s ease both;
}

.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }

@keyframes float-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-overlay {
  display: none;
}

.auth {
  background: radial-gradient(circle at 10% 20%, rgba(197, 225, 255, 0.7), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(248, 200, 170, 0.6), transparent 50%),
    linear-gradient(135deg, #f8f5f0, #f2f8f7);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.auth-card {
  width: min(520px, 100%);
  background: var(--surface-strong);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.auth-header {
  margin-bottom: 1.5rem;
}

.auth-links {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-links a {
  color: var(--accent-3);
}

@media (max-width: 1024px) {
  .app-body {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 80vw);
    transform: translateX(-110%);
    transition: transform 0.3s ease;
    z-index: 40;
  }

  body.nav-open .app-sidebar {
    transform: translateX(0);
  }

  .app-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 30;
  }

  body.nav-open .app-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .app-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 1rem;
  }

  .app-body {
    padding: 1rem;
  }

  .app-card,
  .auth-card {
    padding: 1.5rem;
  }

  .announcement-controls {
    flex-direction: column;
    align-items: flex-start;
  }
}
