:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --line: #d9ddd3;
  --text: #17211b;
  --muted: #657064;
  --primary: #176b4d;
  --primary-dark: #0f4a35;
  --danger: #b42318;
  --warning: #b7791f;
  --soft-green: #e7f4ee;
  --soft-red: #fde8e6;
  --soft-amber: #fff4d6;
  --soft-blue: #e8f0fe;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
}

.brand span,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav button,
.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}

.nav button.active,
.button.primary {
  background: var(--primary);
  color: #fff;
}

.button.secondary {
  background: var(--surface);
  color: var(--primary-dark);
  border-color: var(--line);
}

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

.main {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.title {
  margin: 0;
  font-size: 22px;
}

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

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

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfa;
}

.metric strong {
  display: block;
  font-size: 22px;
  margin-top: 6px;
}

.text-block p,
.text-block ul {
  margin: 10px 0 0;
  line-height: 1.45;
}

.text-block ul {
  padding-left: 18px;
}

.row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.row-title h3 {
  margin: 0;
}

.form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fbfcfa;
  color: var(--text);
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

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

.table th {
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-block;
  border-radius: 6px;
  padding: 4px 8px;
  background: #eef1ec;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pill.ok {
  background: var(--soft-green);
  color: var(--primary-dark);
}

.pill.warn {
  background: var(--soft-amber);
  color: var(--warning);
}

.pill.bad {
  background: var(--soft-red);
  color: var(--danger);
}

.notice {
  color: var(--primary-dark);
  font-weight: 800;
}

.error {
  color: var(--danger);
  font-weight: 800;
}

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

.login .panel {
  width: min(440px, 100%);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.photo-row span {
  min-width: 160px;
  color: var(--text);
  font-weight: 800;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

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