:root {
  --navy: #142f52;
  --navy-dark: #0c2340;
  --orange: #f28c00;
  --orange-dark: #d97800;
  --orange-soft: #fff4e2;
  --blue-soft: #eef5fb;
  --green: #21876f;
  --green-soft: #e7f5f0;
  --red: #b93838;
  --red-soft: #fff0f0;
  --ink: #17283b;
  --muted: #657589;
  --line: #dbe4ed;
  --surface: #fff;
  --background: #f4f7fa;
  --shadow: 0 14px 40px rgb(20 47 82 / 8%);
}

* { box-sizing: border-box; }
html { color-scheme: light; background: var(--background); }
body { margin: 0; min-width: 320px; background: var(--background); color: var(--ink); font-family: Inter, "Segoe UI", Arial, sans-serif; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset[disabled] { opacity: .84; }
input, textarea, select { width: 100%; border: 1px solid #cbd7e3; border-radius: 10px; background: #fff; color: var(--ink); padding: 12px 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 94px; }
input:focus, textarea:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgb(242 140 0 / 14%); }
label > span, .stack-form label > span { display: block; margin-bottom: 6px; color: var(--navy-dark); font-size: 13px; font-weight: 750; }
label small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }

.topbar { position: sticky; z-index: 50; top: 0; background: var(--navy); color: #fff; box-shadow: 0 5px 18px rgb(12 35 64 / 15%); }
.topbar__inner { width: min(1180px, calc(100% - 40px)); min-height: 76px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.topbar__accent { height: 5px; background: linear-gradient(90deg, var(--orange) 0 22%, #ffb13b 22% 27%, transparent 27%); }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand__mark { width: 42px; height: 42px; border: 2px solid rgb(255 255 255 / 85%); border-radius: 50%; display: grid; place-items: center; color: #fff; }
.brand > span:last-child, .auth-brand { display: grid; }
.brand strong { font-size: 14px; letter-spacing: .05em; }
.brand small { margin-top: 1px; font-size: 8px; letter-spacing: .14em; opacity: .75; }
.topnav { display: flex; align-items: center; gap: 20px; }
.topnav > a { color: rgb(255 255 255 / 82%); font-size: 13px; font-weight: 650; text-decoration: none; }
.topnav > a:hover { color: #fff; }
.profile-pill { min-width: 165px; padding-left: 20px; border-left: 1px solid rgb(255 255 255 / 18%); display: grid; }
.profile-pill strong { font-size: 12px; }
.profile-pill small { font-size: 10px; opacity: .7; }
.logout-form button { border: 1px solid rgb(255 255 255 / 25%); border-radius: 9px; background: transparent; color: #fff; padding: 8px 10px; font-size: 11px; }
.mobile-menu { display: none; border: 0; background: transparent; color: #fff; font-size: 23px; }

.page-wrap { width: min(1180px, calc(100% - 40px)); min-height: calc(100vh - 160px); margin: 0 auto; padding: 42px 0 58px; }
.page-heading { margin-bottom: 28px; display: flex; align-items: end; justify-content: space-between; gap: 28px; }
.page-heading h1 { margin: 0; color: var(--navy-dark); font-size: clamp(30px, 4vw, 46px); line-height: 1.06; letter-spacing: -.04em; }
.page-heading p:not(.kicker) { margin: 10px 0 0; color: var(--muted); }
.page-heading--session { align-items: center; }
.kicker { margin: 0 0 7px; color: var(--orange); font-size: 10px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.lede { color: var(--muted); }
.muted { color: var(--muted); }
.back-link { display: inline-flex; margin-bottom: 21px; color: #52677d; font-size: 13px; font-weight: 700; text-decoration: none; }
.session-code { border: 1px solid #cbd8e4; border-radius: 999px; background: #fff; padding: 9px 14px; color: #41566c; font-size: 12px; font-weight: 800; }

.button { min-height: 42px; border: 1px solid #cbd8e4; border-radius: 10px; background: #fff; color: var(--navy); padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-size: 13px; font-weight: 800; text-decoration: none; transition: transform .12s, box-shadow .12s, background .12s; }
.button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgb(20 47 82 / 10%); }
.button--primary { border-color: var(--orange); background: var(--orange); color: #fff; }
.button--primary:hover { background: var(--orange-dark); }
.button--secondary { border-color: #b9cadd; background: #f8fbfd; }
.button--danger { border-color: var(--red); background: var(--red); color: #fff; }
.button--small { min-height: 34px; padding: 6px 10px; font-size: 11px; }
.text-link { border: 0; background: none; color: var(--navy); font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }

.flash { width: min(780px, calc(100% - 30px)); margin: 18px auto -12px; border: 1px solid #c9d9e8; border-radius: 12px; background: #fff; padding: 12px 15px; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 24px rgb(20 47 82 / 8%); font-size: 13px; }
.flash > span { width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 900; }
.flash--success { border-color: #b5dfd3; background: var(--green-soft); }
.flash--success > span { background: var(--green); }
.flash--error { border-color: #efc6c6; background: var(--red-soft); }
.flash--error > span { background: var(--red); }
.flash--warning { border-color: #f3d4a7; background: var(--orange-soft); }

.panel, .progress-panel, .journey-panel { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); padding: 25px; }
.panel h2, .journey-panel h2 { margin: 0; color: var(--navy-dark); font-size: 22px; letter-spacing: -.02em; }
.panel__intro { margin: 7px 0 20px; color: var(--muted); font-size: 13px; }
.panel-heading { margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.session-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.session-card { min-height: 250px; border: 1px solid var(--line); border-radius: 18px; background: #fff; padding: 22px; display: flex; flex-direction: column; box-shadow: var(--shadow); text-decoration: none; transition: transform .16s, border-color .16s; }
.session-card:hover { transform: translateY(-3px); border-color: #bacada; }
.session-card > div:first-child { display: flex; justify-content: space-between; gap: 12px; }
.session-card h2 { margin: 24px 0 8px; color: var(--navy-dark); font-size: 20px; line-height: 1.25; }
.session-card p { margin: 3px 0; color: var(--muted); font-size: 13px; }
.session-card__code { color: #718094; font-size: 11px; font-weight: 800; }
.session-card__action { margin-top: auto; padding-top: 18px; color: var(--orange-dark); font-size: 12px; font-weight: 800; }
.status { display: inline-flex; width: fit-content; border-radius: 999px; padding: 5px 9px; background: var(--blue-soft); color: var(--navy); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.status--open { background: var(--green-soft); color: #176b59; }
.status--locked { background: var(--red-soft); color: var(--red); }

.empty-state { border: 1px dashed #bdccda; border-radius: 20px; background: rgb(255 255 255 / 65%); padding: 70px 25px; text-align: center; }
.empty-state > span { color: var(--orange); font-size: 42px; }
.empty-state h2 { margin: 10px 0 4px; color: var(--navy-dark); }
.empty-state p { margin: 0; color: var(--muted); }
.empty-state--small { padding: 25px; }

.modal { width: min(650px, calc(100% - 30px)); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 25px 80px rgb(12 35 64 / 28%); }
.modal::backdrop { background: rgb(12 35 64 / 55%); backdrop-filter: blur(3px); }
.modal > div { padding: 30px; }
.modal h2 { margin: 0 0 22px; color: var(--navy-dark); }
.modal__close { position: absolute; top: 12px; right: 12px; }
.modal__close button { width: 35px; height: 35px; border: 0; border-radius: 50%; background: #eef2f6; color: #53667b; font-size: 21px; }

.stack-form { display: grid; gap: 17px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.admin-columns { margin: 26px 0; display: grid; grid-template-columns: 1.15fr .85fr; gap: 22px; align-items: start; }
.file-drop { min-height: 125px; border: 2px dashed #b9c9d7; border-radius: 14px; background: #f8fbfd; display: grid; place-items: center; align-content: center; text-align: center; cursor: pointer; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop > span { margin: 0; color: var(--navy); font-weight: 800; }
.file-drop small { color: var(--muted); }
.import-preview { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.import-preview table { width: 100%; border-collapse: collapse; font-size: 11px; }
.import-preview th, .import-preview td { border-bottom: 1px solid #edf1f5; padding: 8px; text-align: left; }
.import-preview th { position: sticky; top: 0; background: var(--navy); color: #fff; }
.import-summary { margin: 0; padding: 10px; background: var(--green-soft); color: #176b59; font-size: 12px; font-weight: 800; }
.import-error { margin: 0; padding: 10px; background: var(--red-soft); color: var(--red); font-size: 12px; }

.metric-grid { margin: 10px 0 26px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric-grid article { border: 1px solid var(--line); border-radius: 15px; background: #fff; padding: 18px; display: grid; box-shadow: 0 8px 25px rgb(20 47 82 / 5%); }
.metric-grid strong { color: var(--navy-dark); font-size: 25px; line-height: 1; }
.metric-grid span { margin-top: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.lock-banner, .privacy-banner { margin: 0 0 23px; border: 1px solid #d9c4a7; border-radius: 14px; background: var(--orange-soft); padding: 14px 17px; display: flex; align-items: center; gap: 13px; }
.lock-banner > span, .privacy-banner > span { flex: none; width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font-size: 12px; font-weight: 900; }
.lock-banner strong { color: var(--navy-dark); }
.lock-banner p, .privacy-banner p { margin: 2px 0 0; color: #4d6175; font-size: 12px; }
.privacy-banner { border-color: #c8d9e9; background: var(--blue-soft); }

.roster-panel { margin-bottom: 24px; padding: 0; overflow: hidden; }
.roster-panel > .panel-heading { margin: 0; padding: 23px 25px; border-bottom: 1px solid var(--line); }
.roster-table { overflow-x: auto; }
.roster-row { min-width: 900px; padding: 13px 24px; border-bottom: 1px solid #edf1f5; display: grid; grid-template-columns: 2.2fr 1.1fr .9fr .85fr .9fr; align-items: center; gap: 18px; font-size: 12px; }
.roster-row:last-child { border-bottom: 0; }
.roster-row--head { min-height: 42px; background: #f7f9fb; color: #6d7d90; font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.person-cell { display: flex; align-items: center; gap: 11px; }
.person-cell > span, .trainer-list article > span { flex: none; width: 37px; height: 37px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font-size: 10px; font-weight: 850; }
.person-cell > div, .trainer-list article > div { display: grid; }
.person-cell small, .trainer-list small { color: var(--muted); font-size: 10px; }
.progress { height: 7px; overflow: hidden; border-radius: 99px; background: #e8edf2; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), #ffb13b); }
.roster-row > div:nth-child(2) small { color: var(--muted); }
.tag { width: fit-content; border-radius: 999px; background: var(--blue-soft); color: #425b74; padding: 5px 8px; font-size: 9px; font-weight: 850; }
.tag--acquis { background: var(--green-soft); color: #176b59; }
.tag--non_acquis, .tag--abandon { background: var(--red-soft); color: var(--red); }
.row-actions { display: flex; align-items: center; justify-content: end; gap: 7px; }
.row-actions form { margin: 0; }
.row-actions form button { width: 33px; height: 33px; border: 1px solid #cdd9e4; border-radius: 8px; background: #fff; color: var(--navy); }
.trainer-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.trainer-list article { border: 1px solid #e3e9ef; border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 11px; }
.trainer-list article form { margin-left: auto; }

.closure-panel { margin-top: 24px; border-color: #edc88f; background: linear-gradient(135deg, #fff 45%, var(--orange-soft)); }
.closure-panel > div:first-child p:not(.kicker) { max-width: 760px; color: var(--muted); }
.closure-actions { margin-top: 18px; display: flex; align-items: center; gap: 15px; }
.archive-status { color: var(--muted); font-size: 12px; }
.danger-zone { margin-top: 25px; border-top: 1px solid #edc7c7; padding-top: 24px; display: grid; grid-template-columns: 1fr 1.3fr; gap: 25px; }
.danger-zone strong { color: var(--red); }
.danger-zone p { color: var(--muted); font-size: 12px; }
.danger-zone form { display: grid; gap: 12px; }
.check-line { display: flex; align-items: start; gap: 8px; }
.check-line input { width: auto; margin-top: 3px; }
.check-line > span { margin: 0; font-weight: 600; }

.dossier-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.progress-panel { position: sticky; top: 105px; }
.progress-panel > strong { display: block; margin: 8px 0 15px; color: var(--navy-dark); font-size: 44px; line-height: 1; letter-spacing: -.05em; }
.progress-panel > p { color: var(--muted); font-size: 12px; }
.progress-panel .button { width: 100%; margin-top: 8px; }
.journey-panel { padding: 0; overflow: hidden; }
.journey-panel .panel-heading { margin: 0; padding: 24px 25px; border-bottom: 1px solid var(--line); }
.journey-list { padding: 8px 23px 22px; }
.journey-step { position: relative; min-height: 85px; display: grid; grid-template-columns: 42px 1fr 22px; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.journey-step::after { position: absolute; content: ""; left: 20px; top: 62px; bottom: -22px; width: 2px; background: #e4eaf0; }
.journey-step:last-child::after { display: none; }
.journey-step > span { position: relative; z-index: 2; width: 42px; height: 42px; border: 2px solid #d7e0e8; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #8593a3; font-size: 12px; font-weight: 850; }
.journey-step--done > span { border-color: var(--green); background: var(--green); color: #fff; }
.journey-step > div { border-bottom: 1px solid #edf1f5; padding: 16px 0; display: grid; }
.journey-step:last-child > div { border-bottom: 0; }
.journey-step small { color: var(--orange-dark); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.journey-step strong { margin-top: 2px; color: var(--navy-dark); font-size: 14px; }
.journey-step p { margin: 1px 0 0; color: var(--muted); font-size: 10px; }
.journey-step > i { color: #8c99a8; font-style: normal; }
.outcome-panel { margin-top: 24px; }

.form-page { width: min(940px, calc(100% - 40px)); }
.autosave-badge { border: 1px solid #c5d9cc; border-radius: 999px; background: var(--green-soft); color: #176b59; padding: 8px 12px; font-size: 10px; font-weight: 800; }
.day-content { margin: 0 0 22px; border: 1px solid #cbdbe9; border-radius: 14px; background: var(--blue-soft); padding: 16px; }
.day-content > strong { color: var(--navy); font-size: 12px; }
.day-content > div { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 7px; }
.day-content span { border-radius: 999px; background: #fff; padding: 5px 9px; color: #53697e; font-size: 9px; font-weight: 700; }
.form-card { border: 1px solid var(--line); border-radius: 20px; background: #fff; padding: 28px; box-shadow: var(--shadow); }
.form-card > fieldset { display: grid; gap: 19px; }
.form-section-heading { margin: 7px 0 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.form-section-heading h2 { margin: 0; color: var(--navy-dark); font-size: 22px; }
.form-section-heading p:not(.kicker) { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.rating-grid { display: grid; gap: 10px; }
.rating-row { border: 1px solid #e1e8ef; border-radius: 12px; padding: 13px 14px; display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: center; gap: 15px; }
.rating-row legend { float: left; color: var(--navy-dark); font-size: 12px; font-weight: 750; }
.rating-row > div { display: flex; gap: 6px; }
.rating-choice { cursor: pointer; }
.rating-choice input { position: absolute; width: 1px; opacity: 0; }
.rating-choice span { width: 42px; height: 38px; margin: 0; border: 1px solid #cad6e1; border-radius: 8px; display: grid; place-items: center; color: #566b7f; font-size: 11px; font-weight: 850; }
.rating-choice input:checked + span { border-color: var(--orange); background: var(--orange); color: #fff; box-shadow: 0 4px 12px rgb(242 140 0 / 22%); }
.choice-group { border: 1px solid #dce4ec; border-radius: 12px; padding: 14px; }
.choice-group legend { padding: 0 5px; color: var(--navy-dark); font-size: 13px; font-weight: 750; }
.choice-group label { display: inline-flex; align-items: center; margin: 8px 8px 0 0; cursor: pointer; }
.choice-group input { position: absolute; width: 1px; opacity: 0; }
.choice-group label span { min-width: 70px; margin: 0; border: 1px solid #cbd7e3; border-radius: 9px; padding: 8px 15px; text-align: center; }
.choice-group input:checked + span { border-color: var(--orange); background: var(--orange-soft); color: var(--orange-dark); }
.form-actions, .autosave-line { border-top: 1px solid var(--line); padding-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.form-actions > span, .autosave-line > span { color: var(--muted); font-size: 11px; }

.settings-panel { max-width: 700px; }

.auth-body { background: radial-gradient(circle at 20% 15%, #284f78 0, transparent 34%), linear-gradient(145deg, var(--navy-dark), var(--navy)); }
.auth-body main { min-height: calc(100vh - 55px); display: grid; place-items: center; }
.auth-page { width: min(440px, calc(100% - 30px)); padding: 35px 0; }
.auth-page--wide { width: min(650px, calc(100% - 30px)); }
.auth-brand { margin-bottom: 18px; justify-items: center; color: #fff; }
.auth-brand .brand__mark { margin-bottom: 10px; }
.auth-brand strong { font-size: 14px; letter-spacing: .08em; }
.auth-brand small { font-size: 10px; letter-spacing: .1em; opacity: .7; }
.auth-card { border: 1px solid rgb(255 255 255 / 30%); border-radius: 22px; background: rgb(255 255 255 / 97%); padding: 29px; box-shadow: 0 25px 80px rgb(0 0 0 / 25%); }
.auth-card h1 { margin: 0; color: var(--navy-dark); font-size: 29px; line-height: 1.12; letter-spacing: -.035em; }
.auth-card .lede { margin: 9px 0 22px; font-size: 13px; }
.auth-card .text-link { display: inline-block; margin-top: 17px; font-size: 12px; }
.inline-notice { margin: 0 0 17px; border-radius: 10px; background: var(--green-soft); padding: 11px; color: #176b59; font-size: 12px; }
.auth-footnote { margin: 14px 0 0; color: rgb(255 255 255 / 70%); font-size: 10px; text-align: center; }
.auth-body .footer { border-color: rgb(255 255 255 / 12%); background: transparent; color: rgb(255 255 255 / 55%); }

.footer { min-height: 55px; border-top: 1px solid var(--line); background: #fff; color: #7a8999; padding: 14px max(20px, calc((100% - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 15px; font-size: 9px; }

@media (max-width: 950px) {
  .session-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-columns, .danger-zone { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dossier-grid { grid-template-columns: 250px 1fr; }
  .trainer-list { grid-template-columns: 1fr; }
  .topnav { position: fixed; inset: 76px 0 auto; display: none; padding: 20px; background: var(--navy-dark); box-shadow: 0 14px 30px rgb(0 0 0 / 25%); }
  .topnav.is-open { display: grid; }
  .topnav .profile-pill { padding: 12px 0; border-left: 0; border-top: 1px solid rgb(255 255 255 / 16%); }
  .mobile-menu { display: block; }
}

@media (max-width: 700px) {
  .topbar__inner, .page-wrap, .form-page { width: min(100% - 24px, 1180px); }
  .topbar__inner { min-height: 68px; }
  .brand__mark { width: 36px; height: 36px; }
  .brand strong { font-size: 11px; }
  .brand small { font-size: 7px; }
  .page-wrap { padding: 28px 0 40px; }
  .page-heading { align-items: stretch; flex-direction: column; gap: 15px; }
  .page-heading h1 { font-size: 31px; }
  .page-heading .button { width: 100%; }
  .session-grid, .field-grid, .dossier-grid { grid-template-columns: 1fr; }
  .session-card { min-height: 220px; }
  .progress-panel { position: static; }
  .metric-grid { gap: 9px; }
  .metric-grid article { padding: 14px; }
  .metric-grid strong { font-size: 22px; }
  .panel, .progress-panel { padding: 20px; border-radius: 16px; }
  .roster-panel { padding: 0; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .panel-heading form .button { width: 100%; }
  .closure-actions, .form-actions, .autosave-line { align-items: stretch; flex-direction: column; }
  .closure-actions .button, .form-actions .button { width: 100%; }
  .form-card { padding: 19px 15px; border-radius: 15px; }
  .rating-row { grid-template-columns: 1fr; }
  .rating-row legend { float: none; }
  .rating-row > div { display: grid; grid-template-columns: repeat(5, 1fr); }
  .rating-choice span { width: 100%; height: 42px; }
  .day-content > div { display: grid; }
  .footer { align-items: start; flex-direction: column; }
  .auth-card { padding: 24px 19px; }
}

@media print {
  .topbar, .footer, .button, .back-link { display: none !important; }
  .page-wrap { width: 100%; padding: 0; }
  .panel, .form-card { box-shadow: none; }
}
