:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #657386;
  --line: #d9dee7;
  --accent: #176c68;
  --accent-strong: #0f524f;
  --warn: #a95d11;
  --ok: #1c7c45;
  --bad: #b13b3b;
  --steel: #516273;
  --shadow: 0 18px 40px rgba(27, 38, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
  line-height: 1.2;
}

.brand span,
p,
label,
.download-row span {
  color: var(--muted);
}

nav {
  display: flex;
  gap: 18px;
  white-space: nowrap;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto 48px;
}

.dashboard-shell {
  width: min(1320px, calc(100vw - 32px));
  margin: 22px auto 48px;
}

.workbench,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(360px, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-grid {
  grid-template-columns: 360px minmax(0, 1fr);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

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

.dashboard-controls {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(130px, max-content) 140px minmax(120px, 1fr) minmax(240px, max-content);
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.dashboard-controls .right {
  justify-self: end;
  align-self: center;
}

.inline-check {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.inline-check input {
  width: 18px;
  min-height: 18px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric span,
.metric small,
.muted,
.empty {
  color: var(--muted);
}

.metric strong {
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.metric small {
  line-height: 1.35;
}

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

h1,
h2 {
  margin: 0 0 16px;
  line-height: 1.15;
  font-weight: 650;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 20px;
}

p {
  margin: 0 0 24px;
  line-height: 1.55;
}

form,
.form-panel,
.toolbar {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 7px;
  font-weight: 600;
}

input,
select,
textarea,
button {
  min-height: 42px;
  border-radius: 6px;
  font: inherit;
  letter-spacing: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(23, 108, 104, 0.2);
  border-color: var(--accent);
}

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

.tight-form {
  gap: 10px;
}

button {
  border: 1px solid var(--accent);
  padding: 9px 15px;
  color: #fff;
  background: var(--accent);
  font-weight: 650;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  border-color: #b6bfca;
  background: #c8ced8;
  cursor: not-allowed;
}

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

.status-row,
.download-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.download-row:first-of-type {
  border-top: 0;
}

.download-row div {
  display: grid;
  gap: 4px;
}

.release-box {
  display: grid;
  gap: 8px;
  margin: 8px 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}

.release-box code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

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

.status-grid div {
  display: grid;
  gap: 5px;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.status-grid span {
  color: var(--muted);
}

.status-grid strong {
  overflow-wrap: anywhere;
}

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

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--warn);
}

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

.result {
  display: block;
  min-height: 42px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: var(--ink);
  background: #f8fafc;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.compact-result {
  max-height: 120px;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.row-actions button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.reply-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.5fr) minmax(160px, 0.7fr) 110px;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  background: #edf2f6;
  color: #354155;
  font-size: 13px;
  text-transform: uppercase;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 3px;
  color: var(--muted);
}

.compact-table table {
  min-width: 540px;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--steel);
  background: #f7f9fb;
  font-weight: 650;
}

.badge.good {
  border-color: rgba(28, 124, 69, 0.26);
  color: var(--ok);
  background: rgba(28, 124, 69, 0.08);
}

.badge.warn {
  border-color: rgba(169, 93, 17, 0.28);
  color: var(--warn);
  background: rgba(169, 93, 17, 0.09);
}

.badge.bad {
  border-color: rgba(177, 59, 59, 0.28);
  color: var(--bad);
  background: rgba(177, 59, 59, 0.08);
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
}

.bar-row span {
  color: var(--muted);
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf0;
}

.bar-track div {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.month-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr));
  gap: 14px;
  align-items: end;
  min-height: 220px;
}

.month-bar {
  display: grid;
  grid-template-rows: 160px auto auto;
  gap: 7px;
  align-items: end;
  text-align: center;
}

.month-fill {
  width: min(42px, 70%);
  justify-self: center;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #176c68 0%, #3b8f7f 100%);
}

.month-bar strong {
  font-size: 13px;
}

.month-bar span {
  color: var(--muted);
}

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
}

@media (max-width: 1120px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .dashboard-controls {
    grid-template-columns: minmax(220px, 1fr) max-content 140px;
  }

  .reply-form {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-controls .right {
    justify-self: start;
  }

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

@media (max-width: 820px) {
  .topbar,
  nav,
  .workbench,
  .admin-grid,
  .dashboard-controls,
  .grid-2,
  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .reply-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 12px 18px;
  }

  .shell {
    width: min(100vw - 20px, 720px);
    margin-top: 16px;
  }

  .dashboard-shell {
    width: min(100vw - 20px, 720px);
    margin-top: 16px;
  }

  .metrics-grid,
  .month-chart,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .month-bar {
    grid-template-columns: minmax(74px, 90px) minmax(0, 1fr) 80px;
    grid-template-rows: auto;
    align-items: center;
    text-align: left;
  }

  .month-fill {
    width: 100%;
    height: 14px !important;
    justify-self: stretch;
    border-radius: 999px;
  }

  h1 {
    font-size: 25px;
  }
}
