/* Adjusted Health + Performance — brand tokens */
:root {
  --ahp-dark-blue: #021C41;
  --ahp-light-blue: #5C7D99;
  --ahp-white: #FFFFFF;
  --ahp-off-white: #FAFAF7;
  --ahp-gold: #BAA682;
  --ahp-stone: #D9D6D1;
  --ahp-beige: #EDEBE5;
  --ahp-black: #000000;
  --font-head: 'Space Grotesk', 'Archivo', sans-serif;
  --font-body: 'Libre Franklin', sans-serif;
  --shadow: 0 1px 3px rgba(2, 28, 65, 0.08), 0 4px 16px rgba(2, 28, 65, 0.05);
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--ahp-off-white);
  color: var(--ahp-dark-blue);
  font-size: 14px;
  line-height: 1.55;
}

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 232px; flex-shrink: 0;
  background: var(--ahp-dark-blue);
  color: var(--ahp-off-white);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(250, 250, 247, 0.12);
}
.sidebar .brand h1 {
  font-family: var(--font-head); font-weight: 500;
  font-size: 17px; letter-spacing: 0.01em; color: var(--ahp-white);
}
.sidebar .brand h1 span { color: var(--ahp-gold); }
.sidebar .brand p { font-size: 11px; color: var(--ahp-light-blue); margin-top: 2px; letter-spacing: 0.08em; text-transform: uppercase; }
.sidebar nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.sidebar nav .section { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ahp-light-blue); padding: 14px 12px 6px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--ahp-off-white); text-decoration: none;
  font-size: 13.5px; margin-bottom: 2px;
}
.sidebar nav a:hover { background: rgba(92, 125, 153, 0.25); }
.sidebar nav a.active { background: var(--ahp-light-blue); color: var(--ahp-white); }
.sidebar nav a .badge { margin-left: auto; }
.sidebar .foot { padding: 14px 20px; border-top: 1px solid rgba(250,250,247,0.12); font-size: 11px; color: var(--ahp-light-blue); }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; background: var(--ahp-white);
  border-bottom: 1px solid var(--ahp-stone);
  position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-family: var(--font-head); font-weight: 500; font-size: 21px; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }
.content { padding: 26px 28px 60px; max-width: 1240px; width: 100%; }

/* Mode pill */
.mode-pill {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; cursor: pointer; border: none; font-family: var(--font-body);
}
.mode-pill.dry { background: var(--ahp-beige); color: var(--ahp-dark-blue); border: 1px solid var(--ahp-gold); }
.mode-pill.live { background: var(--ahp-dark-blue); color: var(--ahp-white); }

/* Buttons */
.btn {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; background: var(--ahp-light-blue); color: var(--ahp-white);
  transition: filter 0.12s;
}
.btn:hover { filter: brightness(1.07); }
.btn.primary { background: var(--ahp-dark-blue); }
.btn.ghost { background: transparent; color: var(--ahp-dark-blue); border-color: var(--ahp-stone); }
.btn.ghost:hover { background: var(--ahp-beige); filter: none; }
.btn.gold { background: var(--ahp-gold); color: var(--ahp-dark-blue); }
.btn.danger { background: transparent; color: #8a3324; border-color: var(--ahp-stone); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: default; }

/* Cards & grids */
.card {
  background: var(--ahp-white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.card h3 { font-family: var(--font-head); font-weight: 500; font-size: 16px; margin-bottom: 12px; }
.card h3 .sub { font-family: var(--font-body); font-weight: 400; font-size: 12.5px; color: var(--ahp-light-blue); margin-left: 8px; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: 1fr; } }

/* KPI tiles */
.kpi { background: var(--ahp-white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.kpi .label { font-size: 11.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ahp-light-blue); font-weight: 600; }
.kpi .value { font-family: var(--font-head); font-size: 34px; font-weight: 500; margin-top: 4px; }
.kpi .hint { font-size: 12px; color: var(--ahp-light-blue); margin-top: 2px; }
.kpi.gold { border-top: 3px solid var(--ahp-gold); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ahp-light-blue); padding: 8px 10px; border-bottom: 1px solid var(--ahp-stone); font-weight: 600; }
td { padding: 10px; border-bottom: 1px solid var(--ahp-beige); vertical-align: top; }
tr:hover td { background: var(--ahp-off-white); }

/* Badges */
.badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.badge.blue { background: rgba(92, 125, 153, 0.16); color: var(--ahp-dark-blue); }
.badge.gold { background: rgba(186, 166, 130, 0.22); color: #6d5a35; }
.badge.stone { background: var(--ahp-beige); color: var(--ahp-dark-blue); }
.badge.green { background: rgba(74, 124, 89, 0.14); color: #2e5d3e; }
.badge.red { background: rgba(138, 51, 36, 0.12); color: #8a3324; }
.badge.navy { background: var(--ahp-dark-blue); color: var(--ahp-white); }

/* Forms */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ahp-light-blue); margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; font-family: var(--font-body); font-size: 13.5px;
  padding: 9px 11px; border: 1px solid var(--ahp-stone); border-radius: 8px;
  background: var(--ahp-white); color: var(--ahp-dark-blue);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ahp-light-blue); outline-offset: 0; border-color: var(--ahp-light-blue); }
textarea { min-height: 130px; resize: vertical; line-height: 1.5; }

/* Playbook cards */
.playbook { position: relative; display: flex; flex-direction: column; }
.playbook .tagline { color: var(--ahp-dark-blue); font-size: 13.5px; margin-bottom: 8px; }
.playbook .why { font-size: 12.5px; color: #4a5d70; background: var(--ahp-beige); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.playbook .items { font-size: 12.5px; color: var(--ahp-light-blue); margin-bottom: 14px; }
.playbook .items li { margin-left: 16px; margin-bottom: 3px; }
.playbook footer { margin-top: auto; display: flex; align-items: center; gap: 10px; }
.playbook.premium { border-top: 3px solid var(--ahp-gold); }

/* Message preview */
.msg-body { white-space: pre-wrap; font-size: 12.5px; background: var(--ahp-off-white); border: 1px solid var(--ahp-beige); border-radius: 8px; padding: 10px 12px; margin-top: 6px; max-width: 640px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
pre.snippet {
  background: var(--ahp-dark-blue); color: var(--ahp-off-white);
  border-radius: 8px; padding: 14px 16px; overflow-x: auto;
  font-size: 11.5px; line-height: 1.5; margin: 8px 0 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap; word-break: break-all;
}

/* Toast */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: var(--ahp-dark-blue); color: var(--ahp-white);
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow);
  font-size: 13.5px; opacity: 0; transform: translateY(8px); transition: all 0.25s;
  pointer-events: none; max-width: 420px;
}
#toast.show { opacity: 1; transform: none; }
#toast.gold { background: var(--ahp-gold); color: var(--ahp-dark-blue); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(2, 28, 65, 0.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 20px; }
.modal { background: var(--ahp-white); border-radius: 12px; box-shadow: var(--shadow); width: 620px; max-width: 100%; max-height: 86vh; overflow-y: auto; padding: 24px; }
.modal h3 { font-family: var(--font-head); font-weight: 500; font-size: 18px; margin-bottom: 16px; }
.modal .row { display: flex; gap: 12px; }
.modal .row > * { flex: 1; }
.modal footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* Dropzone */
.drop {
  border: 2px dashed var(--ahp-light-blue); border-radius: var(--radius);
  padding: 28px; text-align: center; color: var(--ahp-light-blue);
  background: rgba(92, 125, 153, 0.05); cursor: pointer; transition: background 0.15s;
}
.drop.over, .drop:hover { background: rgba(92, 125, 153, 0.12); }
.drop strong { color: var(--ahp-dark-blue); display: block; font-family: var(--font-head); font-weight: 500; font-size: 15px; margin-bottom: 4px; }

.muted { color: var(--ahp-light-blue); font-size: 12.5px; }

/* Auth screen */
#auth-root:empty { display: none; }
.auth-back {
  position: fixed; inset: 0; z-index: 200; background: var(--ahp-dark-blue);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  background: var(--ahp-off-white); border-radius: 14px; padding: 36px 34px;
  width: 400px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.auth-card .mark {
  font-family: var(--font-head); font-weight: 500; font-size: 20px; color: var(--ahp-dark-blue);
  margin-bottom: 2px;
}
.auth-card .mark span { color: var(--ahp-gold); }
.auth-card .sub { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ahp-light-blue); margin-bottom: 22px; }
.auth-card .err { background: rgba(138, 51, 36, 0.1); color: #8a3324; font-size: 12.5px; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.auth-card .btn { width: 100%; padding: 11px; font-size: 14px; margin-top: 4px; }
.user-chip { font-size: 12px; color: var(--ahp-light-blue); font-weight: 600; }
.spacer { flex: 1; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--ahp-stone); background: var(--ahp-white); cursor: pointer; color: var(--ahp-dark-blue);
  font-family: var(--font-body);
}
.chip.on { background: var(--ahp-dark-blue); color: var(--ahp-white); border-color: var(--ahp-dark-blue); }
.empty { text-align: center; padding: 40px 20px; color: var(--ahp-light-blue); }
.empty strong { display: block; font-family: var(--font-head); font-weight: 500; font-size: 16px; color: var(--ahp-dark-blue); margin-bottom: 6px; }
