:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #172d2a;
  background: #f2f6f4;
  --muted: #526862;
  --border: #dce7e1;
  --accent: #126753;
  --dark: #122f2d;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #58bfa0; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { background: var(--dark); color: #f5fdf8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; min-height: 420px; }
.brand { padding: 25px 19px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid #ffffff20; }
.brand strong { display: block; font-size: 1.18rem; letter-spacing: -.025em; }
.brand small { display: block; color: #a7c7be; margin-top: 2px; font-size: .81rem; }
.brand-mark { flex: none; width: 40px; height: 40px; display: grid; place-items: center; background: #a9ead0; color: #103d32; border-radius: 10px; }
.brand-mark svg { width: 23px; }
.sidebar-content { padding: 24px 16px; min-height: 0; flex: 1; display: flex; flex-direction: column; }
.sidebar-content h2 { font-size: .9rem; margin-bottom: 13px; color: #cee0d9; }
.search { display: flex; align-items: center; gap: 7px; border: 1px solid #ffffff29; border-radius: 8px; background: #ffffff08; padding: 0 9px; }
.search svg { width: 16px; flex: none; color: #a7c7be; }
.search input { color: white; background: transparent; border: 0; width: 100%; min-width: 0; padding: 9px 0; font-size: .85rem; }
.search input::placeholder { color: #acc4be; }
.new-report { border: 1px solid #6baf99; background: #1c4d43; color: #eafff6; border-radius: 8px; padding: 9px; font-weight: 650; margin: 11px 0 15px; text-align: left; }
.new-report span { margin-right: 6px; }
#reports { display: grid; gap: 6px; align-content: start; overflow: auto; }
.report-item { width: 100%; background: transparent; border: 1px solid transparent; color: #effaf5; text-align: left; padding: 9px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.report-item:hover, .report-item[aria-current="true"] { background: #225248; border-color: #396e60; }
.report-item strong, .report-item small { display: block; }
.report-item small, .sidebar-footer p, .empty-list { color: #b0cbc3; font-size: .8rem; margin-top: 4px; }
.sidebar-footer { padding: 15px 18px 19px; border-top: 1px solid #ffffff20; }
.sidebar-footer button { display: block; color: #e7f5f0; border: 0; background: transparent; padding: 6px 0; text-align: left; font-size: .87rem; }
.sidebar-footer button:hover { text-decoration: underline; }
.topbar { min-height: 63px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(16px, 3vw, 42px); }
#save-state { color: var(--muted); font-size: .86rem; text-align: right; }
#save-state[data-error] { color: #a52c23; }
.workspace-content { max-width: 1680px; margin: auto; padding: 29px clamp(16px, 3vw, 42px) 40px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.eyebrow { color: var(--accent); font-weight: 750; font-size: .78rem; letter-spacing: .095em; margin-bottom: 6px; }
h1 { font-size: clamp(1.85rem, 3.2vw, 2.7rem); line-height: 1.13; letter-spacing: -.045em; overflow-wrap: anywhere; }
#subtitle { color: var(--muted); margin-top: 7px; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 8px 13px; border-radius: 8px; font-size: .9rem; font-weight: 650; white-space: nowrap; border: 1px solid transparent; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: #0b5141; }
.secondary { background: #fff; color: #1c463d; border-color: #cdded6; }
.secondary:hover { background: #eef8f3; }
.destructive { background: #a42d24; color: white; }
.work-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.panel { border: 1px solid var(--border); border-radius: 14px; background: white; box-shadow: 0 2px 10px #16362b09; min-width: 0; }
.tabs { display: flex; padding: 0 14px; gap: 3px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.tabs button { padding: 14px 9px 12px; white-space: nowrap; color: var(--muted); background: transparent; border: 0; border-bottom: 3px solid transparent; font-size: .88rem; font-weight: 650; }
.tabs button[aria-pressed="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button:focus-visible { outline-offset: -4px; }
#form { padding: 21px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset + fieldset { border-top: 1px solid var(--border); margin-top: 23px; padding-top: 14px; }
legend { font-weight: 720; font-size: 1.06rem; padding: 0 8px 0 0; margin-bottom: 13px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 12px; }
.field { display: grid; align-content: start; gap: 5px; color: #2e483f; min-width: 0; font-weight: 600; font-size: .87rem; }
.full { grid-column: 1 / -1; }
.field input, .field textarea, .field select, .preview-head select { width: 100%; min-width: 0; padding: 8px 9px; min-height: 38px; border: 1px solid #cddcd5; border-radius: 7px; color: #19362e; background: #fbfdfc; font-size: .95rem; font-weight: 400; }
.field input:invalid { border-color: #b84232; }
.field textarea { resize: vertical; min-height: 74px; }
.editor-footer { border-top: 1px solid var(--border); padding: 13px 20px; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 62px; }
.quiet { border: 0; background: transparent; color: var(--accent); padding: 5px; font-size: .86rem; font-weight: 650; }
.quiet:hover { text-decoration: underline; }
.danger { color: #a12e24; }
.row-card { border: 1px solid var(--border); border-radius: 9px; padding: 12px; margin-bottom: 10px; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.row-head strong { font-size: .84rem; color: var(--muted); }
.goals { padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; background: #f4f9f6; }
.goals summary { cursor: pointer; color: var(--accent); font-size: .92rem; font-weight: 650; }
.goals .fields { margin-top: 9px; }
.goals .field-help { margin-top: 7px; }
.field-help { color: var(--muted); font-size: .85rem; }
.competency-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.competency-controls:not(:has(> :not([hidden]))) { display: none; }
.field textarea[readonly] { background: #f4f9f6; }
.photo-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.photo-controls img { width: 42px; height: 56px; object-fit: cover; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 15px; border-bottom: 1px solid var(--border); }
.preview-head h2 { font-size: 1rem; }
.preview-head p { font-size: .83rem; color: var(--muted); margin-top: 3px; }
.preview-head select { width: auto; max-width: 52%; font-size: .85rem; }
#preview { background: #e8efeb; border-radius: 0 0 14px 14px; padding: 16px; max-height: 740px; overflow: auto; }
.paper { background: white; font: 11pt/1.35 "Times New Roman", serif; color: #111; overflow-wrap: anywhere; }
#preview .paper { padding: 7% 8%; min-height: 440px; box-shadow: 0 1px 8px #183b2e21; font-size: clamp(.68rem, .86vw, .87rem); }
#preview .paper:not(.cover) { background: white var(--watermark) center / 23.81% auto no-repeat; }
.paper h2 { text-align: center; font-size: 1.15em; margin: 0 0 1em; }
.paper h3 { margin: 1em 0 .35em; font-size: 1.03em; }
.paper p { white-space: pre-wrap; }
.paper table { border-collapse: collapse; width: 100%; table-layout: fixed; margin-bottom: .8em; }
.paper :is(th,td) { padding: .35em .4em; border: 1px solid #555; vertical-align: top; white-space: pre-wrap; }
.paper .plain :is(th,td) { border: 0; text-align: left; padding: .15em .2em; }
.paper .plain th { width: 41%; font-weight: normal; }
.report-details { display: grid; grid-template-columns: 3fr 2fr; gap: .3em .75em; margin: 0 0 1em; }
.report-details div { display: grid; grid-template-columns: minmax(0, 43%) minmax(0, 57%); gap: .2em; }
.report-details dd { margin: 0; }
.report-details dd::before { content: ": "; }
.paper .grade td:nth-child(1), .paper .grade td:nth-child(3) { text-align: center; }
.paper ol { padding-left: 1.55em; }
.paper li { margin: .35em 0; }
.cover { text-align: center; }
.cover .logo { display: block; width: 25%; max-width: 45mm; margin: 3em auto; }
.cover > span { display: block; margin: .4em auto 1.3em; padding: .35em; border: 1px solid; width: 65%; min-height: 1.9em; font-weight: bold; }
.cover footer { margin-top: 3.5em; font-weight: bold; }
.signature, .bio-signature { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; margin-top: 1.3em; text-align: center; break-inside: avoid; }
.signature .principal { grid-column: 1 / -1; }
.signed-name { margin-top: 2.4em; font-weight: bold; }
.bio-signature img { width: 25mm; height: 33.33mm; object-fit: cover; margin: auto; }
dialog { border: 1px solid var(--border); border-radius: 12px; padding: 22px; color: #172d2a; max-width: min(410px, 95vw); }
dialog::backdrop { background: #152a27aa; }
dialog p { margin: 10px 0 16px; }
dialog .actions { justify-content: end; }
#print-area { display: none; }
@media (max-width: 1070px) { .work-grid { grid-template-columns: minmax(0, 1fr); } #preview { max-height: none; } #preview .paper { max-width: 600px; margin: auto; } }
@media (max-width: 700px) {
  .app { display: block; }
  .sidebar { position: static; height: auto; min-height: 0; }
  .brand { padding: 12px 16px; }
  .sidebar-content { padding: 12px 16px; }
  #reports { max-height: 135px; }
  .sidebar-footer { padding: 7px 16px 12px; display: flex; flex-wrap: wrap; gap: 5px 14px; align-items: center; }
  .hero { align-items: start; flex-direction: column; }
  #form { padding: 15px; }
}
@media (max-width: 360px) { .fields { grid-template-columns: 1fr; } }
@page { size: A4; margin: 15mm 20mm 10mm 25.4mm; }
@media print {
  body { background: white; }
  .app, dialog { display: none !important; }
  #print-area { display: block; isolation: isolate; }
  #print-watermark { position: fixed; top: calc(50% - 2.5mm); left: calc(50% - 2.7mm); transform: translate(-50%, -50%); width: 5cm; height: auto; z-index: -1; }
  .paper { break-after: page; background: transparent; }
  .paper:last-child { break-after: auto; }
  .paper thead { display: table-header-group; }
  .paper tr { break-inside: avoid; }
  .paper h3 { break-after: avoid; }
  .cover { padding-top: 10mm; background: white; print-color-adjust: exact; }
  .cover .logo { margin: 22mm auto; }
  .cover footer { margin-top: 40mm; }
}
