/* Admin dashboard — utilitarian blue & white */
:root {
  --blue-900: #0E2A54;
  --blue-700: #164B8F;
  --blue-600: #1C5CB0;
  --blue-50: #F2F6FB;
  --white: #FFF;
  --ink: #16233A;
  --muted: #5B6B84;
  --line: #D5DEEC;
  --danger: #B3372F;
  --ok-bg: #E6F4EA; --ok-ink: #1E6B34;
  --err-bg: #FBE9E9; --err-ink: #9B2C2C;
}
* { box-sizing: border-box; }
body.admin {
  margin: 0;
  font-family: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.98rem;
  color: var(--ink);
  background: var(--blue-50);
}
h1, h2 { font-family: "Saira Condensed", "Arial Narrow", Arial, sans-serif; text-transform: uppercase; letter-spacing: 0.02em; }
h1 { font-size: 1.8rem; margin: 0 0 1.25rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.8rem; color: var(--blue-900); }
.stat-num, .badge, .pill, td .mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
a { color: var(--blue-600); }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 15rem; flex-shrink: 0; background: var(--blue-900); color: #C9D8EE;
  display: flex; flex-direction: column; padding: 1.25rem 0;
}
.sidebrand { padding: 0 1.25rem 1.25rem; font-weight: 700; font-size: 1.15rem; color: var(--white); border-bottom: 1px solid rgba(255,255,255,0.12); font-family: "Saira Condensed", Arial, sans-serif; text-transform: uppercase; letter-spacing: 0.04em; }
.sidebrand span { font-weight: 400; font-size: 0.8rem; color: #9DBCE4; }
.sidebar nav { display: flex; flex-direction: column; padding: 0.75rem 0; flex: 1; }
.sidebar nav a { color: #C9D8EE; text-decoration: none; padding: 0.55rem 1.25rem; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255,255,255,0.07); color: var(--white); }
.sidebar nav a.active { background: var(--blue-600); color: var(--white); }
.pill { background: #E8B931; color: var(--blue-900); border-radius: 99px; font-size: 0.72rem; padding: 0.05rem 0.5rem; margin-left: 0.3rem; }
.sidefoot { padding: 1rem 1.25rem 0; border-top: 1px solid rgba(255,255,255,0.12); display: flex; flex-direction: column; gap: 0.4rem; }
.sidefoot a { color: #9DBCE4; font-size: 0.85rem; text-decoration: none; }

.adminmain { flex: 1; padding: 2rem 2.25rem; min-width: 0; }
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .adminmain { padding: 1.25rem; }
}

.pagetop { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.pagetop h1 { margin: 0; }

.statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 1.1rem 1.3rem; text-decoration: none; color: var(--ink); }
.stat.attention { border-left: 4px solid #E8B931; }
.stat-num { display: block; font-size: 2rem; font-weight: 700; color: var(--blue-700); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 0.88rem; }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr)); gap: 1.25rem; align-items: start; }
.apanel { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 1.3rem 1.5rem; overflow-x: auto; }

table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th { text-align: left; font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--blue-900); padding: 0.45rem 0.6rem; }
td { border-bottom: 1px solid var(--line); padding: 0.55rem 0.6rem; vertical-align: top; }
.listtable { background: var(--white); border: 1px solid var(--line); border-radius: 6px; }
.listtable th, .listtable td { padding-left: 1rem; padding-right: 1rem; }
.rowactions { text-align: right; }
.linkdanger { background: none; border: none; color: var(--danger); cursor: pointer; font: inherit; font-size: 0.85rem; padding: 0; }
.empty { color: var(--muted); font-style: italic; }

.badge { display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; border-radius: 3px; padding: 0.15rem 0.5rem; background: var(--blue-50); color: var(--blue-700); }
.badge-new, .badge-requested { background: #FBF3D7; color: #7A5E12; }
.badge-confirmed, .badge-enrolled { background: var(--ok-bg); color: var(--ok-ink); }
.badge-declined, .badge-cancelled { background: var(--err-bg); color: var(--err-ink); }
.badge-completed, .badge-closed, .badge-contacted { background: #E8EDF5; color: var(--muted); }

.filterrow { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip { border: 1px solid var(--line); background: var(--white); border-radius: 99px; padding: 0.25rem 0.9rem; font-size: 0.85rem; text-decoration: none; color: var(--ink); }
.chip.on { background: var(--blue-600); border-color: var(--blue-600); color: var(--white); }

.form { display: flex; flex-direction: column; gap: 0.9rem; }
.formwide { max-width: 42rem; background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 1.5rem; }
.form label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.88rem; }
.form .checkline { flex-direction: row; align-items: center; gap: 0.5rem; }
.form input[type="text"], .form input[type="email"], .form input[type="password"], .form input[type="number"],
.form select, .form textarea {
  font: inherit; font-weight: 400; padding: 0.5rem 0.65rem;
  border: 1px solid var(--line); border-radius: 4px; background: var(--white); color: var(--ink); width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--blue-600); outline-offset: 1px; }

.btn { display: inline-block; padding: 0.55rem 1.2rem; border-radius: 4px; text-decoration: none; font-weight: 600; font-size: 0.92rem; border: 1px solid transparent; cursor: pointer; font-family: inherit; }
.btn-primary { background: var(--blue-600); color: var(--white); }
.btn-primary:hover { background: var(--blue-700); }
.btn-primary:disabled { background: var(--muted); cursor: not-allowed; }
.btn-ghost { border-color: var(--blue-600); color: var(--blue-600); background: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btnrow { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.deflist dt { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin-top: 0.7rem; }
.deflist dd { margin: 0.1rem 0 0; }
.deflist p { margin: 0.2rem 0; }

.flash { padding: 0.75rem 1.1rem; border-radius: 4px; margin: 0 0 1rem; font-weight: 500; }
.flash-success { background: var(--ok-bg); color: var(--ok-ink); }
.flash-error { background: var(--err-bg); color: var(--err-ink); }

/* Login */
body.bare { display: grid; place-items: center; min-height: 100vh; }
.loginbox { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 2.25rem 2.5rem; width: min(24rem, 92vw); }
.loginbox h1 { font-size: 1.3rem; margin-bottom: 0.2rem; }
.loginbox .sub { color: var(--muted); margin: 0 0 1.25rem; }
