:root {
  --ink: #17201b;
  --muted: #66716c;
  --line: #dce3df;
  --surface: #f5f7f6;
  --panel: #ffffff;
  --teal: #136f63;
  --coral: #e65b3c;
  --yellow: #d7a528;
  --red: #bd2f2f;
  --green: #23855e;
  --shadow: 0 18px 55px rgba(23, 32, 27, 0.11);
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

button.secondary {
  background: #26332d;
}

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

.hidden {
  display: none !important;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--coral);
  font-size: 13px;
  font-weight: 700;
}

.login-screen {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: white;
}

.login-panel {
  width: min(100%, 520px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 0;
  background: white;
}

.login-panel .mark {
  width: 52px;
  height: 52px;
  margin-bottom: 28px;
}

.login-panel h1,
.topbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

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

label {
  display: grid;
  gap: 8px;
  color: #36423d;
  font-size: 14px;
  font-weight: 700;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 12px 13px;
}

textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.55;
}

.error {
  color: var(--red);
  min-height: 22px;
}

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

.side {
  position: sticky;
  top: 0;
  min-height: 100svh;
  padding: 22px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-row img {
  width: 42px;
  height: 42px;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.brand-row span,
.status-block small {
  color: var(--muted);
  font-size: 12px;
}

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

.nav {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
}

.nav.active {
  background: #eef5f2;
  border-color: #cae2d8;
}

.status-block {
  display: flex;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--yellow);
}

.status-dot.online {
  background: var(--green);
}

.status-dot.offline {
  background: var(--red);
}

.workspace {
  padding: 28px;
  min-width: 0;
}

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

.top-pills {
  display: grid;
  gap: 8px;
}

.repo-pill {
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.tab {
  display: none;
  animation: rise 180ms ease both;
}

.tab.active {
  display: block;
}

.request-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(360px, 1.05fr);
  gap: 18px;
}

.access-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
}

.access-grid > .work-panel:last-child {
  grid-column: 1 / -1;
}

.work-panel,
.table-surface,
.jobs-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.work-panel {
  padding: 22px;
}

.work-panel h2,
.split-head h2 {
  margin: 0 0 8px;
  font-size: 21px;
}

.prompt-panel {
  display: grid;
  gap: 14px;
}

.stack-list {
  display: grid;
  gap: 14px;
}

.editor-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.editor-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

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

.field-grid input,
.field-grid textarea {
  min-width: 0;
}

.editor-row textarea {
  min-height: 96px;
}

.active-toggle {
  align-self: end;
  padding-bottom: 12px;
}

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

.permission-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 7px;
}

.permission-cell span,
.permission-cell small {
  display: block;
}

.permission-cell small {
  color: var(--muted);
}

.actions-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  font-weight: 600;
}

.inline-check input {
  width: 17px;
  height: 17px;
}

.decision-empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
}

.decision {
  display: grid;
  gap: 12px;
}

.decision-line {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 8px;
  padding: 5px 9px;
  font-weight: 800;
  font-size: 12px;
}

.badge.allow {
  background: #ddf2e8;
  color: #126743;
}

.badge.review {
  background: #fff1cf;
  color: #77500f;
}

.badge.block {
  background: #ffe0dc;
  color: #9b2f22;
}

.split-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.table-surface {
  overflow: hidden;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td code {
  color: #31413a;
  overflow-wrap: anywhere;
}

.json-editor {
  width: 100%;
  min-height: 62svh;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.jobs-list {
  display: grid;
}

.job-row {
  display: grid;
  grid-template-columns: minmax(180px, 250px) minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.job-row:last-child {
  border-bottom: 0;
}

.job-row p {
  margin: 0;
}

.job-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.status-help {
  margin-top: 8px !important;
  max-width: 230px;
}

.job-progress {
  margin-top: 10px;
  display: grid;
  gap: 4px;
  border-left: 3px solid #cae2d8;
  padding-left: 10px;
}

.job-output {
  margin: 12px 0 0;
  padding: 12px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9f8;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.terminal-mirror {
  margin-top: 12px;
  border: 1px solid #27342f;
  border-radius: 8px;
  overflow: hidden;
  background: #101713;
}

.terminal-mirror-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 9px 11px;
  border-bottom: 1px solid #27342f;
  color: #d7e6dc;
  font-size: 13px;
}

.terminal-mirror-head span {
  color: #9fb0a7;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.terminal-mirror pre {
  margin: 0;
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  color: #d7e6dc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.job-paths {
  margin-top: 10px;
  display: grid;
  gap: 4px;
}

.publication-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid #2f7d68;
  background: #f7f9f8;
  display: grid;
  gap: 6px;
}

.publication-box ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.feedback-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 90px 150px minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes floatIn {
  from {
    transform: translateY(14px) scale(0.985);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (max-width: 940px) {
  .login-screen,
  .app-shell,
  .request-grid,
  .access-grid,
  .field-grid,
  .permission-grid,
  .feedback-row {
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: auto;
    padding: 28px 0;
  }

  .side {
    position: static;
    min-height: auto;
  }

  .topbar,
  .split-head {
    display: grid;
  }

  .job-row {
    grid-template-columns: 1fr;
  }
}
