:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1e252e;
  --muted: #697386;
  --line: #d9dee7;
  --accent: #176b57;
  --accent-strong: #0f4d3f;
  --danger: #9b1c31;
  --warn-bg: #fff4d8;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

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

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #18202a;
  color: #f8fafc;
  padding: 20px 16px;
}

.brand {
  font-weight: 700;
  margin-bottom: 24px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a,
.nav button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #e5e9ef;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.nav a:hover,
.nav button:hover {
  background: #273343;
}

.nav-user {
  color: #9eabb9;
  font-size: 12px;
  padding: 10px;
}

.content {
  padding: 28px;
  min-width: 0;
}

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

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

h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.auth {
  max-width: 420px;
  margin: 12vh auto;
}

form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.checkbox-label {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-label input {
  width: auto;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
}

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

button,
.button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 9px 12px;
  cursor: pointer;
}

button.secondary,
.button.secondary {
  background: #e7ebf0;
  color: var(--text);
}

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

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

.stacked-actions {
  min-width: 180px;
}

.inline-form {
  grid-template-columns: minmax(150px, 1fr) auto;
  align-items: end;
  width: min(100%, 360px);
}

.category-form {
  grid-template-columns: minmax(150px, 1fr) auto;
  align-items: center;
  min-width: 260px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

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

.notice {
  background: var(--warn-bg);
  border: 1px solid #f0d99b;
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 14px;
}

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

.status {
  display: inline-block;
  min-width: 72px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf2f7;
  text-align: center;
  font-size: 12px;
}

.message-body {
  max-width: 620px;
  white-space: pre-wrap;
}

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

  .sidebar {
    position: static;
  }

  .content {
    padding: 18px;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
