:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #162033;
  --muted: #687386;
  --line: #dbe2ec;
  --brand: #1463ff;
  --brand-dark: #0b4bd1;
  --danger: #b42318;
  --ok: #027a48;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px 14px 32px;
}

.header {
  display: grid;
  gap: 12px;
  padding: 8px 0 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.18;
}

.notice {
  margin: 0;
  padding: 12px;
  border: 1px solid #b9d0ff;
  border-radius: 8px;
  background: #eef4ff;
  color: #1d355f;
  line-height: 1.55;
}

.panel,
.status-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
button {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  font: inherit;
}

input,
select {
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 10px;
  color: var(--text);
}

.check {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.check input {
  width: 18px;
  min-height: 18px;
  margin: 0 8px 0 0;
}

.check span {
  color: var(--text);
}

button {
  border: 0;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

button:not(:disabled):active {
  background: var(--brand-dark);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0;
}

.status-card {
  padding: 14px;
}

.status-card span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

.status-card strong {
  font-size: 18px;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.debug-panel {
  margin-bottom: 12px;
}

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

.debug-head button {
  width: auto;
  min-height: 32px;
  padding: 0 10px;
  background: #eef4ff;
  color: var(--brand);
}

#debugLog {
  max-height: 180px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  color: #26364f;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
}

.tab {
  width: auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  white-space: nowrap;
}

.tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1250px;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  position: sticky;
  top: 0;
  background: #f9fbff;
  color: var(--muted);
  font-weight: 700;
}

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

.error {
  color: var(--danger);
}

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

@media (max-width: 820px) {
  .controls,
  .status-grid {
    grid-template-columns: 1fr 1fr;
  }

  .controls button,
  .check {
    grid-column: span 2;
  }
}

@media (max-width: 520px) {
  .app {
    padding: 14px 10px 28px;
  }

  h1 {
    font-size: 22px;
  }

  .controls,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .controls button,
  .check {
    grid-column: auto;
  }
}
