:root {
  --bg: #EEF0EC;
  --surface: #FFFFFF;
  --surface-alt: #F4F5F1;
  --ink: #1B1E1B;
  --ink-soft: #565B54;
  --line: #DBDED5;
  --apron: #1F5D4E;
  --apron-deep: #154238;
  --brass: #B8843A;
  --brass-soft: #F3E6D2;
  --alert: #B4432E;
  --alert-soft: #F6E1DB;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
}
h1, h2, h3, .display {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 600;
  margin: 0;
}
.mono { font-family: 'IBM Plex Mono', monospace; }

a { color: inherit; text-decoration: none; }

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 4px;
  background: var(--apron); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 13px;
}
.brand-name { font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 17px; font-weight: 600; }
.brand-sub { font-size: 11px; color: var(--ink-soft); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  padding: 8px 12px; font-size: 13px; font-weight: 500; color: var(--ink-soft);
  border-bottom: 2px solid transparent; border-radius: 2px;
}
.nav a.active, .nav a:hover { color: var(--apron); border-color: var(--apron); }
.user-menu { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.logout-link { color: var(--ink-soft); text-decoration: underline; }

.page { padding: 24px; max-width: 1100px; margin: 0 auto; }

/* ---- Cards / layout ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-label { font-size: 11px; text-transform: uppercase; color: var(--ink-soft); letter-spacing: 0.03em; }
.stat-value { font-family: 'Oswald', sans-serif; font-size: 28px; margin-top: 4px; }

.section-title { font-size: 13px; margin-bottom: 12px; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead { background: var(--surface-alt); color: var(--ink-soft); text-transform: uppercase; font-size: 11px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }

/* ---- Forms ---- */
label { font-size: 12px; color: var(--ink-soft); display: block; margin-bottom: 4px; }
input, select {
  width: 100%; padding: 9px 10px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 3px; background: #fff; color: var(--ink);
  font-family: inherit;
}
.form-row { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; font-size: 13px; font-weight: 600;
  border: none; border-radius: 3px; cursor: pointer;
  background: var(--apron); color: #fff;
}
.btn:hover { background: var(--apron-deep); }
.btn-outline { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: var(--alert); }
.btn-sm { padding: 6px 10px; font-size: 12px; }

/* ---- Badges / alerts ---- */
.badge { font-size: 11px; padding: 3px 8px; border-radius: 10px; font-family: 'IBM Plex Mono', monospace; }
.badge-low { background: var(--alert-soft); color: var(--alert); }
.badge-on { background: var(--brass-soft); color: var(--brass); }
.badge-off { background: var(--surface-alt); color: var(--ink-soft); }
.alert-box {
  display: flex; gap: 10px; padding: 14px; border-radius: 4px;
  background: var(--alert-soft); border: 1px solid rgba(180,67,46,0.2); color: var(--alert);
  margin-bottom: 20px; font-size: 14px;
}

/* ---- Login page ---- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 360px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 32px;
}
.login-card .brand { justify-content: center; margin-bottom: 24px; }
.error-box {
  background: var(--alert-soft); color: var(--alert); padding: 10px 12px;
  border-radius: 3px; font-size: 13px; margin-bottom: 16px;
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
