:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f5f6f4;
  --panel: #ffffff;
  --ink: #17211b;
  --muted: #627066;
  --line: #d9dfd8;
  --accent: #0a7a3f;
  --accent-dark: #075b30;
  --warn: #b54708;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button,
.docs-link {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 36px;
  padding: 0 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

button:hover,
.docs-link:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: #33443a;
}

button.warn {
  background: var(--warn);
}

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

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

textarea {
  min-height: 330px;
  resize: vertical;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 264px;
  background: #fefefe;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 30px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-head h3 {
  margin: 0;
}

.brand h1 {
  font-size: 17px;
}

.brand p,
.topbar p,
.muted {
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
}

nav a.active,
nav a:hover {
  background: #e7efe9;
}

.session {
  margin-top: auto;
  display: grid;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

main {
  margin-left: 264px;
  min-height: 100vh;
}

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

.login-box {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  display: grid;
  gap: 16px;
}

.login-box h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

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

.app-panel {
  padding: 28px;
  display: grid;
  gap: 22px;
}

.hidden {
  display: none !important;
}

.topbar,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.band {
  background: transparent;
  display: grid;
  gap: 14px;
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 24px;
}

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

.toolbar select {
  width: 280px;
}

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

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

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

th {
  background: #f9faf8;
  color: #405044;
  font-weight: 700;
}

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

td .actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.result {
  min-height: 64px;
  max-height: 240px;
  overflow: auto;
  background: #111;
  color: #eaf2ed;
  border-radius: 8px;
  padding: 12px;
  margin: 0;
  font-size: 12px;
}

.error {
  color: var(--danger);
  min-height: 18px;
  margin: 0;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  background: #111;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 18%);
  font-size: 13px;
}

@media (max-width: 880px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
  }

  main {
    margin-left: 0;
  }

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

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

  .app-panel {
    padding: 18px;
  }
}
