:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --text: #1c2523;
  --muted: #64736f;
  --line: #d8e1de;
  --primary: #176b5d;
  --primary-dark: #105248;
  --danger: #a32929;
  --danger-bg: #fff0f0;
  --ok-bg: #eefaf5;
  --shadow: 0 18px 48px rgba(22, 38, 34, 0.12);
}

* {
  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;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 650;
}

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

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

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

.secondary {
  background: #e9efed;
  color: var(--text);
}

.secondary:hover {
  background: #dce6e2;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

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

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

.auth-panel {
  padding: 28px;
}

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

h1 {
  margin-bottom: 22px;
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
  line-height: 1.2;
}

.form-stack {
  display: grid;
  gap: 16px;
}

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

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

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
}

input:focus,
select:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(23, 107, 93, 0.14);
}

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

.topbar h1 {
  margin: 0;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.content {
  width: min(980px, calc(100% - 32px));
  margin: 28px auto;
}

.tool-panel {
  padding: 24px;
}

.history-panel {
  margin-top: 20px;
  padding: 24px;
}

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

.meta {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.wide {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

.alert,
.result {
  display: block;
  border-radius: 7px;
  padding: 12px 14px;
  font-size: 14px;
}

.alert {
  margin-bottom: 16px;
}

.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(163, 41, 41, 0.18);
}

.result {
  min-height: 46px;
  margin-top: 18px;
  background: var(--ok-bg);
  border: 1px solid #cfeee0;
  color: #184d3d;
  white-space: pre-wrap;
}

.result.error {
  background: var(--danger-bg);
  border-color: rgba(163, 41, 41, 0.18);
  color: var(--danger);
}

.result:empty {
  display: none;
}

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

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.history-table th {
  color: var(--muted);
  font-weight: 800;
}

.history-table tbody tr {
  cursor: pointer;
}

.history-table tbody tr:hover {
  background: #f6faf8;
}

.history-table tbody tr.selected {
  background: #e6f3ef;
}

.history-table tr[data-status="failed"] td[data-cell="status"] {
  color: var(--danger);
  font-weight: 800;
}

.history-table tr[data-status="success"] td[data-cell="status"] {
  color: var(--primary);
  font-weight: 800;
}

.history-table tr[data-status="canceled"] td[data-cell="status"] {
  color: var(--muted);
  font-weight: 800;
}

.history-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 680px) {
  .topbar,
  .panel-header,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .tool-panel,
  .history-panel,
  .auth-panel {
    padding: 20px;
  }
}
