:root {
  color-scheme: dark;
  --bg: #10110f;
  --panel: #181a16;
  --panel-2: #20241e;
  --panel-3: #252a23;
  --text: #f4f1e8;
  --muted: #aaa99f;
  --line: #343a31;
  --accent: #39c5a5;
  --accent-2: #f0b35d;
  --danger: #ff7b72;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 20% 0%, rgba(57, 197, 165, 0.13), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

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

.login-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 26, 22, 0.96);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  font-size: 3rem;
}

.login-copy {
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.login-form label {
  display: grid;
  gap: 6px;
}

.login-form label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-weight: 750;
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(320px, 1.4fr);
  gap: 18px;
  align-items: end;
  margin: 0 auto 18px;
  max-width: 1760px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(112px, 1fr));
  gap: 8px;
}

.metric {
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #1d201b, #171916);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  line-height: 1;
}

.control-band,
.workspace {
  max-width: 1760px;
  margin: 0 auto;
}

.control-band {
  display: grid;
  grid-template-columns: auto minmax(340px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 26, 22, 0.94);
  box-shadow: var(--shadow);
}

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

.tab,
.ghost {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 750;
}

.tab {
  padding: 0 12px;
}

.tab[aria-selected="true"] {
  border-color: rgba(57, 197, 165, 0.72);
  background: rgba(57, 197, 165, 0.16);
  color: #dffdf5;
}

.ghost {
  padding: 0 12px;
}

.tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) 132px 76px;
  gap: 8px;
  align-items: end;
}

.search,
.select {
  display: grid;
  gap: 4px;
}

.search span,
.select span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #11130f;
  color: var(--text);
  padding: 0 10px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(57, 197, 165, 0.7);
  outline-offset: 2px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(440px, 560px);
  gap: 14px;
  margin-top: 14px;
}

.table-wrap,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 26, 22, 0.96);
  box-shadow: var(--shadow);
}

.table-wrap {
  min-width: 0;
  overflow: hidden;
}

.table-status,
.detail-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.table-status span {
  color: var(--muted);
  font-size: 0.9rem;
}

.table-scroll {
  overflow: auto;
  height: calc(100vh - 260px);
  min-height: 500px;
}

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  table-layout: fixed;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #22271f;
  color: #d9dfd4;
  font-size: 0.74rem;
  text-transform: uppercase;
}

th.is-active {
  background: #27362f;
}

.th-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 8px;
  align-items: center;
  min-height: 28px;
}

.th-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-menu-button {
  display: inline-grid;
  place-items: center;
  grid-template-columns: repeat(3, 3px);
  gap: 2px;
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border: 1px solid rgba(170, 169, 159, 0.28);
  border-radius: 6px;
  background: #151812;
  cursor: pointer;
}

.col-menu-button span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
}

th.is-active .col-menu-button {
  border-color: rgba(57, 197, 165, 0.7);
}

th.is-active .col-menu-button span {
  background: var(--accent);
}

td {
  max-width: 340px;
  overflow: hidden;
  color: #e7e4d8;
  font-size: 0.88rem;
  line-height: 1.35;
  text-overflow: ellipsis;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.is-selected {
  background: rgba(57, 197, 165, 0.11);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #2b3129;
  color: #d9dfd4;
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.pill.todo {
  background: rgba(240, 179, 93, 0.17);
  color: var(--accent-2);
}

.pill.good {
  background: rgba(57, 197, 165, 0.16);
  color: var(--accent);
}

.pill.warn {
  background: rgba(255, 123, 114, 0.16);
  color: var(--danger);
}

.detail-panel {
  min-width: 0;
  align-self: start;
  max-height: calc(100vh - 194px);
  overflow: hidden;
}

.detail-title {
  position: sticky;
  top: 0;
  background: #181a16;
}

dl {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  max-height: calc(100vh - 246px);
}

dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #eeeadd;
  font-size: 0.9rem;
  line-height: 1.42;
}

.detail-code {
  min-width: 0;
}

.detail-code dd {
  white-space: normal;
}

.detail-code pre {
  max-height: 62vh;
  margin: 6px 0 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid #394235;
  border-radius: 8px;
  background: #0b0d0a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.detail-code code {
  color: #f7f1dd;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre;
}

.column-menu {
  position: fixed;
  z-index: 20;
  width: 320px;
  max-height: min(560px, calc(100vh - 32px));
  overflow: hidden;
  border: 1px solid #44503f;
  border-radius: 8px;
  background: #171a15;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.54);
}

.menu-title {
  padding: 12px 12px 8px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.menu-actions,
.menu-toolbar,
.menu-footer {
  display: grid;
  gap: 6px;
  padding: 8px 12px;
}

.menu-actions {
  grid-template-columns: repeat(3, 1fr);
}

.menu-toolbar,
.menu-footer {
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

.menu-actions button,
.menu-toolbar button,
.menu-footer button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
}

.menu-search {
  display: block;
  width: calc(100% - 24px);
  margin: 4px 12px;
}

.menu-values {
  max-height: 284px;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.menu-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  color: #e7e4d8;
  font-size: 0.82rem;
}

.menu-check:hover {
  background: rgba(57, 197, 165, 0.1);
}

.menu-check input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.menu-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-check em,
.menu-hint,
.menu-footer span {
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
}

.menu-hint {
  padding: 8px 12px 0;
}

@media (max-width: 1120px) {
  .topbar,
  .control-band,
  .workspace {
    grid-template-columns: 1fr;
  }

  .tools {
    grid-template-columns: minmax(180px, 1fr) minmax(120px, 1fr) 120px 76px;
  }

  .detail-panel {
    max-height: none;
  }

  dl {
    max-height: 520px;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 14px;
  }

  .meta-grid,
  .tools {
    grid-template-columns: 1fr 1fr;
  }

  .tools .search {
    grid-column: 1 / -1;
  }

  .table-scroll {
    height: 62vh;
    min-height: 420px;
  }

  .column-menu {
    left: 12px !important;
    width: calc(100vw - 24px);
  }
}
