:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2a2320;
  --muted: #8a807a;
  --accent: #d9663f; /* warm terracotta — placeholder brand colour */
  --line: #ece5dd;
  --danger: #a3271b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.wrap { max-width: 900px; margin: 0 auto; padding: 24px; }
h1 { margin: 0 0 12px; }
h2 { margin: 0 0 12px; font-size: 18px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.error {
  background: #fdecea; color: var(--danger); padding: 10px 12px;
  border-radius: 8px; margin: 12px 0;
}
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px; margin: 16px 0;
}
.login { max-width: 360px; margin: 10vh auto; text-align: center; }
label { display: block; text-align: left; margin: 10px 0; font-weight: 600; font-size: 14px; }
input, select, textarea {
  width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 16px;
  background: #fff; font-family: inherit;
}
textarea { resize: vertical; }
.inline-form label.wide { grid-column: 1 / -1; }
button {
  background: var(--accent); color: #fff; border: 0; cursor: pointer;
  padding: 10px 16px; border-radius: 8px; font-size: 15px; font-weight: 600;
}
button.link { background: none; color: var(--muted); padding: 0; font-weight: 500; }
button.link.danger { color: var(--danger); }

/* Top bar with nav */
.topbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; gap: 16px; flex: 1; min-width: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.nav a.active { color: var(--accent); }
.topbar form { flex-shrink: 0; }

/* Dashboard stats */
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 120px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; text-align: center;
}
.stat b { display: block; font-size: 28px; color: var(--accent); }
.stat span { color: var(--muted); font-size: 14px; }

/* Lists & tables */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list strong { display: block; }

.inline-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; align-items: end;
}
.inline-form button { height: 42px; }

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line);
}
.table th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: 0; }

/* ── Mobile (phones) ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .wrap { padding: 16px 14px; }
  h1 { font-size: 24px; }

  /* One column forms so fields are full-width and easy to tap */
  .inline-form { grid-template-columns: 1fr; }

  /* Turn each table into a stack of labelled cards */
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr {
    border: 1px solid var(--line); border-radius: 12px;
    padding: 8px 14px; margin-bottom: 12px;
  }
  .table td {
    border: 0; padding: 8px 0; display: flex; gap: 10px; align-items: baseline;
    border-bottom: 1px solid var(--line);
  }
  .table td:last-child { border-bottom: 0; }
  .table td::before {
    content: attr(data-label);
    font-weight: 600; color: var(--muted); font-size: 13px;
    min-width: 92px; flex-shrink: 0;
  }
  .table td.right { justify-content: flex-end; }
  .table td.right::before { content: none; }
}
