:root {
  --bg: #eef2f7;
  --ink: #162033;
  --muted: #667085;
  --panel: #ffffff;
  --line: #d9e2ef;
  --nav: #111827;
  --nav-2: #1d2939;
  --blue: #2563eb;
  --green: #12b76a;
  --amber: #f79009;
  --red: #d92d20;
  --shadow: 0 18px 45px rgba(22, 32, 51, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  background: var(--nav);
  color: #f8fafc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--nav);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong { display: block; font-size: 18px; letter-spacing: 0; }
.brand small { display: block; color: #aeb9ca; font-size: 12px; margin-top: 2px; }

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  color: #d0d5dd;
  font-size: 14px;
  font-weight: 650;
}

.side-nav a:hover {
  background: var(--nav-2);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 12px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
}

.content {
  min-width: 0;
}

.topbar {
  min-height: 164px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 34px 38px 70px;
  background: #182230;
  color: #fff;
}

.eyebrow {
  margin: 0 0 8px;
  color: #9ee6c4;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
}

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

.page-panel {
  width: min(1180px, calc(100% - 48px));
  margin: -46px auto 34px;
  padding: 24px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(217,226,239,0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.page-panel > h1 {
  display: none;
}

h2 {
  margin: 26px 0 12px;
  font-size: 18px;
  letter-spacing: 0;
}

.button,
button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.button.ghost {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.22);
}

.danger { background: var(--red); }

label {
  display: grid;
  gap: 7px;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

label.check {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
}

label.check input {
  min-width: 0;
  height: auto;
}

input,
select {
  height: 40px;
  min-width: 180px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
  font: inherit;
  font-weight: 600;
}

input:focus,
select:focus {
  outline: 3px solid rgba(37,99,235,0.16);
  border-color: var(--blue);
}

.inline-form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.row-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  min-width: 720px;
}

.row-form button {
  width: fit-content;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 20px;
}

.metrics div {
  min-height: 106px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  margin-bottom: 12px;
}

.metrics strong {
  display: block;
  font-size: 28px;
  line-height: 1.12;
  word-break: break-word;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

th {
  background: #f8fafc;
  color: #667085;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

td small {
  color: var(--muted);
}

code {
  display: inline-block;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 6px;
  background: #eef4ff;
  color: #1849a9;
  font-family: Consolas, ui-monospace, monospace;
  font-size: 12px;
  word-break: break-all;
}

.notice,
.error {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 700;
}

.notice {
  background: #ecfdf3;
  color: #067647;
  border: 1px solid #abefc6;
}

.error {
  background: #fef3f2;
  color: #b42318;
  border: 1px solid #fecdca;
}

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

.login-box {
  width: min(440px, 100%);
  display: grid;
  gap: 15px;
  padding: 28px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(0,0,0,0.32);
}

.login-box h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

.login-box p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.login-box a {
  color: var(--blue);
  font-weight: 800;
}

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

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

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

  .topbar {
    min-height: 132px;
    padding: 24px 20px 58px;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .page-panel {
    width: calc(100% - 24px);
    padding: 16px;
  }

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

