/* ==========================================================================
   Triple One Care — Trainer Scheduler
   Brand: Gold #F9C81D / Navy #1A0F54 (same palette as the LMS & Onboarding hub)
   ========================================================================== */

:root{
  --gold: #F9C81D;
  --gold-dark: #C9A100;
  --gold-bg: #FFF6D9;
  --ink: #1A0F54;
  --ink2: #2E1B7A;
  --ink-soft: #362772;
  --paper: #FFFFFF;
  --bg: #F6F5FB;
  --border: #E4E1F2;
  --muted: #5F5A82;
  --red: #D7263D;
  --red-bg: #FDEEEF;
  --green: #1F9D55;
  --green-bg: #EAF7EF;
  --blue: #2563EB;
  --blue-bg: #EAF1FE;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(27,31,39,.06), 0 1px 3px rgba(27,31,39,.08);
  --maxw: 1180px;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;height:100%;}
body{
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  min-height:100%;
}
h1,h2,h3,h4{ font-family: inherit; font-weight:800; line-height:1.25; color:var(--ink); margin:0 0 8px; }
a{ color:var(--gold-dark); }
img,svg{ max-width:100%; }
button{ font-family:inherit; cursor:pointer; }
input,select,textarea{ font-family:inherit; font-size:14px; }
p{ margin:0 0 10px; }

::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{ background:#d5d1e8; border-radius:8px; }

/* "Skip to content" — a standard accessibility link for keyboard users.
   It should be invisible until it receives keyboard focus (Tab), not sit
   permanently at the top of the page. */
.skip-link{
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  z-index: 1000;
  border-radius: 0 0 8px 0;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}
.skip-link:focus{ left: 0; }

/* ---------- Topbar ---------- */
.topbar{ position: sticky; top:0; z-index:100; display:flex; align-items:center; gap:14px; background: var(--ink); color:#fff; padding: 10px 18px; box-shadow: var(--shadow); }
.brand{ display:flex; align-items:center; gap:10px; text-decoration:none; }
.brand-mark-chip{ background:#fff; border-radius:8px; padding:3px 5px; display:flex; align-items:center; justify-content:center; flex:none; box-shadow:0 1px 4px rgba(0,0,0,.25); }
.brand-mark{ width:30px; height:auto; display:block; }
.brand-text{ display:flex; flex-direction:column; line-height:1.1; }
.brand-name{ font-weight:900; font-size:13px; letter-spacing:.06em; color:#fff; }
.brand-tag{ font-size:10px; letter-spacing:.04em; color: var(--gold); text-transform:uppercase; }
.topbar-nav{ display:flex; align-items:center; gap:4px; margin-left:10px; flex-wrap:wrap; }
.topbar-nav a{ color:rgba(255,255,255,.78); text-decoration:none; font-size:13.5px; font-weight:700; padding:8px 12px; border-radius:8px; display:flex; align-items:center; gap:6px; }
.topbar-nav a:hover{ background:rgba(255,255,255,.08); color:#fff; }
.topbar-nav a.active{ background:var(--gold); color:var(--ink); }
.topbar-spacer{ flex:1; }
.topbar-user{ display:flex; align-items:center; gap:10px; }
.topbar-user .who{ text-align:right; line-height:1.2; }
.topbar-user .who strong{ display:block; font-size:13px; }
.topbar-user .who span{ font-size:11px; color:var(--gold); text-transform:uppercase; letter-spacing:.04em; }
.icon-btn{ background:rgba(255,255,255,.1); border:none; color:#fff; width:36px; height:36px; border-radius:9px; display:flex; align-items:center; justify-content:center; }
.icon-btn:hover{ background:rgba(255,255,255,.2); }

/* ---------- Layout ---------- */
.page{ max-width:var(--maxw); margin:0 auto; padding:22px 18px 60px; }
.page-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:18px; }
.page-head h1{ display:flex; align-items:center; gap:12px; font-size:22px; }
.page-sub{ color:var(--muted); font-size:13.5px; margin-top:2px; }
.toolbar{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

.card{ background:var(--paper); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:18px; }
.card + .card{ margin-top:14px; }
.grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.grid-3{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }
@media (max-width:860px){ .grid-2,.grid-3{ grid-template-columns:1fr; } }

.stat-row{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-bottom:16px; }
.stat{ background:var(--paper); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; display:flex; align-items:center; gap:12px; box-shadow:var(--shadow); }
.stat .num{ font-size:22px; font-weight:900; color:var(--ink); line-height:1; }
.stat .label{ font-size:11.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin-top:3px; }

.icon-badge{ border-radius:12px; display:flex; align-items:center; justify-content:center; flex:none; }
.icon-badge.sm{ border-radius:9px; }

/* ---------- Buttons ---------- */
.btn{ display:inline-flex; align-items:center; gap:7px; border-radius:9px; padding:9px 16px; font-weight:700; font-size:13.5px; border:1px solid transparent; text-decoration:none; }
.btn-primary{ background:var(--ink); color:#fff; }
.btn-primary:hover{ background:var(--ink2); }
.btn-gold{ background:var(--gold); color:var(--ink); }
.btn-gold:hover{ background:var(--gold-dark); color:#fff; }
.btn-outline{ background:#fff; color:var(--ink); border-color:var(--border); }
.btn-outline:hover{ border-color:var(--ink); }
.btn-danger{ background:var(--red-bg); color:var(--red); }
.btn-danger:hover{ background:var(--red); color:#fff; }
.btn-sm{ padding:6px 11px; font-size:12.5px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

/* ---------- Forms ---------- */
.field{ margin-bottom:12px; }
.field label{ display:block; font-size:12.5px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; margin-bottom:5px; }
.field input, .field select, .field textarea{
  width:100%; padding:9px 11px; border:1px solid var(--border); border-radius:8px; background:#fff; color:var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus{ outline:2px solid var(--gold); outline-offset:1px; border-color:var(--gold-dark); }
.field-row{ display:flex; gap:10px; }
.field-row .field{ flex:1; }
.checklist-item{ display:flex; align-items:center; gap:8px; font-size:13.5px; }

/* ---------- Tags / status ---------- */
.tag{ display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.03em; padding:3px 9px; border-radius:999px; }
.tag-gold{ background:var(--gold-bg); color:var(--gold-dark); }
.tag-green{ background:var(--green-bg); color:var(--green); }
.tag-red{ background:var(--red-bg); color:var(--red); }
.tag-blue{ background:var(--blue-bg); color:var(--blue); }
.tag-muted{ background:var(--bg); color:var(--muted); }

/* ---------- Login ---------- */
.login-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(160deg,var(--ink) 0%, var(--ink2) 60%, #241668 100%); padding:20px; }
.login-card{ background:#fff; border-radius:16px; width:100%; max-width:400px; padding:32px 28px; box-shadow:0 20px 60px rgba(0,0,0,.35); }
.login-logo{ display:flex; flex-direction:column; align-items:center; gap:10px; margin-bottom:20px; }
.login-logo img{ width:70px; }
.login-logo strong{ font-size:16px; letter-spacing:.03em; }
.login-logo span{ font-size:11.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; }
.pin-dots{ display:flex; gap:10px; justify-content:center; margin:14px 0; }
.pin-dots .dot{ width:16px; height:16px; border-radius:50%; border:2px solid var(--border); }
.pin-dots .dot.filled{ background:var(--ink); border-color:var(--ink); }
.pin-pad{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.pin-pad button{ padding:14px 0; font-size:18px; font-weight:800; border-radius:10px; border:1px solid var(--border); background:#fff; color:var(--ink); }
.pin-pad button:hover{ background:var(--bg); }
.pin-pad button.wide{ font-size:12px; }
.login-error{ background:var(--red-bg); color:var(--red); border-radius:8px; padding:9px 12px; font-size:13px; margin-bottom:12px; }
.person-select{ margin-bottom:16px; }
.back-link{ display:inline-flex; align-items:center; gap:5px; font-size:12.5px; color:var(--muted); text-decoration:none; margin-bottom:10px; background:none; border:none; cursor:pointer; padding:0; }

/* ---------- Table ---------- */
table.data{ width:100%; border-collapse:collapse; font-size:13.5px; }
table.data th{ text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.03em; color:var(--muted); padding:8px 10px; border-bottom:2px solid var(--border); }
table.data td{ padding:9px 10px; border-bottom:1px solid var(--border); vertical-align:top; }
table.data tr:hover td{ background:var(--bg); }
.empty-row{ text-align:center; color:var(--muted); padding:26px !important; }

/* ---------- Schedule list (My Schedule) ---------- */
.timeline{ display:flex; flex-direction:column; gap:10px; }
.tl-item{ display:flex; gap:14px; background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; box-shadow:var(--shadow); }
.tl-date{ flex:none; width:64px; text-align:center; }
.tl-date .d{ font-size:20px; font-weight:900; color:var(--ink); line-height:1; }
.tl-date .m{ font-size:11px; text-transform:uppercase; color:var(--muted); font-weight:700; }
.tl-body{ flex:1; min-width:0; }
.tl-body h4{ font-size:14.5px; margin-bottom:3px; }
.tl-meta{ display:flex; gap:14px; flex-wrap:wrap; font-size:12.5px; color:var(--muted); }
.tl-meta span{ display:flex; align-items:center; gap:5px; }
.tl-item.leave{ border-left:4px solid var(--gold); }
.tl-item.course{ border-left:4px solid var(--ink); }
.tl-item.holiday{ border-left:4px solid var(--green); opacity:.85; }

/* ---------- Region calendar grid ---------- */
.cal-wrap{ overflow-x:auto; background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); }
table.cal{ border-collapse:collapse; font-size:12px; min-width:100%; }
table.cal th, table.cal td{ border:1px solid var(--border); padding:0; text-align:center; }
table.cal thead th{ background:var(--ink); color:#fff; font-weight:700; padding:8px 4px; position:sticky; top:0; z-index:2; white-space:nowrap; font-size:11px; }
table.cal thead th.weekend{ background:var(--ink2); }
table.cal tbody th{ background:var(--bg); text-align:left; padding:8px 10px; font-weight:700; white-space:nowrap; position:sticky; left:0; z-index:1; font-size:12.5px; }
table.cal td.daycell{ width:34px; height:38px; min-width:34px; cursor:default; position:relative; }
table.cal td.weekend{ background:#FAFAFD; }
table.cal td.today{ outline:2px solid var(--gold-dark); outline-offset:-2px; }
.cell-chip{ display:block; width:100%; height:100%; font-size:9.5px; font-weight:800; color:#fff; display:flex; align-items:center; justify-content:center; line-height:1.1; overflow:hidden; }
.cell-chip.leave{ background:var(--gold); color:var(--ink); }
.cell-chip.holiday{ background:var(--green); }
.legend{ display:flex; gap:14px; flex-wrap:wrap; align-items:center; padding:10px 14px; font-size:12px; color:var(--muted); border-top:1px solid var(--border); }
.legend .sw{ display:inline-block; width:12px; height:12px; border-radius:3px; margin-right:5px; vertical-align:-1px; }

/* ---------- Modal ---------- */
.modal-backdrop{ position:fixed; inset:0; background:rgba(20,15,50,.55); display:flex; align-items:flex-start; justify-content:center; padding:40px 16px; overflow:auto; z-index:200; }
.modal{ background:#fff; border-radius:14px; width:100%; max-width:560px; box-shadow:0 20px 60px rgba(0,0,0,.4); }
.modal-head{ display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border); }
.modal-head h3{ margin:0; font-size:16px; }
.modal-body{ padding:18px 20px; max-height:70vh; overflow:auto; }
.modal-foot{ display:flex; justify-content:flex-end; gap:10px; padding:14px 20px; border-top:1px solid var(--border); }
.modal-close{ background:none; border:none; color:var(--muted); }

.subsection{ margin-top:18px; padding-top:14px; border-top:1px solid var(--border); }
.subsection h4{ font-size:13px; display:flex; align-items:center; gap:7px; }
.mini-list{ display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
.mini-row{ display:flex; align-items:center; justify-content:between; gap:10px; background:var(--bg); border-radius:8px; padding:8px 10px; font-size:12.5px; }
.mini-row .grow{ flex:1; }
.mini-row button{ background:none; border:none; color:var(--red); }

.chips{ display:flex; flex-wrap:wrap; gap:6px; }
.chip{ display:inline-flex; align-items:center; gap:5px; background:var(--bg); border:1px solid var(--border); border-radius:999px; padding:4px 10px; font-size:12px; }
.chip button{ background:none; border:none; color:var(--muted); padding:0; display:flex; }
.multiselect{ display:flex; flex-wrap:wrap; gap:6px; }
.msopt{ font-size:12.5px; padding:6px 11px; border-radius:999px; border:1px solid var(--border); background:#fff; cursor:pointer; }
.msopt.selected{ background:var(--ink); color:#fff; border-color:var(--ink); }
.msopt.disabled, .msopt:disabled{ opacity:.4; cursor:not-allowed; text-decoration:line-through; }

/* ---------- Trainer profile / checklist / dashboard additions ---------- */
.field-grid{ display:grid; grid-template-columns:1fr 1fr; gap:0 14px; }
@media (max-width:640px){ .field-grid{ grid-template-columns:1fr; } }
.progress-bar{ background:var(--bg); border-radius:999px; height:10px; overflow:hidden; margin-bottom:16px; }
.progress-fill{ background:var(--gold); height:100%; border-radius:999px; transition:width .2s; }
.unassigned-row th{ color:var(--red); }
.unassigned-row td{ background:var(--red-bg); }
.cell-chip.unassigned{ background:var(--red); color:#fff; }

.banner{ display:flex; align-items:center; gap:10px; padding:11px 15px; border-radius:9px; font-size:13px; margin-bottom:14px; }
.banner.error{ background:var(--red-bg); color:var(--red); }
.banner.info{ background:var(--blue-bg); color:var(--blue); }
.banner.success{ background:var(--green-bg); color:var(--green); }

.region-select{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.region-pill{ font-size:12.5px; font-weight:700; padding:7px 13px; border-radius:999px; border:1px solid var(--border); background:#fff; color:var(--ink); text-decoration:none; }
.region-pill.active{ background:var(--ink); color:#fff; border-color:var(--ink); }
.region-pill .count{ opacity:.65; font-weight:600; margin-left:4px; }

.empty-state{ text-align:center; padding:50px 20px; color:var(--muted); }
.empty-state .icon-badge{ margin:0 auto 14px; }

.loading{ text-align:center; padding:40px; color:var(--muted); font-size:13.5px; }

footer.app-footer{ text-align:center; color:var(--muted); font-size:11.5px; padding:26px 18px 40px; }

@media (max-width:720px){
  .topbar-nav{ display:none; }
  .page-head{ flex-direction:column; align-items:flex-start; }
}
