/* ============================================================================
   GSB Tenure — employee tenure and internal promotions (js/tenure-app.js).
   #tenure-screen only. Every rule is ID-scoped and every table cell / form control sets its own
   box so style.css's global label / select / input / table / th / td rules can't leak in.
   Colors come from gsb-tokens.css; negative = clay (never red). Exec-tier tab (access-scope.js).
   ========================================================================= */

#tenure-screen {
  --bg: var(--gsb-paper); --surface: #FBF8F1; --ink: var(--gsb-soil-ink); --muted: var(--gsb-stone); --faint: #8A8171;
  --line: var(--gsb-oat-dk); --oat: var(--gsb-oat); --total: #EDE7DA; --green: var(--gsb-shoot-green); --leaf: var(--gsb-leaf);
  --ochre: var(--gsb-ochre); --wash: #F2E7C8; --clay: var(--gsb-clay); --focus: var(--gsb-shoot-green);
  font-family: var(--font-body); color: var(--ink);
}

/* GSB.<Page> title wordmark — self-contained (Monday Scan / JB Bridge pattern) */
#tenure-screen .nav-bar h2 {
  font-family: var(--font-body) !important; font-weight: 700 !important; font-size: 22px !important;
  letter-spacing: -0.04em !important; color: var(--gsb-soil-ink) !important;
  display: flex; align-items: baseline; gap: 2px; margin: 0;
}
#tenure-screen .nav-bar h2 .gsb-title-mark { flex: 0 0 auto; color: var(--gsb-soil-ink); }
#tenure-screen .nav-bar h2 .gsb-title-dot { color: var(--gsb-leaf); }
#tenure-screen .nav-bar h2 .gsb-kw {
  color: var(--gsb-soil-ink) !important;
  background: linear-gradient(transparent 58%, rgba(130, 187, 144, 0.50) 58%) !important;
  padding: 0 2px; border-radius: 1px;
}
#tenure-screen .tn-tagline { font-size: 11px; color: var(--gsb-stone); }

#tenure-screen #tenure-root { max-width: 1400px; margin: 0 auto; padding: 8px 16px 96px; font-size: 14px; line-height: 1.45; }
#tenure-screen .tn-loading { color: var(--gsb-stone); padding: 40px 4px; text-align: center; font-size: 13.5px; }

/* leak guards from style.css */
#tenure-screen label { display: inline; margin: 0; text-transform: none; letter-spacing: 0; font-size: inherit; font-weight: inherit; color: inherit; }
#tenure-screen select, #tenure-screen input { width: auto; box-shadow: none; transition: none; }
#tenure-screen table { width: 100%; min-width: 0; border-collapse: collapse; }
#tenure-screen th, #tenure-screen td { text-align: left; font-size: inherit; color: inherit; border-bottom: 0; padding: 0; background: none; }
#tenure-screen tr:last-child td { border-bottom: 0; }
#tenure-screen * { box-sizing: border-box; }
#tenure-screen button { font: inherit; color: inherit; cursor: pointer; }
#tenure-screen :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* controls */
#tenure-screen .tn-ctl { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin-bottom: 14px; }
#tenure-screen .grp { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#tenure-screen .lab { font: 500 11px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
#tenure-screen .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
#tenure-screen .seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 12.5px; color: var(--muted); border-right: 1px solid var(--line); }
#tenure-screen .seg button:last-child { border-right: 0; }
#tenure-screen .seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 600; }
#tenure-screen .btn { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 5px 11px; font-size: 12.5px; }
#tenure-screen .btn:hover { border-color: var(--muted); }
#tenure-screen input.inp { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; font-size: 12.5px; min-width: 170px; }
#tenure-screen .chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 12px; color: var(--muted); background: var(--surface); margin-left: auto; }
#tenure-screen .chip b { color: var(--ink); font-weight: 600; }
#tenure-screen .seg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }

#tenure-screen .tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 16px; scrollbar-width: none; }
#tenure-screen .tabs::-webkit-scrollbar { display: none; }
#tenure-screen .tabs button { flex: 0 0 auto; background: none; border: 0; border-bottom: 3px solid transparent; padding: 11px 16px 9px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
#tenure-screen .tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--green); font-weight: 600; }

/* tiles */
#tenure-screen .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
#tenure-screen .tile { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 13px 15px 12px; min-width: 0; }
#tenure-screen .tile .k, #tenure-screen .detail .k { font: 500 11px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
#tenure-screen .tile .big { font: 500 32px/1.1 var(--font-display); letter-spacing: -.01em; margin: 8px 0 6px; font-variant-numeric: tabular-nums; }
#tenure-screen .tile .big small { font-size: 14px; color: var(--muted); letter-spacing: 0; }
#tenure-screen .tile .row { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
#tenure-screen .tile .row b { color: var(--ink); font-weight: 600; }
#tenure-screen .tile .tnote { margin-top: 7px; font-size: 11.5px; color: var(--faint); }
#tenure-screen .up { color: var(--green); font-weight: 600; }
#tenure-screen .dn { color: var(--clay); font-weight: 600; }

/* cards + charts */
#tenure-screen .grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
#tenure-screen .card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px 10px; margin-bottom: 14px; min-width: 0; }
#tenure-screen .grid2 .card { margin-bottom: 0; }
#tenure-screen .ch-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 14px; margin-bottom: 6px; font-size: 13px; }
#tenure-screen .ch-h b { font-weight: 600; }
#tenure-screen .muted { color: var(--muted); font-size: 12px; }
#tenure-screen .pad { padding: 18px 10px; }
#tenure-screen .legend, #tenure-screen .mixleg { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); }
#tenure-screen .legend i, #tenure-screen .mixleg i, #tenure-screen .tip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
#tenure-screen .chwrap { position: relative; }
#tenure-screen svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
#tenure-screen svg.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
#tenure-screen svg.chart .tk { font: 10px var(--font-mono); fill: var(--muted); }
#tenure-screen svg.chart .xh { stroke: var(--ink); stroke-width: 1; opacity: .35; pointer-events: none; }
#tenure-screen .tip { position: absolute; top: 4px; z-index: 5; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: 6px; padding: 7px 10px; font-size: 11.5px; line-height: 1.5; min-width: 150px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
#tenure-screen .tip b { font-weight: 600; }
#tenure-screen .tip div { display: flex; align-items: center; gap: 2px; }
#tenure-screen .tip div b { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
#tenure-screen .note { border: 1px solid var(--ochre); background: var(--wash); border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; font-size: 12.5px; }
#tenure-screen .foot { font-size: 12px; color: var(--muted); margin: 10px 2px 0; max-width: 100ch; }

/* tables */
#tenure-screen .scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
#tenure-screen .scroll.flat { border: 0; background: none; }
#tenure-screen .tbl { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
#tenure-screen .tbl th, #tenure-screen .tbl td { height: 31px; padding: 0 10px; white-space: nowrap; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: right; }
#tenure-screen .tbl th { font: 500 10.5px/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--total); position: sticky; top: 0; user-select: none; }
#tenure-screen .tbl th[data-sort] { cursor: pointer; }
#tenure-screen .tbl th[data-sort]:hover { color: var(--ink); }
#tenure-screen .tbl th.l, #tenure-screen .tbl td.l, #tenure-screen .tbl td.lbl, #tenure-screen .tbl td.gmn, #tenure-screen .tbl.ev td { text-align: left; }
#tenure-screen .tbl.ev td.n { text-align: right; }
#tenure-screen .tbl td.b { font-weight: 700; }
#tenure-screen .tbl td.lbl { font-weight: 500; }
#tenure-screen .tbl tr.gr { cursor: pointer; }
#tenure-screen .tbl tr.gr:hover td { background: rgba(130, 187, 144, .12); }
#tenure-screen .tbl tr.gr.small td { opacity: .55; }
#tenure-screen .tbl td.sp { padding-right: 12px; }
#tenure-screen .caret { display: inline-block; width: 14px; color: var(--faint); font-size: 11px; }
#tenure-screen .tag { font: 500 10px var(--font-mono); letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; margin-left: 6px; }
#tenure-screen .gmn { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
#tenure-screen tr.dt td { background: var(--bg); white-space: normal; text-align: left; padding: 12px 14px; height: auto; }
#tenure-screen .detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; }
#tenure-screen .detail .card { margin: 0; }
#tenure-screen .mixbar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; margin: 8px 0 8px; background: var(--line); }
#tenure-screen .mixleg b { color: var(--ink); font-weight: 600; margin-left: 2px; }
#tenure-screen .pill { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; font-size: 11px; color: var(--muted); }
#tenure-screen .tbl.narrow { min-width: 0; }
#tenure-screen .pill.nw { background: rgba(181, 83, 46, .14); border-color: transparent; color: var(--clay); }
#tenure-screen .pill.ok { background: rgba(47, 107, 69, .14); border-color: transparent; color: var(--green); font-weight: 600; }
#tenure-screen .ctl2 { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
#tenure-screen .more { text-align: center; padding: 12px 0 4px; }

@media (max-width: 760px) {
  #tenure-screen #tenure-root { padding: 6px 12px 110px; }
  #tenure-screen .grid2, #tenure-screen .detail { grid-template-columns: minmax(0, 1fr); }
  #tenure-screen .chip { margin-left: 0; }
  #tenure-screen .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #tenure-screen .tile .big { font-size: 26px; }
  #tenure-screen .tile .tnote { display: none; }
  #tenure-screen input.inp { min-width: 0; flex: 1 1 100%; }
  #tenure-screen .tn-ctl { gap: 8px 8px; }
  #tenure-screen .tn-ctl .grp { gap: 0; }
  #tenure-screen .tn-ctl .grp > .lab { display: none; }
  #tenure-screen .tn-ctl .grp:has(#tn-pop) { flex: 1 1 100%; }
  #tenure-screen .seg button { padding: 6px 10px; }
}
