:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #071015;
  color: #edf4f7;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #071015;
}

body.modal-open {
  overflow: hidden;
}

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

button {
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  background: #2f7dff;
  color: white;
  font-weight: 700;
  padding: 10px 14px;
}

button.danger {
  background: #bc2f42;
}

button.secondary {
  background: #1d2a32;
  color: #c5d1d8;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #26363f;
  border-radius: 8px;
  background: #101a20;
  color: #edf4f7;
  padding: 10px 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #aebdc5;
  font-size: 13px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

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

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid #23323a;
  border-radius: 10px;
  background: #0c151b;
  padding: 28px;
}

.login-panel h1,
.sidebar h1 {
  margin: 0;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid #17252d;
  background: #091219;
  padding: 22px;
}

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

.nav-item {
  text-align: left;
  background: transparent;
  color: #9fb0b9;
}

.nav-item.active {
  background: #123047;
  color: #ffffff;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 22px;
}

.topbar,
.panel-header,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.api-input {
  width: min(520px, 70vw);
}

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

.stats-grid article,
.panel {
  border: 1px solid #1e3039;
  border-radius: 8px;
  background: #0d171d;
}

.stats-grid article {
  display: grid;
  gap: 4px;
  padding: 16px;
}

.stats-grid span {
  font-size: 26px;
  font-weight: 800;
}

.stats-grid small {
  color: #93a6b0;
}

.section {
  display: none;
}

.section.active {
  display: grid;
  gap: 16px;
}

.panel {
  padding: 16px;
}

.panel h2 {
  margin: 0;
}

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

.wide {
  grid-column: 1 / -1;
}

.inline-form {
  display: grid;
  grid-template-columns: 90px 1fr 90px 120px auto;
  gap: 10px;
}

.table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #1c2b33;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #9eb0ba;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: #e7eff3;
  font-size: 14px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message {
  min-height: 20px;
  margin: 0;
  color: #ffd37a;
}

.modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.68);
  padding: 24px;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(860px, calc(100vh - 48px));
  overflow-y: auto;
  border: 1px solid #29404b;
  border-radius: 8px;
  background: #0d171d;
  padding: 20px;
}

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

.modal-header h2 {
  margin: 0;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

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

  .sidebar {
    position: static;
    height: auto;
    gap: 16px;
  }

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

  .stats-grid,
  .grid-form,
  .inline-form {
    grid-template-columns: 1fr;
  }
}
