:root {
  --bg: #10130f;
  --surface: #f4f1e8;
  --surface-strong: #fffcf2;
  --ink: #151711;
  --muted: #676a5e;
  --line: #d8d0bd;
  --teal: #136b60;
  --teal-dark: #073e39;
  --green: #18724e;
  --red: #b63d45;
  --amber: #b5811f;
  --field: #fffaf0;
  --shadow: rgba(0, 0, 0, 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0, rgba(19, 107, 96, 0.18), transparent 32rem),
    linear-gradient(180deg, #151914 0%, var(--bg) 100%);
  font-family: Inter, system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  min-height: 46px;
  padding: 0 18px;
  color: #fff;
  background: var(--teal-dark);
  font-weight: 800;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

button:hover {
  background: var(--teal);
}

button:active {
  transform: translateY(1px);
}

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

input {
  min-height: 48px;
  width: min(320px, 100%);
  border: 1px solid var(--line);
  padding: 0 14px;
  color: var(--ink);
  background: var(--field);
}

input:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(19, 107, 96, 0.28);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.admin-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.login-panel {
  width: min(460px, 100%);
  border: 1px solid rgba(216, 208, 189, 0.82);
  padding: 34px;
  background: var(--surface);
  box-shadow: 0 22px 80px var(--shadow);
}

.login-brand {
  margin-bottom: 24px;
}

.login-brand span {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--teal-dark);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar,
.panel,
.stat-card,
.notice {
  border: 1px solid var(--line);
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2.4rem, 7vw, 4.25rem);
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
}

.login-form label span {
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-form input,
.login-form button {
  width: 100%;
}

.notice {
  margin-top: 14px;
  padding: 12px 14px;
  color: var(--teal-dark);
  font-weight: 700;
}

.notice[data-tone="error"] {
  border-color: rgba(182, 61, 69, 0.3);
  background: #fff6f5;
  color: var(--red);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.stat-card {
  padding: 18px;
  background: var(--surface-strong);
}

.stat-card span,
.panel-header span,
th,
.format-label span,
.log-list time,
.log-list span {
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  color: var(--teal-dark);
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.panel {
  margin-top: 14px;
  padding: 18px;
}

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

.format-bars {
  display: grid;
  gap: 12px;
}

.format-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.format-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.format-track {
  height: 12px;
  background: #e6dfd1;
}

.format-track span {
  display: block;
  height: 100%;
  background: var(--teal);
}

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

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

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

td {
  font-size: 0.92rem;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  min-width: 88px;
  justify-content: center;
  padding: 4px 8px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge-ok {
  background: var(--green);
}

.badge-fail {
  background: var(--red);
}

.happ-link,
td:last-child,
.log-list code,
.empty-state {
  overflow-wrap: anywhere;
}

.happ-link {
  color: var(--teal-dark);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 700;
}

.log-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.log-list li {
  display: grid;
  grid-template-columns: 180px 150px 210px minmax(220px, 1fr);
  gap: 12px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.log-list p {
  grid-column: 4;
  margin: 0;
}

.log-list strong {
  color: var(--green);
}

.log-fail strong {
  color: var(--red);
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

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

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

  .format-row,
  .log-list li {
    grid-template-columns: 1fr;
  }

  .log-list p {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  body {
    min-width: 320px;
  }

  .admin-shell {
    width: 100%;
    padding-top: 0;
  }

  .login-shell {
    padding: 0;
  }

  .login-panel {
    min-height: 100vh;
    border-left: 0;
    border-right: 0;
    padding: 28px 20px;
  }

  .topbar,
  .panel,
  .stat-card,
  .notice {
    border-left: 0;
    border-right: 0;
  }
}
