/* Academy analytics: real data stays legible on desktop and narrow screens. */
.academy-insight{min-width:0;color:var(--text);font-variant-numeric:tabular-nums}
.academy-insight *{box-sizing:border-box}
.academy-insight-nav{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 16px}
.academy-insight-nav .academy-btn[aria-current="page"],
.academy-insight-nav .academy-btn[aria-current="location"],
.academy-insight-nav .academy-btn[aria-selected="true"]{background:var(--surface-soft);border-color:var(--academy-data);color:var(--academy-data);font-weight:600}
.academy-insight-filters{display:flex;align-items:end;flex-wrap:wrap;gap:12px;margin:0 0 20px}
.academy-insight-filters .academy-field{flex:1 1 150px;max-width:260px}
.academy-insight-filters .academy-btn{flex:none}
.academy-insight-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start}
.academy-insight-wide{grid-column:1 / -1}
.academy-insight-panel{min-width:0;overflow:hidden;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius,12px)}
.academy-insight-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:16px 20px 12px}
.academy-insight-head h2,.academy-insight-head h3{min-width:0;margin:0;font-size:16px;line-height:1.35;font-weight:600;overflow-wrap:anywhere}
.academy-insight-subtitle{margin:4px 0 0;color:var(--text-secondary);font-size:12px;line-height:1.45;overflow-wrap:anywhere}
.academy-insight-body{min-width:0;padding:0 20px 20px}
.academy-insight-note{margin:0;padding:10px 20px;color:var(--text-secondary);font-size:12px;line-height:1.45;overflow-wrap:anywhere}
.academy-insight-list{list-style:none;margin:0;padding:0 20px}
.academy-insight-row{display:grid;grid-template-columns:28px minmax(0,1fr) auto;column-gap:10px;row-gap:5px;align-items:center;min-width:0;padding:12px 0;border-top:1px solid var(--line-soft)}
.academy-insight-row:first-child{border-top:0}
.academy-insight-rank{align-self:start;color:var(--text-secondary);font-size:12px;line-height:1.6;text-align:center}
.academy-insight-name{min-width:0;font-size:13px;font-weight:600;line-height:1.4;overflow-wrap:anywhere}
.academy-insight-value{color:var(--text);font-size:14px;font-weight:600;line-height:1.4;text-align:right;white-space:nowrap}
.academy-insight-meta{grid-column:2 / -1;min-width:0;color:var(--text-secondary);font-size:12px;line-height:1.4;overflow-wrap:anywhere}
.academy-insight-bar{grid-column:2 / -1;display:block;height:6px;overflow:hidden;border-radius:4px;background:var(--surface-soft)}
.academy-insight-bar>i{display:block;width:clamp(0%,var(--academy-insight-fill,0%),100%);height:100%;border-radius:inherit;background:var(--academy-data)}
.academy-insight-row :is(button,a){min-height:44px}
.academy-insight-row button.academy-insight-name{padding:0;border:0;background:transparent;color:var(--academy-data);text-align:left;cursor:pointer}
.academy-insight-empty{padding:24px 20px;color:var(--text-secondary);font-size:13px;line-height:1.5;text-align:center}
.academy-insight-empty :is(h2,h3,p){margin:0}
.academy-insight-empty :is(h2,h3){color:var(--text);font-size:14px;font-weight:600}
.academy-insight-empty :is(h2,h3)+p{margin-top:6px}
.academy-insight-empty .academy-btn{margin-top:12px}
.academy-insight-table-wrap{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain}
.academy-insight-table{width:100%;min-width:520px;border-collapse:collapse;text-align:left;font-size:13px}
.academy-insight-table :is(th,td){padding:12px 16px;border-bottom:1px solid var(--line-soft);vertical-align:middle}
.academy-insight-table th{color:var(--text-secondary);font-size:12px;font-weight:500}
.academy-insight-table tr:last-child td,.academy-insight-table tr:last-child th[scope="row"]{border-bottom:0}
.academy-insight-table :is(.numeric,[data-numeric]){text-align:right;white-space:nowrap}
.academy-insight-table small{display:block;color:var(--text-secondary);font-size:12px}
.academy-insight :is(button,a,input,select,summary):focus-visible,.academy-insight-table-wrap:focus-visible{outline:3px solid var(--academy-data);outline-offset:3px}
@media(max-width:720px){
  .academy-insight-nav{flex-wrap:nowrap;overflow-x:auto;padding:2px 2px 6px;overscroll-behavior-x:contain}
  .academy-insight-nav .academy-btn{flex:none;min-height:44px}
  .academy-insight-filters .academy-field{flex:1 1 140px;max-width:none}
  .academy-insight-grid{grid-template-columns:minmax(0,1fr)}
  .academy-insight-wide{grid-column:auto}
  .academy-insight-head{padding:16px 16px 12px}
  .academy-insight-body{padding:0 16px 16px}
  .academy-insight-list{padding:0 16px}
  .academy-insight-note{padding-inline:16px}
  .academy-insight-empty{padding-inline:16px}
}
@media(max-width:380px){
  .academy-insight-filters .academy-field{flex-basis:100%}
  .academy-insight-row{grid-template-columns:24px minmax(0,1fr) auto;column-gap:8px}
}
@media(prefers-reduced-motion:reduce){.academy-insight *{scroll-behavior:auto}}

/* Charts use the existing Academy palette and keep values in the adjacent text. */
.academy-insight-chart{min-width:0;padding:0 20px 18px;color:var(--text)}
.academy-insight-chart svg,.academy-insight-chart-svg{display:block;width:100%;height:auto;overflow:visible;font-family:inherit}
.academy-insight-chart-grid{stroke:var(--line-soft);stroke-width:1;vector-effect:non-scaling-stroke}
.academy-insight-chart-axis{fill:var(--text-secondary);font-size:11px;font-variant-numeric:tabular-nums}
.academy-insight-plot{display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px;align-items:stretch}
.academy-insight-scale{display:flex;flex-direction:column;justify-content:space-between;padding:10px 0 20px;color:var(--text-secondary);font-size:11px;text-align:right;white-space:nowrap}
.academy-insight-chart-line{fill:none;stroke:var(--academy-data);stroke-width:2;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.academy-insight-chart-point{fill:var(--surface);stroke:var(--academy-data);stroke-width:2;vector-effect:non-scaling-stroke}
.academy-insight-chart-labels,.academy-insight-chart-legend{display:flex;flex-wrap:wrap;align-items:center;gap:6px 16px;color:var(--text-secondary);font-size:12px;line-height:1.4}
.academy-insight-chart-labels{justify-content:space-between;margin-top:8px}
.academy-insight-chart-meta{color:var(--text-secondary);font-size:12px;line-height:1.4}
.academy-insight-chart-legend>span{display:inline-flex;align-items:center;gap:6px}
.academy-insight-chart-legend>span::before{content:"";width:8px;height:8px;border:2px solid var(--academy-data);border-radius:50%;flex:none}
.academy-insight-bar{height:10px;border-radius:5px}
.academy-insight-bar>i{border-radius:inherit}
.academy-insight-diverge{position:relative;grid-column:2 / -1;min-width:0;height:12px;background:var(--surface-soft);border-radius:6px}
.academy-insight-diverge-zero{position:absolute;z-index:1;left:var(--zero,50%);top:-3px;bottom:-3px;width:1px;background:var(--text-secondary);transform:translateX(-50%)}
.academy-insight-diverge-fill{position:absolute;left:var(--left,50%);width:var(--width,0%);top:0;bottom:0;border-radius:6px;background:var(--academy-data)}
.academy-insight-diverge-fill.is-down{background:var(--academy-danger)}
.academy-insight-survey-row{display:grid;grid-template-columns:minmax(72px,1fr) minmax(90px,2fr) auto;gap:8px 12px;align-items:center;min-width:0;padding:10px 0;border-top:1px solid var(--line-soft)}
.academy-insight-survey-row:first-child{border-top:0}
.academy-insight-survey-row :is(button,a){min-width:0;min-height:44px;overflow-wrap:anywhere;text-align:left}
.academy-insight-survey-line{position:relative;height:4px;margin:0 7px;background:var(--line);border-radius:2px}
.academy-insight-survey-before,.academy-insight-survey-current{position:absolute;top:50%;width:12px;height:12px;border:2px solid var(--academy-data);border-radius:50%;transform:translate(-50%,-50%)}
.academy-insight-survey-before{left:var(--before,0%);background:var(--surface)}
.academy-insight-survey-current{left:var(--current,0%);background:var(--academy-data)}
.academy-insight-row .academy-insight-survey-chart{grid-column:2 / -1;padding:4px 0 8px}
.academy-insight-survey-legend{padding:0 20px 4px}
.academy-insight-survey-legend>.is-current::before{background:var(--academy-data)}
.academy-insight-team-charts{margin:0 0 16px}
.academy-insight-row-details summary{cursor:pointer;min-height:32px;color:var(--academy-data);font-size:12px}
.academy-insight-row-details p{margin:2px 0}
.academy-insight-distribution{display:flex;min-width:0;height:12px;overflow:hidden;border-radius:6px;background:var(--surface-soft)}
.academy-insight-distribution-part{flex:0 0 var(--width,0%);min-width:0;height:100%;background:var(--academy-data)}
.academy-insight-distribution-part.is-stable{background:var(--text-secondary)}
.academy-insight-distribution-part.is-down{background:var(--academy-danger)}
.academy-insight-distribution-part+.academy-insight-distribution-part{border-left:2px solid var(--surface)}
@media(max-width:720px){
  .academy-insight-chart{padding:0 16px 16px}
  .academy-insight-survey-legend{padding-inline:16px}
  .academy-insight-survey-row{grid-template-columns:minmax(76px,1fr) minmax(74px,1.2fr) auto;gap:8px}
}

.academy-dialog[data-kind="clearances"] { width: min(760px, calc(100vw - 24px)); }
[data-clearance-panel] { display: grid; gap: 14px; }
[data-clearance-panel] h3, [data-clearance-panel] p { margin: 0; overflow-wrap: anywhere; }
[data-clearance-panel] > .academy-field:has(select[data-clear-team]) { max-width: 360px; }
[data-clearance-panel] label { min-width: 0; }
[data-clearance-panel] input, [data-clearance-panel] select { width: 100%; }
[data-clearance-panel] [hidden] { display: none; }
.clearance-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.clearance-row strong { overflow-wrap: anywhere; }
.clearance-row p { color: var(--text-secondary); font-size: 13px; }
.clearance-row [data-clear-state] { font-weight: 600; }
.clearance-row :is([data-clear-state="today"],[data-clear-state="soon"]) { color: #865b15; }
.clearance-row :is([data-clear-state="expired"],[data-clear-state="denied"]) { color: #9f3535; }
.clearance-row [data-clear-state="current"] { color: #0f766e; }
@media(max-width:560px) {
  [data-clearance-panel] .academy-form-grid { grid-template-columns: minmax(0,1fr); }
  .clearance-row > .academy-actions { flex-wrap: wrap; }
}
