:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #172026;
  --muted: #68737d;
  --line: #dbe1e6;
  --accent: #0f7b63;
  --accent-2: #1f5b99;
  --danger: #b42318;
  --warning: #a15c00;
  --shadow: 0 16px 40px rgba(24, 34, 45, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 0 16px;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

a {
  color: var(--accent-2);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(16px, 4vw, 48px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

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

.dashboard {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 48px;
}

.status-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr)) auto;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 20px;
}

.metric,
.panel,
.qr-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 20px;
}

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

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

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

.ghost-btn {
  background: var(--surface-2);
  color: var(--text);
}

.compact {
  min-height: 32px;
  padding: 0 12px;
}

.qr-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
  margin-bottom: 20px;
}

.qr-section img {
  width: 220px;
  height: 220px;
  image-rendering: crisp-edges;
}

.hidden {
  display: none;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.count-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
}

.status-pill.sent {
  background: #dff4ec;
  color: #08634f;
}

.status-pill.error {
  background: #fde2df;
  color: var(--danger);
}

.status-pill.running {
  background: #fff2d8;
  color: var(--warning);
}

.summary-list {
  max-height: 620px;
  overflow: auto;
  padding: 10px;
}

.summary-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  width: 100%;
  min-height: 86px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px;
}

.summary-card:hover,
.summary-card.active {
  background: var(--surface-2);
  border-color: var(--line);
}

.summary-title {
  font-weight: 800;
}

.summary-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.detail-panel {
  min-height: 520px;
}

.summary-detail {
  padding: 18px;
}

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

.summary-detail pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-family: inherit;
  line-height: 1.55;
}

.file-actions {
  display: flex;
  gap: 10px;
}

.file-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 72px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

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

.error-box {
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: #fde2df;
  color: var(--danger);
}

.logs-panel {
  min-height: 280px;
}

.logs-list {
  max-height: 360px;
  overflow: auto;
}

.log-row {
  display: grid;
  grid-template-columns: 74px 150px minmax(180px, 1fr) minmax(220px, 1.2fr);
  gap: 12px;
  align-items: start;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.log-row code {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
}

.log-level {
  font-weight: 800;
  text-transform: uppercase;
}

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

.log-level.warn {
  color: var(--warning);
}

.log-level.info {
  color: var(--accent-2);
}

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(15, 123, 99, 0.12), transparent 45%),
    linear-gradient(300deg, rgba(31, 91, 153, 0.12), transparent 50%),
    var(--bg);
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

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

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: white;
}

.form-error {
  min-height: 20px;
  color: var(--danger);
}

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

  .actions,
  .qr-section,
  .detail-header {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    display: grid;
  }

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

.groups-panel {
  margin-bottom: 20px;
}

.groups-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.groups-controls label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: white;
}

.groups-actions {
  display: flex;
  gap: 10px;
}

.groups-list {
  max-height: 260px;
  overflow: auto;
}

.group-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(240px, 1.2fr) 100px;
  gap: 12px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.group-row code {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 980px) {
  .groups-controls,
  .group-row {
    grid-template-columns: 1fr;
  }

  .groups-actions {
    display: grid;
  }
}
