:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1d252d;
  --muted: #6c7782;
  --line: #d8dee5;
  --accent: #167a5a;
  --accent-dark: #0d5d44;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 20px;
  font-weight: 750;
}

nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-weight: 600;
}

.debug-banner {
  background: #fff4d6;
  border-bottom: 1px solid #f2d58d;
  color: #6d4f00;
  font-size: 14px;
  padding: 10px 28px;
}

.shell {
  margin: 0 auto;
  max-width: 1440px;
  padding: 24px;
}

.summary {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 20px;
}

.summary div,
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary div {
  padding: 18px;
}

.summary span,
.label,
dt {
  color: var(--muted);
  font-size: 13px;
}

.summary strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.layout.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  padding: 20px;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0 0 16px;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

.cards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.card {
  padding: 18px;
}

.card.danger {
  border-color: #f4a6a0;
}

.card-head {
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.card-head h2 {
  margin: 4px 0;
}

.card-head p {
  color: var(--muted);
  margin: 0;
}

.card-head strong {
  color: var(--accent-dark);
  font-size: 20px;
  white-space: nowrap;
}

.meter {
  background: #e8edf1;
  border-radius: 999px;
  height: 8px;
  margin: 16px 0;
  overflow: hidden;
}

.meter span {
  background: var(--accent);
  display: block;
  height: 100%;
}

dl {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

dl div {
  display: flex;
  justify-content: space-between;
}

dd {
  margin: 0;
}

form {
  margin: 0;
}

.stack,
.operation-form {
  display: grid;
  gap: 10px;
}

.side {
  display: grid;
  gap: 16px;
  align-content: start;
}

input {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

button {
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 14px;
}

button:hover {
  background: var(--accent-dark);
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.empty {
  color: var(--muted);
  margin: 0;
}

@media (max-width: 900px) {
  .summary,
  .layout,
  .layout.three {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
  }
}
