:root {
  --ink: #101418;
  --muted: #5f6872;
  --line: #dbe2e8;
  --paper: #f6f8f7;
  --white: #ffffff;
  --teal: #0f766e;
  --lime: #b6d84c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--teal);
  font-weight: 800;
  text-decoration: none;
}

.admin-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 48px auto;
}

.admin-shell.narrow {
  width: min(620px, calc(100% - 36px));
}

.admin-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.admin-actions,
.filter-tabs {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-tabs {
  margin-bottom: 18px;
}

.filter-tabs a {
  padding: 10px 13px;
  border: 1px solid var(--line);
  background: var(--white);
}

.filter-tabs a.active {
  color: var(--ink);
  background: var(--lime);
  border-color: var(--lime);
}

h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 64px);
}

h2 {
  margin: 28px 0 12px;
}

p {
  color: var(--muted);
}

.admin-form,
.detail-list,
.table-wrap,
.panel,
.stats-grid article {
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--white);
}

.admin-form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 14px 15px;
  font: inherit;
}

button {
  min-height: 46px;
  border: 0;
  background: var(--lime);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.link-button {
  min-height: auto;
  padding: 0;
  color: var(--teal);
  background: transparent;
  font-weight: 800;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--white);
}

.alert {
  margin: 18px 0;
  padding: 14px 16px;
  color: #8a2f20;
  background: #fff0ec;
  border: 1px solid #ffd0c5;
}

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

.panel,
.stats-grid {
  margin-bottom: 24px;
}

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

.stats-grid article {
  display: grid;
  gap: 10px;
}

.stats-grid span,
.section-title p {
  color: var(--muted);
}

.stats-grid strong {
  font-size: 34px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.section-title h2,
.section-title p {
  margin: 0;
}

.section-title p {
  margin-top: 6px;
}

.table-wrap.compact {
  padding: 0;
  border: 0;
}

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

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
}

tr.unread td:first-child {
  color: var(--teal);
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(16 20 24 / 54%);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(760px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: 0 24px 70px rgb(16 20 24 / 24%);
}

.modal-header,
.modal-actions,
.modal-badges {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-header {
  justify-content: space-between;
}

.modal-header h2,
.modal-header p,
.modal-panel h3 {
  margin: 0;
}

.icon-button {
  width: 42px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 24px;
  line-height: 1;
}

.modal-badges {
  margin: 18px 0;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  color: var(--teal);
  border: 1px solid color-mix(in srgb, var(--teal) 35%, var(--line));
  background: #eefaf8;
  font-weight: 800;
}

.badge.done {
  color: #526100;
  border-color: #d7e99a;
  background: #f5fbdf;
}

.modal-detail-list {
  grid-template-columns: 110px 1fr;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.modal-message {
  max-height: 240px;
  overflow: auto;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0;
}

pre {
  white-space: pre-wrap;
  line-height: 1.7;
  padding: 18px;
  background: var(--paper);
}

@media (max-width: 680px) {
  .admin-header,
  dl {
    display: grid;
  }

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

  dl {
    grid-template-columns: 1fr;
  }

  .modal-panel {
    padding: 18px;
  }

  .modal-detail-list {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    justify-content: stretch;
    display: grid;
  }
}
