:root {
  --navy: #13315c; --navy-2: #1b4b8a; --gold: #f4b400; --coral: #ef6f53; --green: #2f9e6e;
  --ink: #1f2937; --muted: #667085; --line: #e4e7ec; --bg: #f5f7fb;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--navy-2); }
h1, h2 { margin: 0; color: var(--navy); }
h2 { font-size: 1.05rem; margin-bottom: .8rem; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }
.muted { color: var(--muted); }
.req { color: var(--coral); }
.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; margin: 0; }

.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-secondary { background: #fff; color: var(--navy); border-color: #cfd6e0; }
.btn-secondary:hover { border-color: var(--navy); }
.btn-danger { background: #fff; color: #b42318; border-color: #f3c0b8; }
.btn-danger:hover { background: #b42318; color: #fff; }
.btn-small { padding: .3rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; justify-content: center; }

.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex-shrink: 0; background: var(--navy); color: #c9d6e8; padding: 1.2rem .8rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 800; padding: 0 .5rem 1.2rem; }
.side-brand small { display: block; font-weight: 500; color: #9fb3cf; font-size: .78rem; }
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a, .sidebar nav button { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 8px; color: #dbe6f5;
  text-decoration: none; font: inherit; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
.sidebar nav a:hover, .sidebar nav button:hover { background: rgba(255,255,255,.08); }
.sidebar nav a.active { background: rgba(244,180,0,.18); color: #fff; font-weight: 700; }
.side-label { margin: 1.1rem .7rem .3rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #8ba2c4; font-weight: 700; }
.badge { margin-left: auto; background: var(--gold); color: var(--navy); font-size: .75rem; font-weight: 800; padding: .05rem .5rem; border-radius: 999px; }

.admin-main { flex: 1; min-width: 0; padding: 1.4rem 2rem 3rem; }
.admin-top { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.4rem; }
.admin-top h1 { font-size: 1.5rem; flex: 1; }
.top-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.side-toggle { display: none; font-size: 1.4rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; width: 42px; height: 42px; cursor: pointer; }

.flash { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; }
.flash-success { background: #e5f6ee; color: #135c3c; border: 1px solid #b6e3cc; }
.flash-error { background: #fdecea; color: #8a2414; border: 1px solid #f6c3b8; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.3rem; margin-bottom: 1.4rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.panel-head h2 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; align-items: start; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; text-decoration: none; color: var(--ink); border-top: 4px solid var(--gold); }
.stat-card:hover { border-color: var(--navy-2); }
.stat-card span { color: var(--muted); font-weight: 600; font-size: .88rem; }
.stat-card strong { display: block; font-size: 2rem; color: var(--navy); line-height: 1.2; }
.stat-card small { color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: .6rem; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .6rem .7rem; border-bottom: 1px solid var(--line); }
.table td { padding: .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.unread td { font-weight: 700; background: #fffbea; }
.actions-col { text-align: right; white-space: nowrap; width: 1%; }
.actions-col form { display: inline; }
.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; display: block; background: var(--bg); }
.thumb-empty { border: 1px dashed var(--line); }

.status { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #eef2f7; color: var(--navy); }
.status-new { background: #fff4d1; color: #8a5a00; }
.status-contacted { background: #e0edff; color: #1b4b8a; }
.status-assessment-booked { background: #efe5fb; color: #5b2ea6; }
.status-admitted { background: #e1f3ea; color: #135c3c; }
.status-declined { background: #fdecea; color: #8a2414; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chip { padding: .35rem .85rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; font-size: .88rem; }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.form { display: grid; gap: 1rem; }
.narrow-form { max-width: 480px; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 700; }
.form input, .form select, .form textarea, .login-card input { width: 100%; font: inherit; padding: .6rem .75rem; border: 1px solid #cfd6e0; border-radius: 8px; background: #fff; }
.form input:focus, .form select:focus, .form textarea:focus, .login-card input:focus { outline: 2px solid var(--navy-2); outline-offset: 0; border-color: var(--navy-2); }
.form textarea { resize: vertical; }
.help { color: var(--muted); }
.current-file { display: flex; align-items: center; gap: .8rem; padding: .6rem; background: var(--bg); border-radius: 8px; font-size: .9rem; }
.current-file img { width: 70px; height: 52px; object-fit: cover; border-radius: 6px; }
.form-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.form-actions form { display: inline; }

.details { display: grid; grid-template-columns: 170px 1fr; gap: .5rem 1rem; margin: 0 0 1.5rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; }
.note { background: var(--bg); border-radius: 8px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.note p:last-child { margin-bottom: 0; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(135deg, var(--navy), var(--navy-2)); }
.login-card { width: min(400px, 100%); background: #fff; border-radius: 16px; padding: 2.2rem; display: grid; gap: 1rem; text-align: center; box-shadow: 0 25px 50px -12px rgba(0,0,0,.35); }
.login-card img { margin: 0 auto; }
.login-card h1 { font-size: 1.4rem; }
.login-card .muted { margin: -.6rem 0 .2rem; }
.login-card label { display: grid; gap: .3rem; text-align: left; font-weight: 700; }
.login-card .back { font-size: .9rem; }

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 20; left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 10px 0 30px rgba(0,0,0,.2); }
  .sidebar.open { transform: none; }
  .side-toggle { display: block; }
  .admin-main { padding: 1rem; }
  .two-col { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .admin-top { flex-wrap: wrap; }
  .details { grid-template-columns: 1fr; gap: .1rem; }
  .details dd { margin-bottom: .5rem; }
}
