:root {
  color-scheme: light;
  --bg: #f5f2ed;
  --panel: #ffffff;
  --ink: #24211d;
  --muted: #70695f;
  --line: #ded7cc;
  --accent: #9c2f24;
  --accent-dark: #732219;
  --ok: #2f7d4f;
  --warn: #b56b13;
}

* {
  box-sizing: border-box;
}

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

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

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  background: #171411;
  color: #fff;
}

.eyebrow {
  margin: 0 0 4px;
  color: #d9b39b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  color: #f4eee7;
  white-space: nowrap;
}

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

.logout {
  color: #f4eee7;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
}

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

.dot.ok {
  background: var(--ok);
}

.dot.bad {
  background: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  padding: 18px;
}

.usersLayout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  padding: 18px;
}

.bridgeLayout {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(35, 30, 25, .06);
}

.panelHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panelHeader p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.actions,
.formActions {
  display: flex;
  gap: 10px;
}

.rowActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.rowActions form {
  display: inline;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #b9afa2;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

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

textarea {
  min-height: 84px;
  resize: vertical;
}

.tableWrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

td:last-child,
th:last-child {
  text-align: right;
}

.editor {
  padding: 18px;
}

.editor form {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

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

.activity {
  margin: 0 18px 18px;
  padding: 18px;
}

.activity ol {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.activity li {
  margin: 8px 0;
}

.jobsList {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.usersList {
  display: grid;
  gap: 0;
  padding: 0 18px 18px;
}

.userHeader,
.userRow {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 150px 120px minmax(170px, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.userHeader {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.jobRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.jobRow p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.jobStatus {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #f1e7db;
  color: var(--muted);
  font-size: 12px;
}

.jobStatus.confirmed {
  background: #e1f0e6;
  color: var(--ok);
}

.jobStatus.failed {
  background: #f5e2df;
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

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

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

.metricGrid div,
.discoveryGrid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.metricGrid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.metricGrid strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.compactList {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.loginPage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #171411;
}

.loginBox {
  width: min(420px, 100%);
  padding: 24px;
}

.loginBox h1 {
  color: var(--ink);
  font-size: 28px;
  margin-bottom: 18px;
}

.loginBox form {
  display: grid;
  gap: 14px;
}

.error {
  margin: 0 0 14px;
  color: var(--accent);
}

.notice {
  color: var(--ok);
}

.message {
  padding: 12px 18px 0;
}

.checkLabel {
  display: inline-flex;
  align-items: center;
  grid-template-columns: none;
  gap: 8px;
  white-space: nowrap;
}

.checkLabel input {
  width: auto;
  min-height: auto;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px 14px;
}

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

  .usersLayout {
    grid-template-columns: 1fr;
  }

  .metricGrid,
  .discoveryGrid {
    grid-template-columns: 1fr;
  }

  .userHeader {
    display: none;
  }

  .userRow {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .topActions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .status {
    white-space: normal;
  }
}

@media (max-width: 620px) {
  .topbar,
  .layout {
    padding-left: 14px;
    padding-right: 14px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .actions,
  .formActions {
    width: 100%;
  }

  .actions button,
  .formActions button {
    flex: 1;
  }
}
