/* ==========================================================================
   Performance Portal — design system
   Built mobile-first-friendly: every layout works from 320px to ultrawide.
   ========================================================================== */

:root {
  /* Surfaces & ink */
  --bg: #f1f4fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --border: #dfe5ef;
  --border-strong: #c7d0e0;
  --text: #16203a;
  --text-soft: #3c4761;
  --muted: #667089;

  /* Brand */
  --primary: #3355e0;
  --primary-600: #2643c2;
  --primary-700: #1d349c;
  --primary-50: #eef2ff;
  --primary-100: #dde4ff;

  /* Status */
  --success: #0f7a58;
  --success-50: #e6f6ef;
  --warning: #8a4b06;
  --warning-50: #fdf3e3;
  --danger: #bb3225;
  --danger-50: #fdecea;
  --info: #0a6b9e;
  --info-50: #e6f3fa;
  --gold: #c9a24a;
  --gold-50: #fdf8ec;
  --gold-ink: #8a6a1c;

  /* Sidebar */
  --sidebar: #131a2c;
  --sidebar-2: #0e1423;
  --sidebar-text: #aeb8d0;

  /* Shape & depth */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 6px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .04);
  --ring: 0 0 0 3px rgba(51, 85, 224, .25);

  /* Rhythm */
  --gap: 1.25rem;
  --pad-card: 1.25rem;
  --content-x: 1.75rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.3; font-weight: 640; letter-spacing: -.01em; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; background: var(--surface-3); padding: .08em .35em; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }

/* Anything focused by keyboard gets a clear ring. */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: .5rem; top: -3rem; z-index: 100;
  background: var(--primary); color: #fff; padding: .55rem .9rem; border-radius: var(--radius-sm);
  transition: top .15s ease;
}
.skip-link:focus { top: .5rem; text-decoration: none; }

/* ==========================================================================
   Layout
   ========================================================================== */

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

.sidebar {
  width: 224px; flex-shrink: 0; background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: var(--sidebar-text); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
}
.nav-icon { flex: 0 0 auto; }
.brand { display: flex; gap: .6rem; align-items: center; padding: 1rem .9rem .85rem; color: #fff; }
.brand strong { font-size: .95rem; letter-spacing: -.01em; }
.brand small { display: block; color: var(--sidebar-text); font-size: .72rem; line-height: 1.35; margin-top: .1rem; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(140deg, #4a6bff, var(--primary-700));
  color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; box-shadow: 0 2px 8px rgba(29, 52, 156, .45);
}
.nav-section { padding: .1rem .55rem .3rem; }
.nav-label { font-size: .63rem; text-transform: uppercase; letter-spacing: .1em; color: #6f7c99; padding: .55rem .65rem .2rem; font-weight: 700; }
.nav-link {
  display: flex; align-items: center; gap: .65rem; padding: .46rem .65rem; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: .875rem; line-height: 1.35; position: relative;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(83, 115, 240, .26); color: #fff; font-weight: 600; }
.nav-link.active::before {
  content: ""; position: absolute; left: -.6rem; top: 18%; bottom: 18%; width: 3px;
  border-radius: 0 3px 3px 0; background: #6a86fb;
}
/* Occasional links: present, but visibly lighter than the main menu. */
.sidebar nav { flex: 0 0 auto; }
/* Knowledge base and the activity log read as menu rows like everything else,
   kept quieter so they do not compete with the working sections above. */
.nav-section-help { margin-top: auto; padding-top: .5rem; }
.nav-link-quiet { color: #6f7c99; font-size: .82rem; }
.nav-link-quiet .nav-icon { opacity: .75; }

/* Who you are signed in as, and the way out. */
.sidebar-user { padding: .6rem .55rem .7rem; border-top: 1px solid rgba(255, 255, 255, .09); margin-top: .5rem; }
.sidebar-user-head {
  display: flex; align-items: center; gap: .6rem; min-width: 0;
  padding: .45rem .55rem; border-radius: var(--radius-sm); color: var(--sidebar-text);
}
.sidebar-user-head:hover { background: rgba(255, 255, 255, .07); text-decoration: none; }
.sidebar-user-head .avatar { flex: 0 0 auto; box-shadow: 0 0 0 2px rgba(255, 255, 255, .12); }
.sidebar-user-text { min-width: 0; display: block; }
.sidebar-user-name {
  display: block; color: #fff; font-weight: 600; font-size: .86rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; }
.role-pill {
  display: inline-block; font-size: .64rem; font-weight: 650; letter-spacing: .02em;
  padding: .1rem .35rem; border-radius: 4px;
  background: rgba(255, 255, 255, .1); color: #c3cbe0; white-space: nowrap;
}
.role-pill-more { background: rgba(255, 255, 255, .06); }
.sidebar-signout {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  margin-top: .2rem; padding: .45rem .55rem; border: 0; border-radius: var(--radius-sm);
  background: none; color: #6f7c99; font: inherit; font-size: .82rem; cursor: pointer; text-align: left;
}
.sidebar-signout:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.btn-link { border: 0; background: none; color: var(--sidebar-text); padding: 0; cursor: pointer; font: inherit; font-size: .82rem; text-decoration: underline; }
.btn-link:hover { color: #fff; }
.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: .75rem; padding: .85rem var(--content-x);
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 15;
}
.topbar h1 { font-size: 1.15rem; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle {
  display: none; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-sm);
  width: 40px; height: 40px; font-size: 1.15rem; cursor: pointer; align-items: center; justify-content: center; color: var(--text);
}
.nav-toggle:hover { background: var(--surface-2); }
.content { padding: 1.5rem var(--content-x) 3.5rem; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ==========================================================================
   Cards, grids, stats
   ========================================================================== */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: var(--pad-card); margin-bottom: var(--gap);
}
.card-header { display: flex; justify-content: space-between; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card-header h2 { margin: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-header { padding: 1.1rem 1.25rem 0; }
.card-flush > .empty-state { padding: 2.5rem 1.25rem; }

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2 > .card { margin-bottom: 0; }
/* Grid items default to min-width:auto and would otherwise stretch to their widest cell. */
.grid > *, .stats > *, .quarter-grid > *, .quarter-strip > * { min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: var(--gap); }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); min-width: 0;
}
.stat-label { color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .01em; }
.stat-value { font-size: 1.6rem; font-weight: 680; margin-top: .15rem; line-height: 1.25; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat-value a { color: inherit; }
.stat-sub { color: var(--muted); font-size: .78rem; margin-top: .15rem; line-height: 1.45; }

.empty-state { text-align: center; padding: 2.75rem 1rem; color: var(--muted); }
.empty-state h2 { color: var(--text); }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .85rem 1.5rem; }
.kv > div { min-width: 0; overflow-wrap: anywhere; }
.kv span { display: block; color: var(--muted); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .1rem; }

.chart-box { position: relative; height: 280px; }

/* ==========================================================================
   Tables — scroll on medium screens, stack into cards on phones
   ========================================================================== */

.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(to right, var(--surface) 30%, rgba(255, 255, 255, 0)) left center,
    linear-gradient(to left, var(--surface) 30%, rgba(255, 255, 255, 0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(16, 24, 40, .12), rgba(0, 0, 0, 0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(16, 24, 40, .12), rgba(0, 0, 0, 0)) right center;
  background-repeat: no-repeat;
  background-size: 36px 100%, 36px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
  font-size: .71rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  font-weight: 700; background: var(--surface-2); white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td .sub { display: block; color: var(--muted); font-size: .78rem; margin-top: .1rem; }
/* A cell must stay a table cell: display:flex on a <td> makes the browser wrap it in an
   anonymous cell, which breaks the row's borders and lets the buttons spill outside. */
td.row-actions { text-align: right; white-space: nowrap; }
td.row-actions > * { display: inline-flex; vertical-align: middle; margin-left: .35rem; }
td.row-actions > *:first-child { margin-left: 0; }
td.row-actions form.inline { display: inline-flex; }
.row-actions .btn { white-space: nowrap; }
tr.is-current > td { background: var(--primary-50); }
tr.muted td { color: var(--muted); }

/* ==========================================================================
   Badges, chips, alerts, progress
   ========================================================================== */

.badge {
  display: inline-block; padding: .16rem .6rem; border-radius: var(--radius-pill);
  font-size: .73rem; font-weight: 650; white-space: nowrap; line-height: 1.45;
}
.badge-neutral { background: var(--surface-3); color: #4a5570; }
.badge-primary { background: var(--primary-50); color: var(--primary-600); }
.badge-success { background: var(--success-50); color: var(--success); }
.badge-warning { background: var(--warning-50); color: var(--warning); }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.badge-info { background: var(--info-50); color: var(--info); }

.alert {
  padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem;
  border: 1px solid transparent; border-left-width: 4px; line-height: 1.55;
}
.alert-success { background: var(--success-50); color: #0c5f45; border-color: #bfe5d3; border-left-color: var(--success); }
.alert-error { background: var(--danger-50); color: #93281e; border-color: #f5c6c1; border-left-color: var(--danger); }
.alert-warning { background: var(--warning-50); color: #74400a; border-color: #f4d8b0; border-left-color: #c9871f; }
.alert-info { background: var(--info-50); color: #0a5678; border-color: #bcdcee; border-left-color: var(--info); }
.alert ul { margin: .25rem 0 0; padding-left: 1.2rem; }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }
.alert .btn { text-decoration: none; }

.progress-row { display: flex; align-items: center; gap: .6rem; min-width: 110px; }
.progress { flex: 1; height: 8px; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #6a86fb); border-radius: inherit; }
.progress-value { font-size: .78rem; color: var(--muted); min-width: 2.6rem; text-align: right; font-variant-numeric: tabular-nums; }

.rating-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .79rem; font-weight: 640; white-space: nowrap; }
.rating-chip::before { content: ""; width: .7rem; height: .7rem; border-radius: 50%; flex-shrink: 0; }

.trend-up { color: var(--success); font-weight: 650; }
.trend-down { color: var(--danger); font-weight: 650; }

/* ==========================================================================
   Buttons & forms
   ========================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; min-height: 38px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.25;
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, transform .06s ease;
}
.btn:hover { background: var(--surface-2); border-color: #b6c1d6; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled], .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(29, 52, 156, .25); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #0c6549; border-color: #0c6549; }
.btn-danger { color: var(--danger); border-color: #edbdb7; background: var(--surface); }
.btn-danger:hover { background: var(--danger-50); border-color: #e0a49c; }
.btn-sm { padding: .3rem .65rem; min-height: 30px; font-size: .8rem; }
.btn-block { width: 100%; }
form.inline { display: inline; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.05rem 1.25rem; }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field-check { flex-direction: row; align-items: center; gap: .55rem; }
.field-check input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); flex-shrink: 0; }
label { font-weight: 600; font-size: .85rem; color: var(--text-soft); }
.hint { color: var(--muted); font-size: .79rem; line-height: 1.45; }
.error-text { color: var(--danger); font-size: .79rem; font-weight: 600; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: .55rem .7rem; min-height: 38px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: .92rem; background: #fff; color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23667089' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 10px;
}
select[disabled], input[disabled], textarea[disabled] { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
textarea { min-height: 100px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.has-error input:focus, .has-error select:focus, .has-error textarea:focus { box-shadow: 0 0 0 3px rgba(187, 50, 37, .2); }
::placeholder { color: #9aa3b8; }

.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.25rem; align-items: center; }
.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--gap); }
.filters .field { min-width: 190px; }
.permission-grid { display: grid; gap: .5rem; }
.permission-grid .field-check { align-items: flex-start; gap: .55rem; font-weight: 400; font-size: .88rem; line-height: 1.5; color: var(--text); }
.permission-grid .field-check input { margin-top: .15rem; }

/* ==========================================================================
   Components
   ========================================================================== */

.steps { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 var(--gap); padding: 0; list-style: none; counter-reset: step; }
.steps li {
  flex: 1 1 150px; min-width: 0; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--border); color: var(--muted); font-size: .85rem; counter-increment: step;
}
.steps li::before {
  content: counter(step); display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-3); margin-right: .45rem; font-size: .7rem; font-weight: 700; color: var(--muted);
}
.steps li.done { color: var(--success); border-color: #cbe8dc; }
.steps li.done::before { background: var(--success); color: #fff; content: "\2713"; }
.steps li.current { border-color: var(--primary); color: var(--text); font-weight: 650; box-shadow: 0 0 0 1px var(--primary-100); }
.steps li.current::before { background: var(--primary); color: #fff; }

.track-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.track-tab {
  padding: .4rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-pill);
  font-size: .83rem; font-weight: 550; color: var(--text-soft); background: var(--surface);
}
.track-tab span { color: var(--muted); font-weight: 700; margin-left: .2rem; }
.track-tab:hover { text-decoration: none; background: var(--surface-2); border-color: var(--border-strong); }
.track-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 650; }
.track-tab.active span { color: rgba(255, 255, 255, .85); }

.task-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; padding: .85rem 0; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-row > div:first-child { min-width: 0; flex: 1 1 260px; }
.task-row .sub { display: block; color: var(--muted); font-size: .82rem; margin-top: .1rem; line-height: 1.45; }

.share-box { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.share-box input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; flex: 1 1 240px; min-width: 0; }

.confidential-box { margin-top: var(--gap); border: 1px dashed #cfa94e; background: #fffcf3; border-radius: var(--radius-sm); padding: .95rem 1rem 1.05rem; }
.confidential-label { font-size: .8rem; font-weight: 650; color: #8a5a00; margin-bottom: .75rem; line-height: 1.45; }

.form-section-title { font-size: 1rem; padding-bottom: .6rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.form-question { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1.15rem; }
.form-question > label { font-size: .9rem; color: var(--text); font-weight: 600; line-height: 1.5; }
.required { color: var(--danger); }
.score-table { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.score-table td { padding: .5rem .75rem; }
.score-table select { max-width: 230px; }
.review-table select { min-width: 190px; }
.input-suffix { display: flex; align-items: center; gap: .4rem; max-width: 170px; }
.input-suffix span { color: var(--muted); font-weight: 650; }
.big-figure { font-size: 1.65rem; font-weight: 700; color: var(--primary); line-height: 1.2; letter-spacing: -.02em; }
.rating-big { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.signature { font-family: "Segoe Script", "Brush Script MT", "Snell Roundhand", cursive; font-size: 1.15rem; color: #1f2f7a; }
.text-block { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem .85rem; min-height: 2.6rem; overflow-wrap: anywhere; }
.legend-scale { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; font-size: .8rem; color: var(--muted); }

.quarter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.quarter-grid .card { margin-bottom: 0; }

/* A quarter reads top to bottom: what it is, how far it has got, what you can do. */
.quarter-card { display: flex; flex-direction: column; }
.quarter-card.is-current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow); }
.quarter-card.is-empty { background: var(--surface-2); }
.quarter-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.quarter-head-text { min-width: 0; }
.quarter-head h3 { margin: .15rem 0 .25rem; font-size: 1.12rem; letter-spacing: -.01em; line-height: 1.25; }
.quarter-tag { display: block; color: var(--muted); font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; }
.quarter-card.is-current .quarter-tag { color: var(--primary); }
.quarter-dates { display: block; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.quarter-note { color: var(--muted); font-size: .84rem; line-height: 1.55; margin: .9rem 0 0; }
.quarter-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 1rem 0 .6rem; }
.quarter-stats strong { font-size: 1.3rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.quarter-stats span { display: block; color: var(--muted); font-size: .75rem; }
.quarter-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 1.1rem; }

/* The yearly increment form is a different animal, so it reads differently. */
.cycle-annual { border-color: var(--gold); background: linear-gradient(180deg, var(--gold-50) 0%, var(--surface) 70%); }
.cycle-annual .quarter-tag { color: var(--gold-ink); }

/* Moving between financial years. */
.year-nav { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.head-note { margin: 1rem 0 0; padding: .7rem .9rem; border-radius: var(--radius-sm);
  background: var(--primary-50); color: var(--text); font-size: .86rem; line-height: 1.55; }
.quarter-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; }
.quarter-pill { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem .85rem; background: var(--surface-2); }
.quarter-pill.is-current { border-color: var(--primary); background: var(--primary-50); }

.insight-note { color: var(--muted); font-size: .83rem; margin: .4rem 0 0; line-height: 1.55; }
.insight-list { margin: .5rem 0 0; padding-left: 1.15rem; line-height: 1.75; }
.insight-list li + li { margin-top: .3rem; }
.feedback-item { border-left: 3px solid var(--border); padding: .25rem 0 .25rem .8rem; margin: .7rem 0; }
.feedback-item .who { color: var(--muted); font-size: .79rem; margin-bottom: .25rem; }
details.insight-details { border-top: 1px solid var(--border); padding: .7rem 0; }
details.insight-details > summary { cursor: pointer; font-weight: 640; padding: .15rem 0; }
details.insight-details > summary:hover { color: var(--primary); }
details.insight-details > summary::marker { color: var(--muted); }
details.insight-details[open] > summary { margin-bottom: .35rem; }

/* Collapsible panel: a card whose body folds away, so long pages stay scannable. */
.panel { padding: 0; }
.panel > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .6rem 1rem;
  padding: .85rem 1.15rem; font-weight: 650; font-size: .98rem;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary:hover { background: var(--surface-2); border-radius: var(--radius); }
.panel > summary::after {
  content: ""; margin-left: auto; flex: 0 0 auto; width: .55rem; height: .55rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s ease;
}
.panel[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.panel[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.panel-meta { color: var(--muted); font-weight: 500; font-size: .82rem; }
.panel-body { padding: 1.1rem 1.15rem 1.2rem; }
.panel-body.flush { padding: 0; }
.panel-body.flush > .panel-note { padding: .85rem 1.15rem 0; }
.panel-note { color: var(--muted); font-size: .83rem; line-height: 1.55; margin: 0; }

/* One compact row of headline numbers, instead of a wall of tiles. */
.metric-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: var(--gap); overflow: hidden;
}
.metric { padding: .85rem 1.1rem; border-left: 1px solid var(--border); min-width: 0; }
.metric:first-child { border-left: 0; }
.metric-label { color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.metric-value { font-size: 1.45rem; font-weight: 680; line-height: 1.25; letter-spacing: -.02em; margin-top: .1rem; overflow-wrap: anywhere; }
.metric-sub { color: var(--muted); font-size: .77rem; line-height: 1.45; margin-top: .1rem; }
.metric-sub .progress-row { margin-top: .3rem; }

/* Toolbar: tabs and filters together at the top of a report. */
.toolbar { padding: .9rem 1.15rem; }
.toolbar .filters { margin-bottom: 0; }
.toolbar .track-tabs { margin-top: 0; margin-bottom: .85rem; }

/* Three or more actions stack neatly instead of forcing the table wider. */
td.row-actions.stacked-actions { white-space: normal; min-width: 150px; }
td.row-actions.stacked-actions > * { margin: .15rem 0 .15rem .35rem; }

/* Forms and prose read badly at full ultrawide width. */
.card-narrow { max-width: 860px; }

/* A value that can be read but not changed on this form. */
.locked-value { padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); line-height: 1.4; }
.locked-value .sub { display: block; color: var(--muted); font-size: .82rem; margin-top: .1rem; }

/* The second way in, on the sign-in page: present but clearly secondary. */
.login-alt { background: var(--surface-2); }
.login-alt h2 { font-size: 1rem; }
.login-alt p { margin-bottom: .9rem; }

/* Knowledge base: a quiet marker on the sections that apply to the person reading. */
.guide-yours {
  display: inline-block; vertical-align: 1px; margin-left: .1rem;
  font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: .12rem .38rem; border-radius: 4px;
  background: var(--primary-50); color: var(--primary-700);
}
.track-tab.is-yours { border-color: var(--primary-100); background: var(--primary-50); color: var(--primary-700); font-weight: 600; }
.head-note-action { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; }
.track-tabs-inset { padding: 1rem 1.15rem 0; margin-top: 0; }

/* A cell whose text may be long: let it wrap rather than stretch the table. */
td.cell-wrap { max-width: 420px; overflow-wrap: anywhere; white-space: normal; }

.table-search { position: relative; padding: .8rem 1.15rem; border-bottom: 1px solid var(--border); }
.table-search input { max-width: 340px; }
.table-empty { display: none; padding: 1.75rem 1.15rem; text-align: center; color: var(--muted); }

/* Dashboard: donut, fact list, things that need you, and the stage pipeline */
.donut { display: block; flex-shrink: 0; }
.progress-split { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.fact-list { list-style: none; margin: 0; padding: 0; flex: 1 1 200px; min-width: 0; }
.fact-list li { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
  padding: .45rem 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.fact-list li:last-child { border-bottom: 0; }
.fact-list span { color: var(--muted); }
.fact-list strong { font-variant-numeric: tabular-nums; }

.todo-row { display: flex; align-items: center; gap: .85rem; padding: .7rem .2rem; border-bottom: 1px solid var(--border); color: var(--text); }
.todo-row:last-child { border-bottom: 0; }
.todo-row:hover { text-decoration: none; background: var(--surface-2); border-radius: var(--radius-sm); }
.todo-count { flex: 0 0 auto; min-width: 2.1rem; height: 2.1rem; padding: 0 .4rem; border-radius: var(--radius-sm);
  display: grid; place-items: center; font-weight: 700; background: var(--surface-3); color: var(--text-soft); font-variant-numeric: tabular-nums; }
.todo-count.is-urgent { background: var(--warning-50); color: var(--warning); }
.todo-text { flex: 1 1 auto; min-width: 0; }
.todo-text .sub { display: block; color: var(--muted); font-size: .8rem; margin-top: .05rem; }
.todo-go { flex: 0 0 auto; color: var(--muted); font-size: 1.05rem; }
.todo-row:hover .todo-go, .pipeline-row:hover .todo-go { color: var(--primary); }

.pipeline-bar { display: flex; gap: 2px; height: 12px; margin: 0 1.25rem 1rem; border-radius: var(--radius-pill); overflow: hidden; }
.pipeline-seg { display: block; min-width: 3px; }
.pipeline { border-top: 1px solid var(--border); }
.pipeline-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--border); color: var(--text); }
.pipeline-row:last-child { border-bottom: 0; }
.pipeline-row:hover { background: var(--surface-2); text-decoration: none; }
.pipeline-dot { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%; }
.pipeline-label { flex: 1 1 auto; min-width: 0; font-size: .92rem; }
.pipeline-count { flex: 0 0 auto; min-width: 2.2rem; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.pipeline-share { flex: 0 1 200px; min-width: 90px; }
.stage-pending { background: #c9871f; }
.stage-self_submitted { background: var(--info); }
.stage-manager_submitted { background: #6a86fb; }
.stage-ops_submitted { background: var(--primary); }
.stage-acknowledged { background: var(--success); }

a.quarter-pill { display: block; color: var(--text); }
a.quarter-pill:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface); box-shadow: var(--shadow-sm); }

/* Avatars */
.avatar { display: block; border-radius: 50%; flex-shrink: 0; }
.person { display: inline-flex; align-items: center; gap: .55rem; min-width: 0; }
.person-avatar { display: inline-flex; flex-shrink: 0; }
.person-text { min-width: 0; }
.person-name { display: block; overflow-wrap: anywhere; }
.person .sub { display: block; color: var(--muted); font-size: .78rem; margin-top: .05rem; }

.profile-hero { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.profile-hero-avatar { flex: 0 0 auto; }
.profile-hero-avatar .avatar { box-shadow: 0 2px 10px rgba(16, 24, 40, .14); }
.profile-hero-text { flex: 1 1 240px; min-width: 0; }
.profile-hero-text h2 { margin: 0; font-size: 1.3rem; }

.swatch-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatch { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .6rem .35rem .4rem;
  border: 1px solid var(--border); border-radius: var(--radius-pill); cursor: pointer; font-size: .82rem; font-weight: 550; }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch-dot { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.swatch:hover { background: var(--surface-2); }
.swatch.is-selected { border-color: var(--primary); background: var(--primary-50); color: var(--primary-600); }
.swatch:focus-within { box-shadow: var(--ring); }

.avatar-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .6rem; }
.avatar-option { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .6rem .3rem .5rem;
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); text-align: center; }
.avatar-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.avatar-option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.avatar-option.is-selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--primary-50); }
.avatar-option:focus-within { box-shadow: var(--ring); }
.avatar-option-label { font-size: .76rem; color: var(--muted); font-weight: 600; }
.avatar-option.is-selected .avatar-option-label { color: var(--primary-600); }
.avatar-option-art { display: block; line-height: 0; }
.avatar-variant { display: none; }
.avatar-variant.is-on { display: block; }

/* Knowledge base: numbered steps joined by a line down the left. */
.guide-steps { counter-reset: guide; list-style: none; padding: 0; margin: .25rem 0 0; }
.guide-steps > li { position: relative; padding: 0 0 1.15rem 2.6rem; counter-increment: guide; }
.guide-steps > li::before {
  content: counter(guide); position: absolute; left: 0; top: -.1rem; width: 1.8rem; height: 1.8rem;
  border-radius: 50%; background: var(--primary-50); color: var(--primary-600);
  font-weight: 700; font-size: .84rem; display: grid; place-items: center; z-index: 1;
}
.guide-steps > li::after { content: ""; position: absolute; left: .87rem; top: 1.9rem; bottom: .1rem; width: 2px; background: var(--border); }
.guide-steps > li:last-child { padding-bottom: 0; }
.guide-steps > li:last-child::after { display: none; }
.guide-steps strong.step-title { display: block; font-weight: 650; margin-bottom: .2rem; }
.guide-steps p { margin: 0 0 .4rem; color: var(--text-soft); line-height: 1.6; }
.guide-steps ul { margin: .2rem 0 .5rem; padding-left: 1.1rem; color: var(--text-soft); line-height: 1.6; }

.guide-toc { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }
.guide-lead { color: var(--text-soft); line-height: 1.65; max-width: 62ch; }
.guide-tip {
  border-left: 3px solid var(--primary); background: var(--primary-50);
  padding: .65rem .85rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: .5rem 0 .2rem;
  font-size: .89rem; line-height: 1.6;
}
.guide-warn { border-left-color: #c9871f; background: var(--warning-50); }
.guide-key { display: inline-block; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: .02em .38em; font-size: .85em; background: var(--surface-2); font-weight: 600; white-space: nowrap; }

/* ==========================================================================
   Manager Performance Review (mirrors the paper sheet's peach headers)
   ========================================================================== */

.pr { --pr-peach: #f8cbad; }
.pr-title { background: var(--pr-peach); color: #111; text-align: center; font-size: 1.2rem; font-weight: 700; padding: .6rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.pr-head { display: block; background: var(--pr-peach); color: #111; font-weight: 700; padding: .45rem .7rem; border-radius: 6px; font-size: .92rem; }
.pr-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1rem; margin-bottom: 1rem; }
.pr-box { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.pr-box .pr-head { border-radius: 0; }
.pr-details { margin: 0; padding: .4rem .75rem; }
.pr-details div { display: flex; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.pr-details div:last-child { border-bottom: 0; }
.pr-details dt { color: var(--muted); min-width: 95px; font-size: .85rem; }
.pr-details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.pr-table th { background: var(--surface-3); }
.pr-table td { padding: .45rem .6rem; }
.pr-table input[type=text], .pr-table input[type=date] { padding: .35rem .5rem; min-height: 34px; min-width: 92px; font-size: .88rem; }
.pr-scale td, .pr-scale th { font-size: .84rem; }
.pr-kpi { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: .7rem 0; overflow: hidden; }
.pr-kpi-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .55rem .6rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.pr-kpi-head input { max-width: 380px; font-weight: 600; }
.pr-overall { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .9rem; padding: .7rem .95rem; background: #fffbe0; border: 1px solid #e8d97c; border-radius: var(--radius-sm); }
.pr-overall > span:first-child { font-weight: 700; }
.pr-overall strong { font-size: 1.2rem; }

/* ==========================================================================
   Public (shared-link) pages
   ========================================================================== */

.public-body { background: var(--bg); }
.public-topbar {
  display: flex; align-items: center; gap: .7rem; padding: .85rem 1.25rem;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.public-topbar strong { font-size: .95rem; }
.public-content { max-width: 940px; margin: 0 auto; padding: 1.5rem 1rem 3.5rem; }
.public-content.wide { max-width: 1400px; }

/* ==========================================================================
   Auth
   ========================================================================== */

.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem; background: radial-gradient(circle at 50% 0%, #dfe7ff, var(--bg) 62%); }
.auth-card { width: 100%; max-width: 430px; }
.auth-card .brand { color: var(--text); padding: 0 0 1.25rem; justify-content: center; }
.auth-card .brand small { color: var(--muted); }
.auth-card.wide { max-width: 560px; }

/* ==========================================================================
   Printable paper form
   ========================================================================== */

.print-body { background: #e9ecf2; padding: 1.5rem 1rem 3rem; }
.print-toolbar { max-width: 800px; margin: 0 auto 1rem; display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.paper {
  max-width: 800px; margin: 0 auto; background: #fff; color: #111; padding: 2.5rem 3rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .12); font-size: 14px; line-height: 1.55;
}
.paper-header { text-align: center; border-bottom: 2px solid #111; padding-bottom: .75rem; margin-bottom: 1.25rem; }
.paper-company { font-size: 1.25rem; font-weight: 700; }
.paper-title { font-size: 1.05rem; font-weight: 600; margin-top: .2rem; }
.paper-meta { margin: 0 0 1.25rem; }
.paper-meta div { display: flex; gap: .4rem; margin-bottom: .2rem; }
.paper-meta dt { font-weight: 700; }
.paper-meta dd { margin: 0; }
.paper-q { margin-bottom: 1rem; break-inside: avoid; }
.paper-q-label { font-weight: 700; }
.paper-q-answer { margin-top: .2rem; min-height: 1.4em; }
.paper-scores { list-style: none; padding: 0; margin: .2rem 0 0; }
.paper-scores li { margin-bottom: .1rem; }
.paper-table { width: 100%; border-collapse: collapse; margin: .4rem 0 .6rem; font-size: 12.5px; break-inside: avoid; }
.paper-table th, .paper-table td { border: 1px solid #999; padding: .25rem .4rem; text-align: left; }
.paper-table th { background: #f8cbad; text-transform: none; letter-spacing: 0; color: #111; }
.paper-section { font-size: 1.05rem; border-top: 2px solid #111; padding-top: .9rem; margin-top: 1.5rem; }
.paper-sign { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1.25rem 0 .5rem; break-inside: avoid; }
.blank { display: inline-block; width: 100%; border-bottom: 1px solid #999; }
.blank-note { color: #666; font-style: italic; }

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Large desktops: a touch more breathing room. */
@media (min-width: 1500px) {
  :root { --content-x: 2.5rem; }
}

/* Tablets and below: the sidebar becomes a drawer. */
@media (max-width: 960px) {
  :root { --content-x: 1.1rem; --gap: 1rem; --pad-card: 1.1rem; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform .22s ease; z-index: 40; width: 270px; box-shadow: 0 0 40px rgba(0, 0, 0, .35);
  }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(12, 17, 30, .5); z-index: 30; }
  .nav-toggle { display: inline-flex; }
  .grid-2, .form-grid, .pr-top { grid-template-columns: 1fr; }
  .content { padding: 1.1rem var(--content-x) 3rem; }
  .topbar { padding: .7rem var(--content-x); }
  .filters .field { min-width: 0; flex: 1 1 200px; }
  .chart-box { height: 240px; }
  .paper { padding: 1.5rem 1.25rem; }
}

/* Phones: tables become cards, one column everywhere, bigger tap targets. */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .stats { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .stat { padding: .85rem .9rem; }
  .stat-value { font-size: 1.35rem; }
  .kv { grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
  .public-content { padding: 1rem .9rem 3rem; }
  .card-flush .card-header { padding: 1rem 1rem 0; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .progress-split { gap: .9rem; }
  .pipeline-row { padding-left: 1rem; padding-right: 1rem; flex-wrap: wrap; }
  .pipeline-share { flex: 1 1 100%; order: 5; }
  .pipeline-bar { margin-left: 1rem; margin-right: 1rem; }
  .metric { border-top: 1px solid var(--border); padding: .7rem .85rem; }
  .metric:nth-child(-n+2) { border-top: 0; }
  .metric:nth-child(odd) { border-left: 0; }
  .metric-value { font-size: 1.25rem; }
  .panel > summary, .panel-body, .toolbar, .table-search { padding-left: 1rem; padding-right: 1rem; }

  /* Each row becomes a small card with its column name beside each value.
     Only wrappers whose table actually stacks drop their horizontal scroll. */
  .table-wrap.is-stacked { overflow-x: visible; background: none; }
  table[data-stack] { display: block; }
  table[data-stack] thead { display: none; }
  table[data-stack] tbody, table[data-stack] tr, table[data-stack] td { display: block; width: 100%; }
  table[data-stack] tr {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin: .7rem 0; padding: .3rem .85rem; background: var(--surface);
  }
  table[data-stack] tr:first-child { margin-top: .25rem; }
  table[data-stack] tbody tr:hover { background: var(--surface); }
  table[data-stack] td {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .15rem .75rem;
    padding: .45rem 0; border-bottom: 1px dashed var(--border); text-align: right;
    white-space: normal; overflow-wrap: anywhere; font-size: .9rem;
  }
  table[data-stack] td:last-child { border-bottom: 0; }
  table[data-stack] td::before {
    content: attr(data-label); flex: 0 1 auto; max-width: 42%;
    color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; text-align: left; white-space: normal; line-height: 1.7;
  }
  /* Secondary lines (email, designation) drop underneath the value. */
  table[data-stack] td > .sub { flex: 1 0 100%; text-align: right; margin-top: 0; }
  table[data-stack] td[data-label=""] { justify-content: flex-end; }
  table[data-stack] td[data-label=""]::before { display: none; }
  table[data-stack] td.row-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; white-space: normal; padding-top: .6rem; gap: .4rem; }
  table[data-stack] td.row-actions > * { margin-left: 0; }
  table[data-stack] td .progress-row { flex: 1 1 60%; }
  /* Wide tables would make very tall cards, so blanks are left out on a phone. */
  table[data-stack].is-wide td[data-empty] { display: none; }
  /* Review and print grids keep their table shape; they are read, not filled in. */
  .score-table, .paper-table { display: table; }
  /* The work log is filled in on a phone, so each day becomes its own card
     rather than something to scroll sideways while typing. */
  table[data-stack] td input[type=text], table[data-stack] td select { flex: 1 1 58%; min-width: 0; }
}

@media (max-width: 560px) {
  :root { --content-x: .85rem; }
  h1 { font-size: 1.15rem; }
  .stats, .kv { grid-template-columns: 1fr; }
  .quarter-stats { gap: 1rem; }
  .form-actions { gap: .5rem; }
  .form-actions .btn { flex: 1 1 100%; }
  .form-actions .btn.btn-sm { flex: 0 0 auto; }
  /* The printable sheet keeps its A4 proportions, so it scrolls inside itself on a phone. */
  .paper { overflow-x: auto; }
  table[data-stack] td.row-actions { justify-content: flex-start; }
  .track-tab { font-size: .8rem; padding: .35rem .7rem; }
  .steps li { flex: 1 1 100%; }
  .share-box .btn { flex: 1 1 auto; }
  .input-suffix { max-width: 100%; }
  .paper { padding: 1.25rem 1rem; }
}

/* Phones zoom in on any input under 16px, so keep them at 16px on touch screens. */
@media (max-width: 760px) {
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
  input[type=search], input[type=tel], select, textarea { font-size: 16px; }
}

/* Fingers need bigger targets than a mouse. */
@media (pointer: coarse) {
  .btn { min-height: 42px; }
  .btn-sm { min-height: 34px; }
  .nav-link { padding: .65rem .7rem; }
  input, select, textarea { min-height: 42px; }
  .track-tab { padding: .5rem .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Print
   ========================================================================== */

/* ---------------------------------------------------------------------------
 * Reports: the page header, the headline figure, the rating scale and the
 * chase list. Shared by every page under Reports.
 * ------------------------------------------------------------------------- */
.report-head { padding: 1rem 1.15rem 1.15rem; }
.report-head .track-tabs { margin-top: 0; }
.report-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 1.75rem;
.report-head > .report-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
  flex-wrap: wrap; margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.report-title-text { min-width: 0; flex: 1 1 280px; }
.report-title .report-name { margin: 0; font-size: 1.45rem; letter-spacing: -.02em; line-height: 1.2; }
.report-sub { margin: .3rem 0 0; color: var(--muted); font-size: .85rem; line-height: 1.6; }
.report-sub .badge { vertical-align: 1px; }
.report-filters { display: flex; gap: .7rem; flex-wrap: wrap; align-items: flex-end; margin: 0; }
.report-filters .field { min-width: 0; margin: 0; }
.report-filters select { min-width: 210px; }
.report-filters .field-action { align-self: flex-end; }

/* The one figure the page is about, with the supporting numbers beside it. */
.headline { display: flex; gap: 1.25rem 2.25rem; flex-wrap: wrap; align-items: center; }
.headline-main { flex: 1 1 220px; min-width: 0; }
.headline-value { font-size: 2.9rem; font-weight: 700; letter-spacing: -.035em; line-height: 1.05;
  margin: .15rem 0 .5rem; font-variant-numeric: tabular-nums; }
.headline-note { color: var(--muted); font-size: .85rem; line-height: 1.55; margin: .55rem 0 0; }
.headline-facts { flex: 1 1 300px; }
.headline-collect { flex: 0 0 auto; display: grid; place-items: center; }
.headline-collect-text { flex: 1 1 320px; min-width: 0; }

/* The company rating scale as one bar, with the counts underneath. */
.rating-excellent { --band: #2e9e4f; }
.rating-good { --band: #e0a90b; }
.rating-needs { --band: #4f8fd6; }
.rating-below { --band: #d93025; }
.rating-chip::before { background: var(--band, var(--muted)); }
.band-bar { display: flex; gap: 2px; height: 14px; border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 1rem; }
.band-seg { display: block; min-width: 4px; background: var(--band, var(--surface-3)); }
.band-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.band-legend li { display: grid; grid-template-columns: auto minmax(0, 1fr) 3.2rem 3.2rem; gap: .5rem 1rem;
  align-items: baseline; padding: .5rem 0; border-bottom: 1px dashed var(--border); font-size: .88rem; }
.band-legend li:last-child { border-bottom: 0; }
.band-legend li.is-empty { opacity: .5; }
.band-range { color: var(--muted); font-size: .8rem; white-space: nowrap; text-align: left; }
.band-count, .band-share { text-align: right; font-variant-numeric: tabular-nums; }
.band-share { color: var(--muted); font-size: .82rem; }

/* "In short" reads as two columns of short statements on a wide screen. */
.summary-grid { columns: 2; column-gap: 2.25rem; }
.summary-grid li { break-inside: avoid; }

/* The figures on a "worth a closer look" row. */
.attention-figures { display: flex; align-items: center; gap: .4rem 1.1rem; flex-wrap: wrap; }
.attention-figures .figure { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.attention-figures .figure-label { display: block; color: var(--muted); font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; }

/* Who still has to submit, under the manager who should chase them. */
.chase-row { padding: .7rem 0; border-bottom: 1px solid var(--border); }
.chase-row:last-child { border-bottom: 0; }
.chase-head { display: flex; align-items: baseline; gap: .6rem; justify-content: space-between; }
.chase-count { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.chase-names { margin: .25rem 0 0; color: var(--text-soft); font-size: .85rem; line-height: 1.6; }

/* Tables of figures read better right-aligned and in one line per person. */
th.num, td.num { text-align: right; }
td.num .sub { display: block; color: var(--muted); font-size: .78rem; margin-top: .05rem; }
td.person-cell { min-width: 13rem; }
td.person-cell strong { display: block; overflow-wrap: anywhere; }
td.person-cell .sub { display: block; color: var(--muted); font-size: .78rem; margin-top: .1rem; }
.gap-note { white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .summary-grid { columns: 1; }
  .headline-value { font-size: 2.4rem; }
}
@media (max-width: 760px) {
  .report-filters { width: 100%; }
  .report-filters .field { flex: 1 1 100%; }
  .report-filters select { min-width: 0; width: 100%; }
  .band-legend li { grid-template-columns: minmax(0, 1fr) 2.6rem 2.8rem; }
  .band-range { display: none; }
  th.num, td.num { text-align: left; }
  .attention-figures { gap: .35rem .9rem; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 12px; }
  .sidebar, .sidebar-backdrop, .topbar, .nav-toggle, .filters, .form-actions,
  .print-toolbar, .btn, .skip-link, .track-tabs, .public-topbar { display: none !important; }
  .shell { display: block; }
  .content, .public-content { padding: 0; max-width: none; }
  .card, .stat { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .table-wrap { overflow: visible; background: none; }
  a { color: inherit; text-decoration: none; }
  .print-body { background: #fff; padding: 0; }
  .paper { box-shadow: none; padding: 0; max-width: none; overflow: visible; }
  details.insight-details { border-color: #bbb; }
  details.insight-details > summary { list-style: none; }
}
