/* MADLY appraisals. Layout: one calm working column; header with logo and role tabs;
   tables scroll inside their own wrapper; the rating grid becomes stacked options on phones.
   Typeface: Calibri Light where installed, with the metric-compatible Carlito as a fallback. */
@font-face {
  font-family: "MadlyText";
  src: local("Calibri Light"), local("Calibri-Light"), local("CalibriLight"),
       url("/fonts/Carlito-Regular.woff2") format("woff2");
  font-weight: 100 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "MadlyText";
  src: local("Calibri Bold"), local("Calibri-Bold"), url("/fonts/Carlito-Bold.woff2") format("woff2");
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #f3f6f6; --surface: #ffffff; --surface2: #e8eeee; --ink: #1c2527; --muted: #5a6a6c; --line: #d2dcdd;
  --accent: #0d7377; --accent-ink: #ffffff; --accent-soft: #d5ebea;
  --good: #1f7a4d; --good-soft: #dcefe5; --warn: #8a5a00; --warn-soft: #f6e8c8; --crit: #a3262f; --crit-soft: #f6dcdd;
  --font: "MadlyText", "Calibri Light", Calibri, Carlito, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1617; --surface: #172122; --surface2: #1e2b2c; --ink: #e9f1f1; --muted: #9bb0b1; --line: #2c3d3e;
    --accent: #5fc9c4; --accent-ink: #062321; --accent-soft: #143638;
    --good: #6fcf9f; --good-soft: #173325; --warn: #e8bd6a; --warn-soft: #3a2d10; --crit: #f08a92; --crit-soft: #3c1c1f;
    color-scheme: dark;
  }
  .logo { filter: invert(1); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); padding-inline: 16px; }
[hidden] { display: none !important; }
.wrap { max-width: 1080px; margin-inline: auto; padding-block: 22px 72px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; text-wrap: balance; }
h2 { font-size: 24px; line-height: 1.25; }
h3 { font-size: 18px; }
h4 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.logo { display: block; height: 58px; width: auto; max-width: 100%; }
@media (max-width: 520px) { .logo { height: 44px; } }
.top { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: flex-end; justify-content: space-between; padding-bottom: 16px; border-bottom: 2px solid var(--accent); }
.top .sub { color: var(--muted); font-size: 14px; margin-top: 8px; }
.who { text-align: right; font-size: 14px; color: var(--muted); min-width: 0; display: grid; gap: 2px; justify-items: end; }
.who b { color: var(--ink); font-weight: 600; font-size: 16px; }
.linkbtn { font: inherit; font-size: 14px; background: none; border: 0; padding: 4px 0; color: var(--accent); cursor: pointer; text-decoration: underline; }
.nav { display: flex; flex-wrap: wrap; gap: 6px; padding-block: 14px 6px; }
.nav button { font: inherit; font-size: 15px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 999px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.nav button[aria-current="page"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.badge { background: var(--crit); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 7px; font-weight: 700; }
main { display: grid; gap: 22px; padding-top: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; min-width: 0; }
.stack { display: grid; gap: 14px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.btn { font: inherit; font-size: 15px; font-weight: 600; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 16px; cursor: pointer; min-height: 42px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 5px 11px; min-height: 34px; font-size: 14px; }
.btn.danger { color: var(--crit); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label.f { display: grid; gap: 5px; font-size: 14px; font-weight: 600; color: var(--muted); min-width: 0; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 2px 10px 2px 8px; white-space: nowrap; background: var(--surface2); color: var(--muted); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 20px; }
.details div b { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.q { display: grid; gap: 8px; }
.q .qt { display: flex; gap: 10px; font-weight: 600; }
.num { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 1.6em; font-weight: 600; flex: none; }
.save { font-size: 14px; color: var(--muted); }
.err { font-size: 14px; color: var(--crit); }
.banner { border-radius: 10px; padding: 12px 14px; font-size: 15px; background: var(--accent-soft); border: 1px solid var(--line); }
.banner.warn { background: var(--warn-soft); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 15px; }
th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--surface2); }
td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
tr.sel td { background: var(--accent-soft); }
td .name { font-weight: 600; }
td .role { font-size: 13px; color: var(--muted); }
.num-cell { font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.depts { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.dept { display: grid; grid-template-columns: minmax(120px, .8fr) repeat(3, minmax(0, 1fr)); gap: 8px 22px; padding: 14px 16px; align-items: center; }
.dept + .dept { border-top: 1px solid var(--line); }
.dept .dn { font-size: 24px; line-height: 1.1; font-weight: 600; }
.dept .dm { font-size: 13px; color: var(--muted); }
.prog { display: grid; gap: 5px; min-width: 0; }
.prog .pl { display: flex; justify-content: space-between; font-size: 14px; }
.prog .pl span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 760px) { .dept { grid-template-columns: 1fr; } }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 22px; }
.qa { display: grid; gap: 14px; }
.qa-q { display: flex; gap: 10px; font-weight: 600; font-size: 15px; }
.qa-a { white-space: pre-wrap; margin-top: 4px; padding-left: 2.6em; overflow-wrap: anywhere; }
.qa-a.empty { color: var(--muted); font-style: italic; }
.crit-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding-block: 8px; border-top: 1px solid var(--line); font-size: 15px; }
.crit-line:first-child { border-top: 0; }
.seg { display: inline-flex; gap: 3px; vertical-align: middle; }
.seg i { width: 12px; height: 12px; border: 1.5px solid var(--muted); border-radius: 3px; display: block; }
.seg i.on { background: var(--accent); border-color: var(--accent); }
.crit-line .rl { font-size: 13px; color: var(--muted); text-align: right; }
.comment { white-space: pre-wrap; overflow-wrap: anywhere; }
.tabs { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.tabs button { font: inherit; font-size: 15px; font-weight: 600; border: 0; background: transparent; color: var(--ink); padding: 9px 16px; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.rgrid { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.rhead, .rrow { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(5, minmax(0, 1fr)); align-items: center; }
.rhead { background: var(--surface2); font-size: 13px; color: var(--muted); }
.rhead .rcol { padding: 10px 6px; text-align: center; display: grid; gap: 2px; }
.rhead .rcol b { color: var(--ink); font-size: 14px; }
.rrow { border-top: 1px solid var(--line); }
.rtext { padding: 12px 14px; display: flex; gap: 10px; }
.opt { position: relative; display: flex; justify-content: center; align-items: center; padding: 12px 6px; cursor: pointer; min-height: 46px; }
.opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.box { width: 20px; height: 20px; border: 1.5px solid var(--muted); border-radius: 4px; display: grid; place-items: center; flex: none; }
.opt input:checked + .box { background: var(--accent); border-color: var(--accent); }
.opt input:checked + .box::after { content: ""; width: 10px; height: 5px; border-left: 2px solid var(--accent-ink); border-bottom: 2px solid var(--accent-ink); transform: rotate(-45deg) translate(1px, -1px); }
.opt input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.olabel { display: none; }
@media (max-width: 760px) {
  .rhead { display: none; }
  .rrow { grid-template-columns: 1fr 1fr; }
  .rtext { grid-column: 1 / -1; padding-bottom: 2px; }
  .opt { justify-content: flex-start; gap: 10px; padding: 8px 14px; min-height: 42px; }
  .olabel { display: inline; font-size: 15px; }
}
details.help summary { cursor: pointer; font-weight: 600; }
details.help ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.empty-state { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty-state h3 { color: var(--ink); margin-bottom: 6px; }
.login { max-width: 520px; margin-inline: auto; display: grid; gap: 22px; padding-top: 8px; }
.linkcell { display: flex; gap: 6px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 15px; z-index: 10; max-width: calc(100vw - 32px); }
@media (prefers-reduced-motion: no-preference) { .btn, .nav button { transition: background .15s, border-color .15s; } }

h4.sec { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--accent); }
h4.sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.rpick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.rpick .opt { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; text-align: center; padding: 10px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; min-width: 0; }
.rpick .olabel { font-size: 13px; line-height: 1.25; display: block; }
@media (max-width: 640px) { .rpick { grid-template-columns: 1fr; } .rpick .opt { flex-direction: row; justify-content: flex-start; text-align: left; } }
