:root {
  font-family: system-ui, sans-serif;
  color: #18263b;
  background: #f3f6f9;
  line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; }
.topbar, main { padding: 1rem clamp(1rem, 3vw, 2rem); }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; background: #172940; color: #fff; }
.topbar p, h1 { margin: 0; }
.topbar div p { color: #b2dfeb; font-size: .82rem; }
h1 { font-size: clamp(1.4rem, 4vw, 2rem); }
h2, h3 { margin: 0 0 .65rem; }
h2 { font-size: 1.08rem; }
h3 { font-size: .97rem; }
.toolbar, .document-header, .actions { display: flex; flex-wrap: wrap; gap: .65rem 1rem; align-items: center; }
.toolbar { margin-bottom: .85rem; }
.toolbar label { min-width: min(12rem, 100%); }
.workspace { display: grid; grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr); gap: 1rem; align-items: start; }
.settings { display: grid; gap: .7rem; }
.settings section, .documents { min-width: 0; padding: .9rem; background: white; border: 1px solid #d7e0e9; border-radius: .6rem; }
label { display: block; font-weight: 600; }
button, input, select { font: inherit; }
select, input[type="number"] { display: block; width: 100%; min-height: 2.2rem; padding: .3rem .5rem; border: 1px solid #a7b8ca; border-radius: .3rem; }
input[type="color"] { display: block; width: 3rem; height: 2rem; }
button { padding: .4rem .7rem; border: 1px solid #185888; border-radius: .35rem; color: #fff; background: #185888; cursor: pointer; }
button:disabled { color: #5a6a7c; background: #eaf0f5; border-color: #c8d4e0; cursor: default; }
:focus-visible { outline: 3px solid #067ca0; outline-offset: 2px; }
fieldset { display: grid; gap: .55rem; min-width: 0; padding: .55rem; border: 1px solid #d7e0e9; }
dt { font-weight: 700; }
dd { margin: 0 0 .4rem; overflow-wrap: anywhere; }
summary { cursor: pointer; }
#sources { padding-inline-start: 1.2rem; overflow-wrap: anywhere; }
.notice { padding: .6rem .8rem; border-left: 3px solid #9b650a; background: #fff4db; }
.document-header { justify-content: space-between; margin-bottom: .75rem; }
.document-header h2 { margin: 0; }
.pdf-grid { display: grid; gap: .8rem; }
.pdf-grid.side-by-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pdf-grid article { min-width: 0; padding: .75rem; background: #f6f8fa; border: 1px solid #d7e0e9; border-radius: .45rem; }
.pdf-grid p { margin: .35rem 0; }
iframe { width: 100%; height: max(25rem, 65vh); margin-top: .5rem; border: 1px solid #d7e0e9; }

@media (max-width: 54rem) {
  .workspace, .pdf-grid.side-by-side { grid-template-columns: minmax(0, 1fr); }
}
