:root {
  --navy: #17245f;
  --navy-2: #21347e;
  --text: #111827;
  --muted: #64748b;
  --line: #d8e1ee;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --bg: #f4f7fb;
  --mint: #c9fff1;
  --green: #cdfbd5;
  --blue: #cfe3ff;
  --purple: #ded4ff;
  --amber: #ffd9a4;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 12%, rgba(22, 163, 184, 0.16), transparent 32%),
    radial-gradient(circle at 85% 20%, rgba(79, 70, 229, 0.12), transparent 35%),
    linear-gradient(135deg, #f8fbff, var(--bg));
}

body.dark {
  --text: #f8fafc;
  --muted: #b6c2d6;
  --line: #293855;
  --surface: rgba(16, 24, 39, 0.88);
  --surface-strong: #111827;
  --bg: #07111f;
  background:
    radial-gradient(circle at 15% 12%, rgba(45, 212, 191, 0.14), transparent 32%),
    radial-gradient(circle at 85% 20%, rgba(99, 102, 241, 0.14), transparent 35%),
    linear-gradient(135deg, #07111f, #101827);
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  color: white;
  background: linear-gradient(180deg, var(--navy), #111c4f);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  padding: 22px 14px;
  z-index: 20;
}

.brand-block {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-logo,
.avatar,
.auth-mark {
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, #f8c43c, #2643b9);
  border-radius: 8px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.22);
}

.brand-logo.has-image,
.brand-logo.large.has-image {
  background-color: white;
}

.brand-logo.large {
  width: 78px;
  height: 78px;
  font-size: 24px;
  background-size: cover;
  background-position: center;
}

.brand-block strong {
  display: block;
  font-size: 18px;
}

.brand-block span,
.user-mini span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  margin-top: 3px;
}

.menu-search {
  display: block;
  margin: 10px 0 26px;
}

.menu-search span,
.global-search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.menu-search input {
  width: 100%;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 13px 14px;
  outline: none;
}

.menu-search input::placeholder {
  color: rgba(255, 255, 255, 0.62);
}

.nav-group {
  margin: 22px 10px 10px;
  color: #f6c342;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.side-nav button {
  width: 100%;
  min-height: 48px;
  margin: 4px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.86);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  text-align: left;
}

.side-nav button::after {
  content: ">";
  opacity: 0.35;
}

.side-nav button.active,
.side-nav button:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(246, 195, 66, 0.65);
}

.user-mini {
  position: sticky;
  bottom: 0;
  margin-top: 40px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 10px;
  background: rgba(0, 0, 0, 0.16);
  border-radius: 8px;
}

.avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #f7c948, #4462d9);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto auto minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

body.dark .topbar {
  background: rgba(7, 17, 31, 0.78);
}

.content {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 28px 28px 92px;
}

.footer {
  color: var(--muted);
  text-align: center;
  padding: 18px 24px 38px;
}

.btn,
.icon-btn,
.module-btn {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  color: white;
  background: #2f48a7;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(47, 72, 167, 0.14);
}

.btn.small {
  min-height: 40px;
}

.btn.full {
  width: 100%;
}

.btn.ghost,
.icon-btn,
.module-btn {
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: none;
}

.global-search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-strong);
  padding: 0 16px;
}

.hero-panel,
.panel,
.form-card,
.auth-card,
.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  padding: 34px;
  margin-bottom: 24px;
  background:
    linear-gradient(120deg, rgba(199, 255, 241, 0.72), rgba(219, 228, 255, 0.58), rgba(255, 247, 219, 0.66)),
    var(--surface);
}

body.dark .hero-panel {
  background:
    linear-gradient(120deg, rgba(20, 83, 81, 0.42), rgba(40, 46, 105, 0.5), rgba(84, 60, 20, 0.38)),
    var(--surface);
}

.hero-panel h1 {
  margin: 8px 0 10px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
}

.hero-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.quick-grid,
.stats-grid,
.split-grid,
.queue-layout {
  display: grid;
  gap: 18px;
}

.quick-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card {
  padding: 26px;
}

.feature-card h2,
.section-title h2,
.detail-header h2 {
  margin: 0;
}

.feature-card p {
  color: var(--muted);
  line-height: 1.6;
}

.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 14px;
  color: var(--navy);
  background: #f6c342;
  border-radius: 8px;
  font-weight: 900;
}

.stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 24px;
}

.stats-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -36px;
  width: 110px;
  height: 110px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
}

.stat-card span,
.stat-card small {
  display: block;
  color: #4b5563;
  font-weight: 800;
}

body.dark .stat-card span,
body.dark .stat-card small {
  color: #243247;
}

.stat-card strong {
  display: block;
  margin: 14px 0 8px;
  color: #172033;
  font-size: 30px;
  line-height: 1;
}

.stat-card.mint {
  background: linear-gradient(135deg, var(--mint), #bdf3e6);
}

.stat-card.green {
  background: linear-gradient(135deg, var(--green), #aaf1ba);
}

.stat-card.blue {
  background: linear-gradient(135deg, var(--blue), #a9ccff);
}

.stat-card.purple {
  background: linear-gradient(135deg, var(--purple), #c9b9ff);
}

.stat-card.amber {
  background: linear-gradient(135deg, var(--amber), #ffc77f);
}

.split-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
}

.queue-layout {
  grid-template-columns: minmax(320px, 0.7fr) minmax(0, 1.2fr);
  align-items: start;
}

.users-layout {
  grid-template-columns: minmax(260px, 0.7fr) minmax(300px, 0.8fr) minmax(320px, 0.8fr);
}

.panel,
.form-card {
  padding: 24px;
}

.section-title {
  padding-bottom: 18px;
  border-bottom: 3px solid rgba(15, 118, 110, 0.14);
  margin-bottom: 18px;
}

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

.form-grid label,
.stacked label,
.form-card > label,
.auth-card label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-weight: 800;
}

body.dark .form-grid label,
body.dark .stacked label,
body.dark .form-card > label,
body.dark .auth-card label {
  color: #d8e1ee;
}

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

textarea {
  resize: vertical;
}

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

.check-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface-strong);
  font-weight: 800;
}

.check-pill input {
  width: auto;
}

.auth-page {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(560px, 100%);
  padding: 34px;
}

.auth-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
}

.auth-card h1,
.auth-card p {
  text-align: center;
}

.auth-card p {
  color: var(--muted);
}

.request-list {
  display: grid;
  gap: 10px;
}

.request-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  text-align: left;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.request-row:hover {
  border-color: #2f48a7;
}

.request-row span,
.request-row small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  color: #25603c !important;
  background: #e8f8ec;
  border-radius: 8px;
  font-weight: 900;
}

.pill.large {
  min-height: 40px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.detail-header span {
  color: var(--muted);
}

.detail-grid {
  margin-bottom: 18px;
}

.detail-grid div {
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(199, 255, 241, 0.22), rgba(219, 228, 255, 0.2)),
    var(--surface-strong);
}

.detail-grid.compact div {
  min-height: 72px;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.detail-grid strong {
  word-break: break-word;
}

.note-box,
.empty-state,
.logo-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 18px;
  margin: 18px 0;
}

.note-box p,
.logo-preview p {
  color: var(--muted);
  line-height: 1.6;
}

.stacked {
  display: grid;
  gap: 14px;
}

.logo-preview {
  display: flex;
  align-items: center;
  gap: 18px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  max-width: 360px;
  padding: 16px 18px;
  color: white;
  background: #0f766e;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-weight: 900;
}

.toast.error {
  background: #b42318;
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 86vw);
    transform: translateX(-110%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .stats-grid,
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .queue-layout,
  .users-layout,
  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
  }

  .module-btn,
  .global-search {
    display: none;
  }

  .content {
    padding: 18px 14px 78px;
  }

  .hero-panel {
    display: block;
    padding: 24px;
  }

  .hero-panel h1 {
    font-size: 30px;
  }

  .hero-actions {
    margin-top: 18px;
  }

  .stats-grid,
  .stats-grid.three,
  .quick-grid,
  .form-grid,
  .detail-grid,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .request-row {
    grid-template-columns: 1fr;
  }
}
