:root {
  --bg-950: #070d1a;
  --bg-900: #0b1324;
  --bg-850: #101b31;
  --surface-700: rgba(13, 23, 43, 0.82);
  --surface-600: rgba(16, 28, 50, 0.72);
  --surface-500: rgba(21, 35, 60, 0.58);
  --line-strong: rgba(165, 183, 220, 0.36);
  --line-soft: rgba(160, 180, 220, 0.2);

  --text-strong: #f5f8ff;
  --text-main: rgba(235, 242, 255, 0.9);
  --text-muted: rgba(186, 202, 232, 0.72);

  --accent: #ff8547;
  --accent-2: #ffd38b;
  --success: #52d6a1;
  --danger: #ff6d8f;
  --warn: #ffd170;

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 22px;
  --space-5: 30px;

  --shadow-soft: 0 20px 50px rgba(2, 8, 18, 0.45);
  --shadow-elevated: 0 32px 80px rgba(2, 8, 18, 0.55);

  --max-width: 1240px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text-main);
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1100px 680px at 12% -10%, rgba(255, 133, 71, 0.26), transparent 60%),
    radial-gradient(860px 700px at 94% 6%, rgba(82, 214, 161, 0.2), transparent 58%),
    radial-gradient(1000px 750px at 48% 110%, rgba(255, 209, 112, 0.16), transparent 64%),
    linear-gradient(180deg, var(--bg-950), var(--bg-900) 38%, var(--bg-850));
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 70px 70px;
  mask-image: radial-gradient(circle at 50% 35%, black, transparent 80%);
}

.app {
  min-height: 100%;
  padding: var(--space-4) var(--space-3) 44px;
}

.shell {
  width: min(var(--max-width), 100%);
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 10px 10px 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: var(--surface-700);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 34px rgba(2, 8, 20, 0.45);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.topbar.scrolled {
  border-color: var(--line-strong);
  background: rgba(9, 16, 30, 0.92);
  box-shadow: 0 20px 52px rgba(1, 5, 14, 0.62);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text-strong);
  text-decoration: none;
  min-width: 0;
  flex: 1 1 auto;
}

.brand-badge {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #111a2f;
  background: linear-gradient(150deg, var(--accent) 14%, var(--accent-2) 92%);
  box-shadow: 0 14px 30px rgba(255, 133, 71, 0.35);
}

.brand-title {
  display: block;
  font-family: "Fraunces", ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: clamp(18px, 2.5vw, 22px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.brand-sub {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.2;
}

.nav-details {
  position: relative;
  flex: 0 0 auto;
}

.nav-details > summary {
  list-style: none;
}

.nav-details > summary::-webkit-details-marker {
  display: none;
}

.menu-toggle {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.menu-toggle svg {
  transition: transform 180ms ease;
}

.menu-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-strong);
}

.nav-details[open] .menu-toggle {
  background: rgba(255, 133, 71, 0.15);
  border-color: rgba(255, 133, 71, 0.45);
}

.nav-details[open] .menu-toggle svg {
  transform: rotate(90deg);
}

.nav {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(520px, calc(100vw - 34px));
  max-height: min(72vh, 640px);
  overflow: auto;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: rgba(8, 16, 30, 0.97);
  box-shadow: var(--shadow-elevated);
  z-index: 20;
}

.nav-details[open] .nav {
  display: grid;
  gap: 10px;
}

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

.nav .inline {
  width: 100%;
}

.nav .inline .btn {
  width: 100%;
}

.nav a {
  text-decoration: none;
}

.content {
  margin-top: 18px;
  display: grid;
  gap: var(--space-3);
}

.page-hero {
  position: relative;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: clamp(22px, 3vw, 38px);
  background:
    linear-gradient(120deg, rgba(255, 133, 71, 0.14), transparent 42%),
    linear-gradient(165deg, rgba(82, 214, 161, 0.09), transparent 56%),
    rgba(10, 19, 35, 0.86);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.page-hero::after {
  content: "";
  position: absolute;
  inset: auto -20% -55% auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 112, 0.3), transparent 70%);
  pointer-events: none;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.metric-chip {
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  padding: 11px 12px;
}

.metric-chip span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.metric-chip strong {
  color: var(--text-strong);
  font-size: 14px;
  line-height: 1.35;
}

.grid {
  display: grid;
  gap: var(--space-3);
}

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

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

.card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-soft);
  padding: clamp(18px, 2.4vw, 28px);
  background: var(--surface-600);
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.card-sm {
  padding: clamp(14px, 1.8vw, 22px);
  border-radius: var(--radius-md);
  background: var(--surface-500);
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.kicker {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0 0 10px;
  font-family: "Fraunces", ui-serif, Georgia, "Times New Roman", Times, serif;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

h1 {
  font-size: clamp(31px, 4.7vw, 46px);
  line-height: 1.06;
}

h2 {
  font-size: clamp(22px, 3vw, 31px);
  line-height: 1.15;
}

h3 {
  font-size: clamp(18px, 2.3vw, 24px);
  line-height: 1.2;
}

p {
  margin: 0 0 12px;
  line-height: 1.62;
  color: var(--text-main);
}

.lead {
  max-width: 70ch;
  color: rgba(237, 243, 255, 0.95);
  font-size: clamp(16px, 1.75vw, 19px);
  line-height: 1.55;
}

a {
  color: rgba(255, 209, 112, 0.96);
}

a:hover {
  color: #ffe7b7;
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #ffdeac;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

.muted {
  color: var(--text-muted);
}

.spacer {
  height: 2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  padding: 9px 12px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.pill:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.14);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-strong);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.15);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(140deg, rgba(255, 133, 71, 0.95), rgba(255, 209, 112, 0.92));
  border-color: rgba(255, 209, 112, 0.56);
  color: #1b1a16;
}

.btn-primary:hover {
  background: linear-gradient(140deg, rgba(255, 148, 92, 0.96), rgba(255, 219, 134, 0.94));
}

.btn-success {
  background: linear-gradient(140deg, rgba(82, 214, 161, 0.95), rgba(174, 245, 219, 0.95));
  border-color: rgba(174, 245, 219, 0.5);
  color: #11241d;
}

.btn-success:hover {
  background: linear-gradient(140deg, rgba(95, 220, 170, 0.98), rgba(190, 248, 226, 0.98));
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.13);
}

.btn-danger {
  background: linear-gradient(140deg, rgba(255, 109, 143, 0.96), rgba(255, 177, 200, 0.96));
  border-color: rgba(255, 177, 200, 0.54);
  color: #2e1319;
}

.btn-danger:hover {
  background: linear-gradient(140deg, rgba(255, 123, 154, 0.98), rgba(255, 194, 212, 0.98));
}

.form {
  margin-top: 8px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid > * {
  min-width: 0;
}

@media (min-width: 940px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.form-group {
  min-width: 0;
  width: 100%;
}

.form-control,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(190, 206, 235, 0.28);
  background: rgba(6, 14, 28, 0.58);
  color: var(--text-strong);
  font-weight: 650;
  font-size: 16px;
  min-height: 44px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: rgba(188, 202, 230, 0.54);
}

input[readonly],
textarea[readonly],
select[readonly] {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

.form-control:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 133, 71, 0.78);
  box-shadow: 0 0 0 3px rgba(255, 133, 71, 0.24);
  background: rgba(8, 16, 31, 0.72);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0 6px 0 0;
  vertical-align: middle;
  accent-color: var(--accent);
}

label input[type="checkbox"] {
  transform: translateY(2px);
}

.help {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.errorlist {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.errorlist li {
  border-radius: 10px;
  border: 1px solid rgba(255, 109, 143, 0.45);
  background: rgba(255, 109, 143, 0.14);
  color: #ffd5df;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.4;
}

.alerts {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.alert {
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  padding: 10px 12px;
  line-height: 1.45;
}

.alert-success {
  border-color: rgba(82, 214, 161, 0.45);
  background: rgba(82, 214, 161, 0.16);
  color: #d9fff0;
}

.alert-info {
  border-color: rgba(255, 209, 112, 0.45);
  background: rgba(255, 209, 112, 0.14);
  color: #fff1cf;
}

.alert-error,
.alert-danger {
  border-color: rgba(255, 109, 143, 0.5);
  background: rgba(255, 109, 143, 0.17);
  color: #ffd7e1;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(190, 206, 235, 0.24);
  background: rgba(7, 15, 29, 0.52);
}

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

.table th,
.table td {
  text-align: left;
  vertical-align: top;
  padding: 11px 12px;
  border-bottom: 1px solid rgba(190, 206, 235, 0.15);
  color: var(--text-main);
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-muted);
  background: rgba(7, 14, 27, 0.96);
}

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

.table td .inline {
  gap: 8px;
}

.table td .btn {
  margin-bottom: 4px;
}

.table .form-control,
.table input[type="text"],
.table input[type="number"],
.table input[type="password"],
.table input[type="email"],
.table input[type="search"],
.table input[type="url"],
.table input[type="date"],
.table input[type="time"],
.table input[type="datetime-local"],
.table select,
.table textarea {
  width: 100%;
  min-width: 140px;
}

.rows {
  display: grid;
  gap: 10px;
}

.row-card {
  border-radius: 12px;
  border: 1px solid rgba(190, 206, 235, 0.22);
  background: rgba(5, 13, 26, 0.56);
  padding: 12px;
}

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

.row-grid > * {
  min-width: 0;
}

.row-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.row-actions input[type="checkbox"][name$="-DELETE"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

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

.metric-item {
  border-radius: 12px;
  border: 1px solid rgba(190, 206, 235, 0.22);
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  transition: transform 170ms ease, border-color 170ms ease, background 170ms ease;
}

.metric-item:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.09);
}

.metric-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metric-value {
  margin: 6px 0 0;
  color: var(--text-strong);
  font-size: clamp(23px, 3vw, 31px);
  line-height: 1;
  font-weight: 800;
}

.flow-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
  counter-reset: flow;
}

.flow-list li {
  counter-increment: flow;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-main);
  line-height: 1.55;
}

.flow-list li::before {
  content: counter(flow);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-top: 1px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #1c1a17;
  background: linear-gradient(140deg, rgba(255, 133, 71, 0.95), rgba(255, 209, 112, 0.95));
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.reveal {
  opacity: 0;
  transform: translateY(12px);
}

.ready .reveal {
  animation: rise 520ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.ready .reveal.d2 {
  animation-delay: 90ms;
}

.ready .reveal.d3 {
  animation-delay: 160ms;
}

.ready .reveal.d4 {
  animation-delay: 230ms;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pill:focus-visible,
.btn:focus-visible,
.menu-toggle:focus-visible,
.form-control:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(255, 133, 71, 0.52);
  outline-offset: 2px;
}

@media (max-width: 1023px) {
  .topbar {
    border-radius: var(--radius-lg);
  }

  .nav {
    width: min(460px, calc(100vw - 28px));
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app {
    padding: 14px 10px 30px;
  }

  .topbar {
    top: 8px;
    padding: 10px;
  }

  .brand-sub {
    display: none;
  }

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

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

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

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

  .actions > * {
    width: 100%;
  }
}

@media (max-width: 720px) {
  h1 {
    font-size: clamp(27px, 8vw, 35px);
  }

  h2 {
    font-size: clamp(21px, 6.8vw, 27px);
  }

  .topbar {
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
    gap: 10px;
    border-radius: var(--radius-lg);
  }

  .brand {
    width: 100%;
  }

  .nav-details {
    width: 100%;
  }

  .menu-toggle {
    width: 100%;
    height: 40px;
  }

  .nav {
    position: static;
    width: 100%;
    max-height: 58vh;
    margin-top: 10px;
    border-radius: var(--radius-md);
  }

  .actions .btn,
  .actions form,
  .actions a {
    width: 100%;
  }

  .inline {
    width: 100%;
  }

  .inline .btn {
    width: 100%;
  }

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

  .table {
    min-width: 680px;
  }

  .table-stack {
    min-width: 100%;
  }

  .table-stack thead {
    display: none;
  }

  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack td {
    display: block;
    width: 100%;
  }

  .table-stack tr {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(190, 206, 235, 0.15);
  }

  .table-stack td {
    border: 0;
    padding: 8px 0;
    display: grid;
    grid-template-columns: minmax(112px, 40%) 1fr;
    gap: 10px;
    align-items: start;
  }

  .table-stack td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .table-stack td:empty::before {
    content: attr(data-label);
  }

  .table-stack td .inline,
  .table-stack td .btn,
  .table-stack td form {
    width: 100%;
  }

  .table-stack td .inline {
    justify-content: flex-start;
  }

  .table-stack td .btn {
    justify-content: center;
  }
}

@media (max-width: 460px) {
  .card,
  .card-sm,
  .page-hero {
    padding: 16px;
  }

  .btn,
  .pill {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }

  .ready .reveal {
    animation: none;
  }

  .card,
  .metric-item,
  .pill,
  .btn,
  .menu-toggle {
    transition: none;
  }
}
