:root {
  --bg: #0a0d14;
  --bg-soft: #101521;
  --panel: rgba(17, 22, 34, 0.94);
  --panel-soft: rgba(24, 31, 47, 0.88);
  --text: #eef2fb;
  --muted: #95a1bd;
  --accent: #d8b26a;
  --accent-strong: #f0d69f;
  --accent-soft: rgba(216, 178, 106, 0.14);
  --success: #63c48e;
  --warning: #ffb65b;
  --danger: #ff7b86;
  --border: rgba(163, 178, 214, 0.14);
  --border-strong: rgba(216, 178, 106, 0.22);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(216, 178, 106, 0.12) 0%, rgba(216, 178, 106, 0) 32%),
    radial-gradient(circle at top right, rgba(112, 139, 255, 0.12) 0%, rgba(112, 139, 255, 0) 26%),
    linear-gradient(180deg, #0c1018 0%, #090c13 100%);
  color: var(--text);
}

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

.login-body {
  min-height: 100vh;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  background: rgba(8, 11, 18, 0.94);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(19, 24, 38, 0.96) 0%, rgba(12, 16, 27, 0.96) 100%);
  box-shadow: var(--shadow);
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 1.08rem;
  letter-spacing: 0.01em;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.brand-kicker {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #141925;
  background: linear-gradient(145deg, #ebcc87, #aa803f);
  box-shadow: 0 18px 38px rgba(216, 178, 106, 0.22);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-button {
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: #dae4fb;
  text-align: left;
  padding: 14px 15px;
  cursor: pointer;
  transition: 160ms ease;
}

.nav-button:hover,
.nav-button.active {
  background: linear-gradient(180deg, rgba(216, 178, 106, 0.15) 0%, rgba(216, 178, 106, 0.08) 100%);
  border-color: var(--border-strong);
  color: #fff4d5;
}

.main-content {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 24px;
  padding: 10px 4px 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.72rem;
}

.topbar h2 {
  margin: 0;
  font-size: 2.15rem;
  letter-spacing: -0.03em;
}

.topbar-actions,
.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.page-surface {
  display: block;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18, 23, 36, 0.96) 0%, rgba(13, 17, 28, 0.96) 100%);
  box-shadow: var(--shadow);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
  pointer-events: none;
}

.card > * {
  position: relative;
}

.grid {
  display: grid;
  gap: 18px;
}

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

.metric {
  margin: 10px 0 4px;
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: #f7e6bb;
  border: 1px solid rgba(216, 178, 106, 0.18);
}

.badge.success {
  background: rgba(99, 196, 142, 0.14);
  color: var(--success);
  border-color: rgba(99, 196, 142, 0.2);
}

.badge.warning {
  background: rgba(255, 182, 91, 0.12);
  color: var(--warning);
  border-color: rgba(255, 182, 91, 0.2);
}

.badge.danger {
  background: rgba(255, 123, 134, 0.12);
  color: var(--danger);
  border-color: rgba(255, 123, 134, 0.2);
}

.ghost-button,
.primary-button,
.inline-button {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: 160ms ease;
}

.ghost-button {
  background: rgba(20, 26, 40, 0.94);
  color: var(--text);
  border-color: var(--border);
}

.primary-button {
  background: linear-gradient(180deg, #e6c37e 0%, #b68a47 100%);
  color: #151821;
}

.inline-button {
  background: rgba(31, 39, 58, 0.96);
  color: var(--text);
  border-color: var(--border);
}

.ghost-button:hover,
.primary-button:hover,
.inline-button:hover {
  transform: translateY(-1px);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.list-item:first-child {
  padding-top: 0;
}

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

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

.table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

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

.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
}

.kv div:nth-child(odd) {
  color: var(--muted);
}

.login-card {
  width: min(100%, 460px);
}

.login-brand {
  margin-bottom: 18px;
}

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

.login-error {
  color: var(--danger);
  font-weight: 600;
}

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

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 12px;
  color: var(--text);
  background: rgba(11, 15, 24, 0.96);
}

.span-2 {
  grid-column: 1 / -1;
}

.login-button {
  width: 100%;
}

.empty-state {
  padding: 30px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 18px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .grid.cols-4,
  .grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .main-content {
    padding: 18px;
  }

  .topbar {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar h2 {
    font-size: 1.8rem;
  }

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