:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dde5;
  --accent: #1f7a6f;
  --accent-strong: #135f56;
  --warn: #9a5b00;
  --danger: #b42318;
  --ok: #28715a;
  --shadow: 0 18px 42px rgba(20, 32, 44, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  padding: 24px 18px;
  background: #18222e;
  color: white;
}

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

.mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #62c2b1;
  color: #0c312d;
  font-weight: 800;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: #b8c5d2;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d9e1ea;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.mobile-nav {
  display: none;
}

.workspace {
  padding: 28px;
}

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

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 30px;
  line-height: 1.12;
}

.topbar p,
.muted,
.policy-note {
  color: var(--muted);
}

.account-box {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.account-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 24px 0;
}

.auth-panel[hidden],
body[data-authenticated="false"] .protected {
  display: none;
}

select,
input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 0 11px;
}

button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled,
button:disabled:hover {
  border-color: var(--line);
  background: #e8edf2;
  color: #778494;
  cursor: not-allowed;
}

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

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 18px;
}

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

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.job-list {
  display: grid;
  gap: 10px;
}

.empty-state {
  display: grid;
  gap: 6px;
  min-height: 86px;
  align-content: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  padding: 16px;
}

.empty-state span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.job-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--ink);
  text-align: left;
}

.job-row[data-selected="true"] {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.job-row strong,
.job-row small {
  display: block;
}

.job-row small,
.job-row em,
.line span,
.timeline span {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.job-row.overdue em,
.state.overdue {
  color: var(--danger);
}

.job-row.upcoming em,
.state.upcoming {
  color: var(--warn);
}

.state {
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}

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

.line {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.line strong,
.line span {
  display: block;
}

.timeline {
  margin: 0;
  padding-left: 20px;
}

.timeline li {
  margin-bottom: 8px;
}

.timeline span {
  display: block;
}

.forms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

form {
  display: grid;
  gap: 10px;
}

.message {
  min-height: 22px;
  margin-top: 16px;
  color: var(--ok);
  font-weight: 700;
}

.trace-panel {
  margin-top: 18px;
  scroll-margin-top: 18px;
}

.trace-panel pre {
  max-height: 320px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101820;
  color: #d7f5ec;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.message[data-tone="error"] {
  color: var(--danger);
}

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

  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 16px;
  }

  .mobile-nav .nav-item {
    min-height: 38px;
    margin: 0;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
    text-align: center;
    padding: 0 8px;
  }

  .mobile-nav .nav-item.active,
  .mobile-nav .nav-item:hover {
    border-color: var(--accent);
    background: #e8f5f2;
    color: var(--accent-strong);
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .grid,
  .forms,
  .auth-panel,
  .columns,
  .metrics {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-header,
  .detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .job-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .mobile-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
