:root {
  color-scheme: dark;
  --bg: #0d0f10;
  --bg-soft: #121518;
  --panel: #171b1f;
  --panel-2: #1d2328;
  --panel-3: #232b31;
  --text: #eef3f6;
  --muted: #9aa8b2;
  --line: #2d3740;
  --line-strong: #3c4b55;
  --accent: #4a9eff;
  --accent-2: #77d6a6;
  --warn: #f0b84f;
  --danger: #ed6a6a;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(74, 158, 255, 0.08), transparent 320px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

button,
.button,
input,
select,
textarea {
  border-radius: 8px;
  font: inherit;
}

button,
.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(74, 158, 255, 0.45);
  background: #153657;
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

button:hover,
.button:hover {
  border-color: var(--accent);
  background: #1a4670;
}

button:active,
.button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button.danger {
  border-color: rgba(237, 106, 106, 0.55);
  background: #522326;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0f1214;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.18);
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #13181c;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.018);
}

tbody tr:hover {
  background: rgba(74, 158, 255, 0.06);
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: rgba(18, 21, 24, 0.96);
  padding: 24px 18px;
}

.brand-block {
  border-bottom: 1px solid var(--line);
  padding: 0 6px 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
}

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

.brand-block p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 5px;
}

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0 12px;
  border-radius: 8px;
}

.nav a::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 11px;
  border-radius: 999px;
  background: var(--line-strong);
}

.nav a:hover {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
}

.nav a.active {
  border-color: rgba(74, 158, 255, 0.55);
  background: rgba(74, 158, 255, 0.13);
  color: var(--text);
}

.nav a.active::before {
  background: var(--accent);
}

.logout-form {
  margin-top: auto;
}

.logout-form button {
  width: 100%;
  border-color: var(--line);
  background: var(--panel);
}

.mobile-bar {
  display: none;
}

.scrim {
  display: none;
}

.page {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.hero {
  display: flex;
  align-items: end;
  min-height: 230px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(13, 15, 16, 0.42), rgba(13, 15, 16, 0.88)),
    url("https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?auto=format&fit=crop&w=1600&q=80") center/cover;
  padding: 28px;
  margin-bottom: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero.slim {
  min-height: 140px;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1;
}

.hero p {
  max-width: 760px;
  color: #d7e2e9;
}

.banner,
.alert {
  border: 1px solid rgba(240, 184, 79, 0.5);
  background: #2b2415;
  color: #ffe2a5;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 8px;
}

.grid {
  display: grid;
  gap: 16px;
  margin: 20px 0;
}

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

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

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.card,
.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent), var(--panel);
  padding: 18px;
  border-radius: 8px;
}

.card {
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

a.card:hover,
.card:hover {
  border-color: rgba(74, 158, 255, 0.45);
  background: var(--panel-2);
}

.card h2,
.panel h2,
section h2 {
  margin-top: 0;
}

.amount {
  font-size: 28px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.eyebrow,
.muted,
small {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--text);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 13px;
}

.stack,
.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.wide {
  grid-column: span 2;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input {
  width: auto;
}

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

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 14px;
  border-radius: 8px;
  transition: border-color 120ms ease, background 120ms ease;
}

.row:hover {
  border-color: rgba(74, 158, 255, 0.4);
  background: var(--panel-2);
}

.row span:first-child {
  display: grid;
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: rgba(237, 106, 106, 0.7);
  background: #421f23;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(13, 15, 16, 0.86), rgba(18, 21, 24, 0.94)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.auth-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  background: rgba(23, 27, 31, 0.94);
  padding: 28px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: rgba(13, 15, 16, 0.95);
    padding: 12px 16px;
    backdrop-filter: blur(12px);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 25;
    width: min(300px, 86vw);
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

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

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 24;
    display: none;
    background: rgba(0, 0, 0, 0.55);
  }

  .scrim.open {
    display: block;
  }

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

  .page {
    width: min(100% - 28px, 1240px);
    padding-top: 20px;
  }
}

@media (max-width: 860px) {
  .grid.two,
  .grid.three,
  .split,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .hero {
    min-height: 190px;
    padding: 20px;
  }

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