/* Single self-contained stylesheet for the okstra final-report HTML view.
 * Inlined verbatim by scripts/okstra_ctl/report_views.py render_html.
 * No external @import, no url() references. System colors only so dark
 * mode follows the user's OS without a media query toggle.
 */

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  background: Canvas;
  color: CanvasText;
}

.report-header,
.report-footer {
  position: sticky;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: Canvas;
  border-bottom: 1px solid GrayText;
  z-index: 10;
}

.report-header { top: 0; }
.report-footer {
  bottom: 0;
  border-top: 1px solid GrayText;
  border-bottom: none;
  flex-wrap: wrap;
}

.report-header > div { flex: 1; font-weight: 600; }

main {
  max-width: 120ch;
  margin: 1.5rem auto;
  padding: 0 1rem 4rem;
}

nav.toc {
  margin: 1rem 0 2rem;
  padding: 0.6em 1em;
  border: 1px solid color-mix(in srgb, GrayText 40%, transparent);
  border-radius: 4px;
  background: color-mix(in srgb, CanvasText 4%, transparent);
}
nav.toc .toc-title {
  font-weight: 600;
  margin-bottom: 0.4em;
  font-size: 0.95rem;
}
nav.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 1.5em;
}
@media (max-width: 60ch) {
  nav.toc ul { columns: 1; }
}
nav.toc li { margin: 0.15em 0; break-inside: avoid; }
nav.toc li.toc-h3 { padding-left: 1.2em; font-size: 0.92em; }
nav.toc a { color: inherit; text-decoration: none; }
nav.toc a:hover { text-decoration: underline; }

.reader-dashboard {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid color-mix(in srgb, Highlight 45%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, Highlight 8%, Canvas);
}
.reader-dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.reader-dashboard h2 {
  margin: 0;
  border-bottom: none;
  padding-bottom: 0;
}
.reader-mode-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.reader-mode-controls button[aria-pressed="true"] {
  background: Highlight;
  color: HighlightText;
  border-color: Highlight;
}
.reader-summary-grid {
  display: grid;
  grid-template-columns: minmax(12ch, 0.28fr) 1fr;
  gap: 0.45rem 0.9rem;
  margin: 0;
}
.reader-summary-grid dt {
  font-weight: 600;
  color: color-mix(in srgb, CanvasText 72%, transparent);
}
.reader-summary-grid dd { margin: 0; }

html[data-reader-mode="action"] main > [data-reader-section="audit"],
html[data-reader-mode="action"] main > [data-reader-section="detail"] {
  display: none;
}
html[data-reader-mode="audit"] main > [data-reader-section="detail"] {
  display: none;
}

@media (max-width: 70ch) {
  .reader-dashboard-head { align-items: flex-start; flex-direction: column; }
  .reader-summary-grid { grid-template-columns: 1fr; }
  .reader-summary-grid dt { margin-top: 0.45rem; }
}

h1, h2, h3, h4, h5, h6 { line-height: 1.25; margin-top: 1.6em; margin-bottom: 0.4em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.35rem; border-bottom: 1px solid GrayText; padding-bottom: 0.2em; }
h3 { font-size: 1.12rem; }
h4 { font-size: 1rem; }

p, ul, ol, blockquote, pre, table { margin: 0.6em 0; }

ul, ol { padding-left: 1.4em; }

blockquote {
  border-left: 3px solid GrayText;
  padding: 0.2em 0.8em;
  color: GrayText;
}

code {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  background: color-mix(in srgb, CanvasText 8%, transparent);
  border-radius: 3px;
}

pre {
  overflow-x: auto;
  padding: 0.8em 1em;
  background: color-mix(in srgb, CanvasText 6%, transparent);
  border-radius: 4px;
}
pre code { background: transparent; padding: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td {
  border: 1px solid color-mix(in srgb, GrayText 50%, transparent);
  padding: 0.45em 0.6em;
  vertical-align: top;
  text-align: left;
  word-break: keep-all;
  overflow-wrap: anywhere;
  min-width: 5ch;
  /* No max-width: cells that carry prose (statement / source / scope)
   * absorb the remaining horizontal space within `main`'s 120ch. */
}
/* Narrow columns — assigned by `_narrow_columns()` in report_views.py:
 * either every cell fits within 30 plain chars, or the header is
 * whitelisted (ID, Ticket ID, Kind, Status, 항목, 출처, 에이전트 …)
 * AND no cell carries a <br>-line over 60 plain chars — `nowrap` below
 * makes the longest line the column's intrinsic width, so longer lines
 * must fall back to a plain wrapping column. Pinning `width: 5%` makes
 * narrow columns shrink toward the suggestion while wide neighbours
 * absorb the remainder. */
td.td-narrow, th.td-narrow {
  width: 5%;
  white-space: nowrap;
}
/* Path columns — assigned by `_path_columns()` in report_views.py. A
 * repo-relative path holds no spaces, so the `overflow-wrap: anywhere`
 * above lets the auto table layout starve the column down to a couple of
 * characters per line. Floor the width and let it wrap at separators. */
td.td-path, th.td-path {
  min-width: 26ch;
  word-break: break-word;
}

/* Second line of a two-tier cell: the plain-language summary leads, the
 * technical detail follows demoted. */
td small {
  display: inline-block;
  margin-top: 0.35em;
  font-size: 0.88em;
  color: GrayText;
}

thead th {
  position: sticky;
  top: 3rem;
  background: Canvas;
  z-index: 5;
}

tr[data-response-id] {
  background: color-mix(in srgb, Highlight 6%, transparent);
}
tr[data-response-id][data-status="resolved"],
tr[data-response-id][data-status="obsolete"] {
  background: transparent;
  opacity: 0.65;
}

textarea,
select[data-response-id],
input[data-response-id],
input[data-other-for] {
  width: 100%;
  font: inherit;
  padding: 0.3em 0.4em;
  border: 1px solid GrayText;
  border-radius: 3px;
  background: Canvas;
  color: CanvasText;
}
textarea {
  min-height: 2.2em;
  resize: vertical;
}
input[data-other-for] {
  margin-top: 0.35em;
}
textarea[disabled],
select[disabled],
input[disabled] { opacity: 0.55; }

button[data-action] {
  font: inherit;
  padding: 0.4em 0.9em;
  border: 1px solid GrayText;
  border-radius: 4px;
  background: ButtonFace;
  color: ButtonText;
  cursor: pointer;
}
button[data-action]:hover { background: color-mix(in srgb, Highlight 20%, ButtonFace); }

#user-response-output {
  flex-basis: 100%;
  max-height: 14em;
  overflow: auto;
  margin: 0.6em 0 0;
  padding: 0.6em 0.8em;
  background: color-mix(in srgb, CanvasText 6%, transparent);
  border-radius: 4px;
  white-space: pre-wrap;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.85rem;
}
#user-response-output:empty { display: none; }

.user-response-dismiss {
  position: absolute;
  top: 0.35em;
  right: 0.5em;
  padding: 0 0.45em;
  line-height: 1.5;
  font-size: 1.05rem;
  font-weight: 600;
}

#plan-approval {
  max-width: 120ch;
  margin: 1.5rem auto;
  padding: 0.8em 1rem;
  border: 1px solid color-mix(in srgb, GrayText 40%, transparent);
  border-radius: 4px;
}
#plan-approval h2 { margin-top: 0; }
#plan-approval label { display: block; margin: 0.4em 0; }
#plan-approval select { font: inherit; max-width: 100%; }
.approval-disabled-reason {
  margin: 0.6em 0 0;
  padding: 0.7em 0.9em;
  border-radius: 4px;
  background: color-mix(in srgb, Highlight 12%, transparent);
  border: 1px solid color-mix(in srgb, Highlight 45%, transparent);
}
.approval-disabled-reason p { margin: 0 0 0.5em; }
.approval-steps { margin: 0.3em 0 0; padding-left: 1.4em; }
.approval-steps li { margin: 0.25em 0; }

@media print {
  .report-header, .report-footer { position: static; }
  thead th { position: static; }
  button[data-action] { display: none; }
  #user-response-output { display: none; }
  #plan-approval { display: none; }
}
