:root {
  color-scheme: light;
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-alt: #f8fbff;
  --ink: #0f172a;
  --text: #223043;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #d7e0ea;
  --line-strong: #b8c5d6;
  --blue: #1d4ed8;
  --teal: #0f766e;
  --green: #15803d;
  --amber: #b45309;
  --red: #b42318;
  --purple: #6d5bd0;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, 0.08), transparent 24%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.06), transparent 28%),
    var(--bg);
}

body.landing {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

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

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

.shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand__mark,
.nav-item__code {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  font-size: 13px;
  font-weight: 900;
  flex: 0 0 auto;
}

.brand__name {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.1;
}

.brand__sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 67px;
  align-self: start;
  height: calc(100vh - 67px);
  overflow: auto;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-bottom: 8px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--muted);
}

.nav-item.active,
.nav-item:hover {
  color: var(--ink);
  background: #edf4ff;
}

.content {
  min-width: 0;
  padding: 22px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-header h2 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 27px;
}

.page-header p {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.page-header__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lead {
  color: var(--muted);
  line-height: 1.6;
}

.cards,
.facts,
.split {
  display: grid;
  gap: 14px;
}

.cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.card,
.panel,
.fact,
.login-card,
.landing-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card {
  padding: 16px;
}

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

.card strong {
  display: block;
  margin-top: 12px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

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

.panel {
  min-width: 0;
  padding: 16px;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel__head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.panel__head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: var(--muted);
  background: var(--surface-alt);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.flash {
  border: 1px solid;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 800;
}

.flash--success {
  border-color: #bbf7d0;
  color: #166534;
  background: #f0fdf4;
}

.flash--error {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}

.flash--info {
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: #eff6ff;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.field textarea {
  min-height: 108px;
  padding: 10px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.field__help {
  color: var(--faint);
  font-weight: 600;
  line-height: 1.4;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.btn--primary {
  color: #fff;
  background: var(--blue);
}

.btn--secondary {
  color: var(--text);
  border-color: var(--line);
  background: #fff;
}

.btn--danger {
  color: var(--red);
  border-color: #fecaca;
  background: #fff5f5;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge--default { color: #1f2937; background: #e5e7eb; }
.badge--success { color: #166534; background: #dcfce7; }
.badge--warning { color: #92400e; background: #fef3c7; }
.badge--danger { color: #991b1b; background: #fee2e2; }
.badge--info { color: #1d4ed8; background: #dbeafe; }

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

.fact {
  padding: 12px;
  background: var(--surface-alt);
}

.fact span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fact strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
}

.login-shell,
.landing-shell {
  width: min(1120px, calc(100vw - 32px));
}

.login-card,
.landing-card {
  overflow: hidden;
}

.login-card {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.login-hero {
  padding: 34px;
  color: #fff;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.12), transparent 35%),
    linear-gradient(135deg, #0f172a, #123076);
}

.login-hero h1,
.landing-card h1 {
  margin: 18px 0 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
}

.login-hero p {
  max-width: 640px;
  line-height: 1.6;
}

.login-form {
  padding: 34px;
}

.login-form h2 {
  margin: 0;
  color: var(--ink);
}

.login-form .lead {
  margin-top: 8px;
  margin-bottom: 18px;
}

.landing-card {
  padding: 40px;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.92));
}

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

@media (max-width: 1100px) {
  .cards,
  .split,
  .login-card {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 860px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 10px;
    overflow: auto;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
  }

  .content {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
  }

  .cards,
  .split,
  .facts,
  .form-grid,
  .login-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .content {
    padding-inline: 12px;
  }

  .topbar {
    padding-inline: 14px;
  }

  .btn {
    width: 100%;
  }

  .page-header__actions,
  .landing-actions {
    width: 100%;
  }
}
