/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:    #1a56db;
  --primary-dk: #1541a8;
  --danger:     #e02424;
  --warning:    #c27803;
  --success:    #057a55;
  --bg:         #f9fafb;
  --surface:    #ffffff;
  --border:     #e5e7eb;
  --text:       #111827;
  --text-muted: #6b7280;
  --font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Hackney status colours (match Working Sheet spec) */
  --hl-yellow:     #fef9c3;
  --hl-orange:     #ffedd5;
  --hl-red:        #fee2e2;
  --hl-blue:       #dbeafe;
  --hl-green:      #dcfce7;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #1e2a3b;
  color: #c8d3e0;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.sidebar .brand {
  padding: 20px 16px 12px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid #2d3a4f;
}

.sidebar nav { flex: 1; padding: 8px 0; }

.sidebar nav a {
  display: block;
  padding: 9px 16px;
  color: #c8d3e0;
  font-size: 13.5px;
  transition: background 0.15s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: #2d3a4f;
  color: #fff;
  text-decoration: none;
}

.sidebar .sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid #2d3a4f;
  font-size: 12px;
  color: #8fa3bc;
}

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.content { flex: 1; padding: 28px 28px; overflow-y: auto; }

/* ── Typography ───────────────────────────────────────────────────────────── */
h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
h2 { font-size: 17px; font-weight: 600; margin-bottom: 16px; }
h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }

.page-title {
  margin-bottom: 20px;
}

.page-title p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 22px;
  margin-bottom: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
}

.stat-card .stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat-card .stat-value.danger { color: var(--danger); }
.stat-card .stat-value.warning { color: var(--warning); }
.stat-card .stat-value.success { color: var(--success); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dk); border-color: var(--primary-dk); color: #fff; text-decoration: none; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); text-decoration: none; }

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

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }

.form-control {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.15);
}

.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--bg);
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 500;
}

.badge-ok      { background: #dcfce7; color: #166534; }
.badge-warning { background: var(--hl-orange); color: #9a3412; }
.badge-danger  { background: var(--hl-red); color: #991b1b; }
.badge-info    { background: var(--hl-blue); color: #1e40af; }
.badge-pending { background: #ede9fe; color: #5b21b6; }
.badge-muted   { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  border-left: 3px solid;
}

.alert-error   { background: var(--hl-red);    border-color: var(--danger);  color: #7f1d1d; }
.alert-warning { background: var(--hl-orange); border-color: var(--warning); color: #78350f; }
.alert-success { background: #dcfce7;          border-color: var(--success); color: #14532d; }
.alert-info    { background: var(--hl-blue);   border-color: var(--primary); color: #1e3a8a; }

/* ── Auth page ────────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 36px 40px;
  width: 100%;
  max-width: 380px;
}

.auth-box h1 { text-align: center; margin-bottom: 4px; }
.auth-box .subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* ── Login form submit button ──────────────────────────────────────────────── */
.auth-box .btn-primary { width: 100%; justify-content: center; padding: 9px; font-size: 14px; }
