/* Frammi: the parts pages are built from. Everything takes its colours, space and shape from tokens.css. */

/* --- The name, in the side menu and on the sign-in card --- */
.brand {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 0 var(--space-2);
  min-height: var(--target);
  color: var(--sidebar-text);
  font-size: var(--fs-lg); font-weight: 700; text-decoration: none;
}
.brand:hover { color: var(--sidebar-text); }
.brand-dark, .brand-dark:hover { color: var(--heading); padding: 0; min-height: 0; }
.brand-mark {
  width: 14px; height: 14px; flex: none;
  background: var(--accent); border-radius: 4px;
}

/* --- Buttons ---
   .btn alone is the secondary button. One .btn-primary per screen or card: the main action.
   States: hover, pressed (:active), disabled, and loading (.is-loading, set by app.js on submit). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--target);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--field-border); border-radius: var(--radius);
  background: var(--surface); color: var(--interactive);
  font-weight: 600; line-height: 1.25; text-align: center; text-decoration: none;
  overflow-wrap: anywhere;          /* a long label wraps inside the button */
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--interactive-soft); color: var(--interactive-hover); }
.btn:active { background: var(--border); transform: translateY(1px); }

.btn-primary { background: var(--accent); border-color: var(--accent-edge); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-edge); color: var(--on-accent); }
.btn-primary:active { background: var(--accent-pressed); border-color: var(--accent-edge); }

.btn-text { padding: var(--space-2) var(--space-3); border-color: transparent; background: transparent; }
.btn-text:hover { background: var(--interactive-soft); text-decoration: underline; }

.btn-block { display: flex; width: 100%; }

.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn.is-loading { cursor: progress; pointer-events: none; opacity: 0.8; }
.btn.is-loading > .icon, .btn.is-loading > .ms-mark { display: none; }
.btn.is-loading::before {
  content: ""; width: 16px; height: 16px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ms-mark { flex: none; border-radius: 2px; }

/* --- Cards --- */
.card {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
}
.card > * + * { margin-top: var(--space-3); }
.card.stack > * + * { margin-top: var(--space-3); }
.card > input[type="hidden"] + * { margin-top: 0; }
.card-narrow { max-width: 640px; }
@media (max-width: 860px) { .card { padding: var(--space-3); } }

/* --- Forms: the label sits above the field and stays there --- */
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field > label { font-weight: 600; }
.field .hint { margin-top: -2px; }
/* A heading with what it is about after it, smaller, on the same line */
.title-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); }
.title-line > * { margin: 0; }
.title-note { color: var(--text-muted); font-size: var(--fs-sm); }
.section-gap { margin-bottom: var(--space-3); }
.check > span.check-inline { display: block; }
.check-inline > .hint { font-size: var(--fs-sm); }
/* The label with its instruction after it, smaller, on the same line */
.label-line > label { font-weight: 600; }
.label-line > .hint { margin: 0; font-size: var(--fs-sm); }
/* A text box with its one action to the right of it */
.input-tool { display: flex; align-items: flex-start; gap: var(--space-2); }
.input-tool > .input { flex: 1; min-width: 0; }
.btn-tool { flex: none; width: 112px; padding: var(--space-1) var(--space-2); font-size: var(--fs-sm); }
@media (max-width: 640px) {
  .input-tool { flex-direction: column; align-items: stretch; }
  .btn-tool { width: auto; align-self: flex-end; }
}

.field > label.check { font-weight: 400; }
.input {
  width: 100%; min-height: var(--target);
  padding: var(--space-2) 12px;
  background: var(--field);
  border: 1px solid var(--field-border); border-radius: var(--radius);
}
textarea.input { resize: vertical; line-height: 1.5; }
.input:focus-visible { box-shadow: var(--focus-ring); }
.input[readonly] { background: var(--surface-sunken); }
.input::placeholder { color: var(--text-muted); opacity: 1; }
.input-mono { font-family: var(--font-mono); font-size: var(--fs-sm); }

.has-error .input { border-color: var(--bad); border-width: 2px; }
.field-error {
  display: flex; align-items: flex-start; gap: var(--space-2);
  color: var(--bad); font-size: var(--fs-sm); font-weight: 600;
}

/* A checkbox row: the whole row is the target */
.check {
  display: flex; align-items: flex-start; gap: var(--space-3);
  min-height: var(--target); padding: var(--space-2) 0;
  cursor: pointer;
}
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--interactive); }
.check > span { display: flex; flex-direction: column; }

/* A field with a button beside it ("Sýna" on a password) */
.input-row { display: flex; gap: var(--space-2); }
.input-row .input { flex: 1; min-width: 0; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.copy-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.copy-row .input { flex: 1 1 280px; width: auto; }

/* --- Messages --- */
.alert {
  display: flex; align-items: flex-start; gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid; border-radius: var(--radius);
}
.alert-error { background: var(--bad-soft); border-color: var(--bad); }
.alert-error .icon { color: var(--bad); }
.alert-ok { background: var(--ok-soft); border-color: var(--ok); }
.alert-ok .icon { color: var(--ok); }

/* Status: a soft label with an icon and a word, never colour alone and never the accent */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px 2px 6px;
  border-radius: var(--radius);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.status .icon { width: 18px; height: 18px; }
.status-ok { background: var(--ok-soft); color: var(--ok); }
.status-warn { background: var(--warn-soft); color: var(--warn); }
.status-bad { background: var(--bad-soft); color: var(--bad); }
.status-neutral, .status-closed { background: var(--surface-sunken); color: var(--text-muted); }

.tag {
  display: inline-block; margin-left: var(--space-1); padding: 0 var(--space-2);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  color: var(--text-muted); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}

/* --- Tables --- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: var(--space-2) var(--space-3); text-align: left; vertical-align: middle; }
.table th { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.table td { border-top: 1px solid var(--border); }
.table tbody tr:first-child td { border-top: 0; }
.table th.num, .table td.num { text-align: right; }
.table .is-closed .person-name, .table .is-closed .row-link { color: var(--text-muted); }
.person-name { font-weight: 600; overflow-wrap: anywhere; }
.person-email { color: var(--text-muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.row-link { font-weight: 600; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-actions form { display: inline-block; }

/* On a phone each row becomes its own block */
@media (max-width: 640px) {
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-stack tr { display: block; padding: var(--space-2) 0; border-top: 1px solid var(--border); }
  .table-stack tbody tr:first-child { border-top: 0; }
  .table-stack td { display: block; padding: var(--space-1) var(--space-3); border: 0; text-align: left; }
  .table-stack td.num { text-align: left; }
  .table-stack td[data-label]::before { content: attr(data-label) ": "; color: var(--text-muted); }
  .table-stack .cell-actions { text-align: left; white-space: normal; padding-left: var(--space-1); }
}

/* --- Toasts: a done action, bottom right, in the second colour --- */
.toasts {
  position: fixed; right: var(--space-3); bottom: var(--space-3); z-index: 100;
  display: flex; flex-direction: column; gap: var(--space-2);
  max-width: min(480px, calc(100vw - 2 * var(--space-3)));
}
.toast {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3);
  background: var(--sidebar); color: var(--sidebar-text);
  border-radius: var(--radius); box-shadow: var(--shadow-toast);
}
.toast-text { flex: 1; padding: var(--space-2) 0; overflow-wrap: anywhere; }
.toast-action, .toast-close {
  min-width: var(--target); min-height: var(--target);
  padding: 0 var(--space-2);
  background: transparent; border: 0; border-radius: var(--radius);
  color: var(--sidebar-text); cursor: pointer;
}
.toast-action { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.toast-close { font-size: 1.4rem; line-height: 1; }
.toast-action:hover, .toast-close:hover { background: var(--sidebar-hover); }
.toast-action:focus-visible, .toast-close:focus-visible { box-shadow: 0 0 0 2px var(--sidebar), 0 0 0 4px var(--sidebar-text); }
.toast.is-leaving { opacity: 0; transition: opacity 0.3s; }

/* --- The home page: the tools as desks, each with a small drawing of what it makes --- */
.first-step { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-5); }
.first-step > * { margin-top: 0; }
.first-step > div { flex: 1 1 320px; }
.first-step > div > * + * { margin-top: var(--space-2); }

.hello h1 { font-size: var(--fs-2xl); }
.hello p { margin-top: var(--space-2); font-size: 1.1875rem; color: var(--text-muted); }

.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-3); }
.tile {
  grid-column: span 2; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border-radius: var(--radius-xl); box-shadow: 0 0 0 1px var(--border);
  color: inherit; text-decoration: none; transition: box-shadow .15s;
}
.tile-myndir, .tile-chat { grid-column: span 3; }
.tile:hover { box-shadow: 0 0 0 2px var(--interactive); color: inherit; }
.tile:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius-xl); }
.tile-desk { height: 150px; display: flex; align-items: flex-end; justify-content: center; padding-top: 22px; overflow: hidden; background: var(--surface-sunken); }
.tile-text { display: block; padding: var(--space-3) 18px 18px; }
.tile-name { display: block; font-family: var(--font-display); font-size: 1.3125rem; font-weight: 650; letter-spacing: -0.015em; color: var(--heading); line-height: 1.2; }
.tile-about { display: block; margin-top: var(--space-1); color: var(--text-muted); font-size: 0.9375rem; line-height: 1.45; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile, .tile-myndir, .tile-chat { grid-column: span 1; } .tile-chat { grid-column: 1 / -1; } }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr; } .tile-chat { grid-column: auto; } .tile-desk { height: 120px; } }

/* the drawings (decoration: hidden from screen readers) */
.mini-sheet { display: block; background: #fff; border-radius: 3px 3px 0 0; box-shadow: var(--shadow-sheet); }
.mini.mini-sheet { width: 150px; height: 128px; padding: 14px 14px 0; }
.mini b { display: block; height: 7px; width: 62%; border-radius: 2px; background: var(--sage); }
.mini i { display: block; height: 4px; margin-top: 7px; border-radius: 2px; background: #d9d1c6; }
.mini i.s { width: 60%; }
.mini-table { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 10px; border-top: 1px solid #e1d9ce; border-left: 1px solid #e1d9ce; }
.mini-table i { height: 13px; margin: 0; border-radius: 0; background: none; border-right: 1px solid #e1d9ce; border-bottom: 1px solid #e1d9ce; }
.mini-table i:nth-child(-n+3) { background: var(--sand-deep); }
.mini-efni { position: relative; width: 190px; height: 128px; }
.mini-efni .mini-sheet { position: absolute; bottom: 0; width: 110px; height: 118px; padding: 12px 12px 0; }
.mini-orig { left: 0; transform: rotate(-4deg); opacity: .8; }
.mini-orig i { height: 3px; margin-top: 5px; }
.mini-easy { right: 0; height: 124px !important; }
.mini-easy i.big { height: 7px; margin-top: 9px; background: #cfc5b8; }
.mini-q { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin: 12px 6px 0 0; border-radius: 50%; background: var(--sage-soft); color: var(--sage); font-size: 13px; font-weight: 700; }
.mini-rows { display: grid; grid-template-columns: 34px 1fr; gap: 5px 6px; align-items: center; margin-top: 11px; font-size: 9px; font-weight: 600; color: var(--sage); }
.mini-rows em { height: 9px; border-radius: 2px; background: var(--sand-deep); }
.mini-cards { display: flex; gap: 12px; align-items: flex-end; padding-bottom: 18px; }
.mini-card { width: 88px; height: 98px; display: flex; flex-direction: column; align-items: center; padding-top: 8px; background: #fff; border: 3px solid; border-radius: 12px; box-shadow: var(--shadow-sheet); }
.mini-card > span:first-child { padding: 1px 9px; border-radius: 99px; color: #fff; font-family: var(--font-display); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.mini-card.kk { border-color: #2f6fb3; transform: rotate(-5deg); } .mini-card.kk > span:first-child { background: #2f6fb3; }
.mini-card.kvk { border-color: #c0392b; } .mini-card.kvk > span:first-child { background: #c0392b; }
.mini-card.hk { border-color: #2e8540; transform: rotate(5deg); } .mini-card.hk > span:first-child { background: #2e8540; }
.mini-shape { display: block; margin-top: 12px; }
.mini-shape.table { position: relative; width: 46px; height: 26px; border-top: 7px solid #8a6a4a; }
.mini-shape.table::before, .mini-shape.table::after { content: ""; position: absolute; top: 0; width: 5px; height: 22px; background: #8a6a4a; }
.mini-shape.table::before { left: 4px; } .mini-shape.table::after { right: 4px; }
.mini-shape.spoon { width: 14px; height: 44px; border-radius: 7px 7px 3px 3px; background: linear-gradient(#9aa3a8 0 34%, #b8bfc3 34%); }
.mini-shape.glass { width: 30px; height: 42px; background: linear-gradient(transparent 0 30%, #8ec3e6 30%); clip-path: polygon(0 0, 100% 0, 86% 100%, 14% 100%); }
.mini-chat { width: 300px; max-width: 90%; display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; }
.mini-chat p { margin: 0; }
.mini-u { align-self: flex-end; max-width: 80%; padding: 7px 12px; background: #fff; border-radius: 14px 14px 3px 14px; font-size: 12.5px; box-shadow: var(--shadow-sheet); }
.mini-a { width: 82%; padding: 10px 12px; background: #fff; border-radius: 14px 14px 14px 3px; box-shadow: var(--shadow-sheet); }
.mini-a b { width: 45%; height: 6px; }

.recent h2 { font-size: 1.375rem; }
.recent ul { margin-top: var(--space-2); border-top: 1px solid var(--border); }
.recent li a {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(0, 12rem) 9rem; align-items: center; gap: var(--space-3);
  min-height: 56px; padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--border); color: inherit; text-decoration: none;
}
.recent li a:hover { background: var(--surface-sunken); }
.recent-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius); background: var(--surface-sunken); }
.recent-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius); background: var(--sage-soft); color: var(--sage); }
.recent-icon .icon { width: 20px; height: 20px; }
.recent-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-what, .recent-when { color: var(--text-muted); font-size: 0.9375rem; }
.recent-when { text-align: right; }
.recent-empty { margin-top: var(--space-2); }
@media (max-width: 640px) {
  .recent li a { grid-template-columns: 40px minmax(0, 1fr); row-gap: 0; }
  .recent-what { display: none; }
  .recent-when { grid-column: 2; text-align: left; font-size: var(--fs-sm); }
}

/* --- Sign-in and error pages: one card on the second colour --- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: var(--space-3); background: var(--sidebar); }
.login-card {
  width: min(460px, 100%);
  padding: var(--space-6) var(--space-5);
  background: var(--surface); border-radius: var(--radius-lg);
}
.login-card > * + * { margin-top: var(--space-3); }
.login-card > .btn, .login-card > .alert { margin-top: var(--space-4); }
.login-title { font-size: var(--fs-lg); }
.login-card > .stack { margin-top: var(--space-4); }
.login-other { padding-top: var(--space-3); border-top: 1px solid var(--border); }
.login-card .hint a { display: inline-flex; align-items: center; min-height: var(--target); }

/* --- Small form parts --- */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); }
.optional { color: var(--text-muted); font-weight: 400; }
select.input { appearance: auto; }
.card h4 { margin: 0; font-size: var(--fs-md); color: var(--heading); }
.empty > * + * { margin-top: var(--space-2); }
.count {
  display: inline-block; min-width: 1.6em; margin-left: var(--space-1); padding: 0 6px;
  background: var(--surface-sunken); border-radius: var(--radius);
  color: var(--text-muted); font-size: var(--fs-xs); font-weight: 600; text-align: center;
}

/* --- Tabs: which list is shown. The selected one carries the accent as a thick bar --- */
.tabs { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); border-bottom: 1px solid var(--border-strong); }
.tab {
  display: inline-flex; align-items: center; min-height: var(--target);
  padding: var(--space-2) var(--space-1);
  border-bottom: 4px solid transparent; margin-bottom: -1px;
  color: var(--text-muted); font-weight: 600; text-decoration: none;
}
.tab:hover { color: var(--interactive-hover); border-bottom-color: var(--border-strong); }
.tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* --- The skills register (Kunnátta) --- */
.skill-subject > h4 { margin-top: var(--space-4); color: var(--text-muted); font-size: var(--fs-sm); }
.skill-list > li {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3);
  padding: var(--space-1) 0; border-top: 1px solid var(--border);
}
.skill-list > li:first-child { border-top: 0; }
.skill-text { flex: 1 1 320px; overflow-wrap: anywhere; }
.skill-list .is-closed .skill-text { color: var(--text-muted); text-decoration: line-through; }

/* --- Einstaklingsnámskrá --- */
/* The three steps as one track: a numbered dot per step joined by a line. The step you are on is
   the accent (and aria-current for those who cannot see it); the line up to it is drawn in green. */
.steps { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) 0; }
.steps > li { display: flex; align-items: center; }
.steps > li + li::before { content: ""; width: 40px; height: 2px; margin: 0 var(--space-1); background: var(--border-strong); border-radius: 2px; }
.steps > li:has(~ li > .step[aria-current="step"]) + li::before,
.steps > li:has(> .step[aria-current="step"])::before { background: var(--interactive); }
.step {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: var(--target); padding: 0 var(--space-2) 0 0;
  background: none; border: 0; border-radius: 999px;
  font: inherit; font-weight: 600; color: var(--text-muted); cursor: pointer;
}
.step:hover { color: var(--heading); }
.step:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.step-n {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 2px solid var(--border-strong); border-radius: 50%; background: var(--surface);
  font-family: var(--font-display); font-weight: 700; color: var(--text-muted);
}
.steps > li:has(~ li > .step[aria-current="step"]) .step { color: var(--heading); }
.steps > li:has(~ li > .step[aria-current="step"]) .step-n { border-color: var(--interactive); background: var(--interactive); color: #fff; }
.step[aria-current="step"] { color: var(--heading); }
.step[aria-current="step"] .step-n { border-color: var(--accent-edge); background: var(--accent); color: var(--on-accent); }

.namskra > div > * + * { margin-top: var(--space-4); }
.step-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }
.start-over { text-align: right; }
.view-as .field { max-width: 640px; }

/* What the teacher fills in sits on the calm panel, as in the other tools */
.iep-panel.card, .view-as.card { background: var(--surface-sunken); border: 0; border-radius: var(--radius-xl); }
.iep-panel h2 { font-size: var(--fs-lg); }

/* "Bæta orðalag" lives inside its text box, bottom right, so the box keeps the whole width */
.namskra .input-tool { position: relative; display: block; }
.namskra .input-tool > textarea.input { padding-bottom: 42px; }
.namskra .btn-tool {
  position: absolute; right: 22px; bottom: 8px; width: auto; min-height: 30px; padding: 0 12px;
  border-radius: 999px; background: var(--surface-sunken); border-color: transparent;
}
.namskra .btn-tool:hover { background: var(--sage-soft); }
@media (pointer: coarse) { .namskra .btn-tool { min-height: var(--target); } .namskra .input-tool > textarea.input { padding-bottom: 56px; } }

/* One subject: a white card on the ground, its name large */
.subject {
  padding: var(--space-4); background: var(--surface);
  border-radius: var(--radius-xl); box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgba(42, 33, 27, .05);
}
.subject + .subject, [data-subjects] > .subject:not([hidden]) ~ .subject { margin-top: var(--space-3); }
@media (max-width: 860px) { .subject { padding: var(--space-3); } }
.own-goals .input-row .btn-text { flex: none; }

/* Yfirlit: the plan as the sheet of paper it becomes */
.iep-out > * + * { margin-top: var(--space-3); }
.iep-out h2 { font-size: var(--fs-lg); }
.iep-sheet {
  max-width: 800px; padding: 52px 60px 60px;
  background: var(--surface); border-radius: 3px; box-shadow: var(--shadow-sheet);
}
@media (max-width: 860px) { .iep-sheet { padding: var(--space-4) 20px; } }
.iep-sheet-title { font-size: 1.875rem; font-weight: 700; line-height: 1.15; }
.iep-sheet-name { margin-top: var(--space-2); display: flex; align-items: baseline; gap: var(--space-2); color: var(--text-muted); }
.iep-sheet-name > span { flex: 0 1 18rem; border-bottom: 1px solid var(--border-strong); }
.iep-sheet .summary { margin-top: var(--space-5); }
/* Step 3 keeps to the sheet's width, its buttons under the sheet */
[data-step="3"] > * { max-width: 800px; }

/* Choices as buttons. The real radio or checkbox stays in the label (keyboard and screen readers
   use it) but is not drawn: one choice of several is a switch, the chosen part raised in white;
   any-of-several are pills that carry a check mark when on. */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--target); padding: var(--space-1) var(--space-3);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px;
  font-weight: 500; color: var(--text); cursor: pointer; overflow-wrap: anywhere;
  transition: background-color .12s, border-color .12s;
}
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.chip:hover { background: var(--interactive-soft); }
.chip:has(input:focus-visible) { box-shadow: var(--focus-ring); }
/* any of several: a check mark when on */
.chip:has(input[type="checkbox"]:checked) { background: var(--sage-soft); border-color: var(--interactive); color: var(--heading); font-weight: 600; }
.chip:has(input[type="checkbox"]:checked)::before {
  content: ""; width: 9px; height: 5px; margin: -3px 0 0 -2px; flex: none;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
}
/* one of several: a switch */
.chips:has(> .chip > input[type="radio"]) {
  display: inline-flex; gap: 2px; padding: 3px; background: #e7dfd3; border-radius: 10px;
}
.chip:has(> input[type="radio"]) { border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); padding: var(--space-1) 14px; }
.chip:has(> input[type="radio"]):hover { background: rgba(255, 255, 255, .55); color: var(--text); }
.chip:has(> input[type="radio"]:checked) { background: var(--surface); color: var(--heading); font-weight: 650; box-shadow: 0 1px 2px rgba(42, 33, 27, .16); }

.subject > * + * { margin-top: var(--space-3); }
.subject > h4 { margin-top: var(--space-4); margin-bottom: calc(-1 * var(--space-1)); }
.subject > input[type="hidden"] + *, .subject > input[type="hidden"] + input[type="hidden"] + * { margin-top: 0; }
.subject .section-head { margin-bottom: 0; }
.subject h3 { font-size: 1.5rem; font-weight: 700; }
/* Each category is a curtain: closed, its name and how many are ticked; the curtains sit in one bordered list */
.skill-groups { border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.skill-groups > * + * { border-top: 1px solid var(--border); }
.skill-groups > .tick-list { padding: var(--space-1) var(--space-3); }
.skill-group > summary {
  display: flex; align-items: center; gap: var(--space-2);
  min-height: var(--target); padding: 0 var(--space-3);
  font-weight: 600; cursor: pointer; overflow-wrap: anywhere; list-style: none;
}
.skill-group > summary::-webkit-details-marker { display: none; }
.skill-group > summary::before {
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 4px 0 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.12s;
}
.skill-group[open] > summary::before { transform: rotate(45deg); }
.skill-group > summary:hover { background: var(--interactive-soft); }
.group-count { margin-left: auto; color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.skill-group > .tick-list { padding: 0 var(--space-3) var(--space-2) 36px; }
.tick-list .check { padding: var(--space-1) 0; gap: var(--space-2); }
/* With a mouse the rows sit close; a finger keeps the full 44 px */
@media (pointer: fine) {
  .tick-list .check { min-height: 0; padding: 2px 0; }
  .skill-group > summary { min-height: 36px; }
}
.tick-list .check span { overflow-wrap: anywhere; }
.own-goals > * + * { margin-top: var(--space-2); }
.own-goals:empty { display: none; }

.review > * + * { margin-top: var(--space-3); }
.review-out {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-sunken); border-left: 4px solid var(--interactive); border-radius: var(--radius);
  min-height: 96px;                 /* the answer's place is there before the answer */
}
.review-out > * + * { margin-top: var(--space-2); }
.review-out h4 { margin-top: var(--space-3); }
.review-out h4:first-child { margin-top: 0; }
.review-out ul { padding-left: 1.25em; list-style: disc; }
.review-out li + li { margin-top: var(--space-1); }

.summary-part + .summary-part { margin-top: var(--space-5); }
.summary-part > * + * { margin-top: var(--space-2); }
.summary-part h3 { padding-bottom: var(--space-1); border-bottom: 2px solid var(--interactive); font-size: 1.1875rem; font-weight: 650; }
.summary-part h4 { margin-top: var(--space-3); font-family: var(--font); font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.summary-part h3 + h4 { margin-top: var(--space-2); }
.summary-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.summary-goals { padding-left: 1.25em; list-style: disc; }
.summary-note { white-space: normal; }
.status-mark { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 2px solid currentColor; border-radius: 50%; font-size: 12px; line-height: 1; flex: none; }


/* A dialog only for what cannot be undone */
.dialog {
  width: min(520px, calc(100vw - 2 * var(--space-3)));
  padding: var(--space-5);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
}
.dialog::backdrop { background: rgba(42, 33, 27, 0.5); }
.dialog > * + * { margin-top: var(--space-3); }

/* On a phone the three steps share one row, the line shorter */
@media (max-width: 640px) {
  .steps { flex-wrap: nowrap; }
  .steps > li + li::before { width: 16px; margin: 0 6px; flex: none; }
  .step { gap: 6px; padding: 0; font-size: var(--fs-sm); }
  .step-n { width: 26px; height: 26px; font-size: var(--fs-sm); }
}

/* --- Shared by the assistant, the document tools and Myndir: a label and its row of choices --- */
.frame-row { display: flex; align-items: center; gap: var(--space-2); }
.frame-label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.frame-row .chips { flex: 1; min-width: 0; }
.frame-row .chips:has(> .chip > input[type="radio"]) { flex: 0 1 auto; }
.chips-sm { gap: var(--space-1); }
.chips-sm .chip { min-height: 36px; padding: 2px 12px; font-size: 0.9375rem; }
@media (pointer: coarse) { .chips-sm .chip { min-height: var(--target); } }
.btn-sm { font-size: var(--fs-sm); min-height: 36px; }
@media (pointer: coarse) { .btn-sm { min-height: var(--target); } }

/* --- Aðstoðarmaður: a chat window ---
   Wide screens: the window fills the screen's height, the conversation scrolls inside it and the
   message box stays at its foot. Phones: the page scrolls and the message box sticks to the bottom. */
.main-inner:has(> .assistant) { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.assistant {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
@media (min-width: 861px) {
  .assistant { height: calc(100dvh - 2 * var(--space-3)); min-height: 480px; }
  .main-inner:has(> .alert) > .assistant { height: calc(100dvh - 2 * var(--space-3) - 72px); }
}

.chat-top {
  flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border);
}
.chat-title { font-size: var(--fs-lg); margin: 0; }
.chat-new { order: 2; margin-left: auto; }
.chat-top > .frame { order: 3; flex-basis: 100%; }
.skill-pick { border: 0; padding: 0; margin: 0; min-width: 0; }

/* The skills as one segmented control: the chosen one is filled */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-sunken); border-radius: var(--radius-lg); }
.seg-item { position: relative; display: inline-flex; }
.seg-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-item span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-3);
  border-radius: var(--radius); font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); cursor: pointer; white-space: nowrap;
}
.seg-item:hover span { color: var(--text); }
.seg-item input:checked + span { background: var(--surface); color: var(--heading); box-shadow: 0 1px 2px rgba(42, 33, 27, 0.14), inset 0 0 0 1px var(--border-strong); }
.seg-item input:focus-visible + span { box-shadow: var(--focus-ring); }
@media (pointer: coarse) { .seg-item span { min-height: var(--target); } }

.frame { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
.frame[hidden] { display: none; }

/* The conversation */
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.chat { max-width: 760px; margin: 0 auto; padding: var(--space-4) var(--space-3); }
.chat > * + * { margin-top: var(--space-4); }
.assistant.is-empty .chat { min-height: 100%; display: flex; flex-direction: column; justify-content: center; }

.chat-empty { text-align: center; padding: var(--space-4) 0; }
.chat-empty > * + * { margin-top: var(--space-2); }
.chat-empty-title { font-size: var(--fs-lg); font-weight: 700; color: var(--heading); }
.chat-empty-text { max-width: 56ch; margin-left: auto; margin-right: auto; color: var(--text-muted); }
.chat-starters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-2); margin-top: var(--space-4) !important; text-align: left; }
.chat-starter {
  min-height: var(--target); padding: var(--space-2) var(--space-3); font: inherit; font-size: var(--fs-sm); color: var(--text); text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
}
.chat-starter:hover { background: var(--interactive-soft); border-color: var(--interactive); }
.chat-starter:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.chat-cleared { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; }

.msg-user { display: flex; flex-direction: column; align-items: flex-end; }
.msg-meta { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; margin-bottom: var(--space-1); }
.msg-bubble {
  max-width: min(85%, 60ch); padding: var(--space-2) 14px;
  background: var(--surface-sunken); border-radius: 18px 18px 4px 18px; overflow-wrap: anywhere;
}
.msg-bubble > p + p { margin-top: var(--space-1); }
.msg-bubble > p:empty { min-height: 1em; }

.msg-ai { display: flex; align-items: flex-start; gap: var(--space-3); }
.msg-avatar {
  flex: none; width: 28px; height: 28px; margin-top: 2px; border-radius: 50%; background: var(--sage);
  display: flex; align-items: center; justify-content: center;
}
.msg-avatar::after { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.msg-main { flex: 1; min-width: 0; }
.msg-body > * + * { margin-top: var(--space-2); }
.msg-body h4 { margin-top: var(--space-3); font-size: var(--fs-md); }
.msg-body h4:first-child { margin-top: 0; }
.msg-body ul { padding-left: 1.25em; list-style: disc; }
.msg-body ol { padding-left: 1.5em; list-style: decimal; }
.msg-body li + li { margin-top: var(--space-1); }
.msg-body hr { border: 0; border-top: 1px solid var(--border); }
.msg-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: var(--space-1) 0 0 calc(-1 * var(--space-3)); }
.msg-actions .btn { color: var(--text-muted); }
.msg-actions .btn:hover { color: var(--interactive); }

.typing { display: inline-flex; gap: 5px; padding: var(--space-2) 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); animation: typing 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing span { animation: none; opacity: .6; } }

/* The message box */
.composer { flex: none; padding: var(--space-2) var(--space-3) var(--space-3); background: var(--surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.composer > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.composer > * + * { margin-top: var(--space-1); }
.composer-box {
  display: flex; align-items: flex-end; gap: var(--space-2); padding: 6px 6px 6px 14px;
  background: var(--field); border: 1px solid var(--field-border); border-radius: 22px;
}
.composer-box:focus-within { border-color: var(--interactive); box-shadow: 0 0 0 1px var(--interactive); }
.composer-box:has([aria-invalid="true"]) { border-color: var(--bad); }
.composer-input {
  flex: 1; min-width: 0; min-height: 32px; max-height: 220px; padding: 6px 0; resize: none; overflow-y: auto;
  border: 0; outline: none; background: transparent; font: inherit; color: var(--text); line-height: 1.45;
}
.composer-input:focus, .composer-input:focus-visible { outline: none; box-shadow: none; }
.composer-input::placeholder { color: var(--text-muted); opacity: 1; }
.composer-send {
  flex: none; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--accent-edge); border-radius: 50%; background: var(--accent); color: var(--on-accent); cursor: pointer;
}
.composer-send:hover { background: var(--accent-hover); }
.composer-send:active { background: var(--accent-pressed); }
.composer-send:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.composer-send:disabled { opacity: .45; cursor: not-allowed; }
.composer-send .icon { width: 20px; height: 20px; stroke-width: 2.4; }
.composer-send.is-loading { cursor: progress; opacity: .85; }
.composer-send.is-loading .icon { display: none; }
.composer-send.is-loading::before {
  content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
}
@media (pointer: coarse) { .composer-send { width: var(--target); height: var(--target); } .composer-keys { display: none; } }
.composer-foot { font-size: var(--fs-xs); color: var(--text-muted); text-align: center; }

@media (max-width: 860px) {
  .assistant { border-radius: var(--radius-lg); }
  .chat-scroll { overflow: visible; }
  .composer { position: sticky; bottom: 0; z-index: 2; border-top: 1px solid var(--border); }
  .chat { padding: var(--space-3) var(--space-2); }
  .chat-top { padding: var(--space-2); }
  .chat-title { display: none; }
  .seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .seg-item span { justify-content: center; width: 100%; padding: 0 var(--space-1); }
  .skill-pick { flex: 1 1 100%; }
  .chat-new { min-height: 36px; padding: 0 var(--space-2); border-color: transparent; }
  .assistant .frame-row { flex-wrap: wrap; gap: var(--space-1); }
  .msg-ai { gap: var(--space-2); }
  .msg-avatar { width: 24px; height: 24px; }
  .chat-starters { grid-template-columns: 1fr; }
}

/* --- The document tools (Aðlögun, Allir með, Skipulag kennslu) --- */
.tool-switch { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); }
.tool-switch a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--space-3);
  color: var(--text-muted); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tool-switch a:hover { color: var(--text); }
.tool-switch a[aria-current="page"] { color: var(--heading); border-bottom-color: var(--interactive); }

/* Settings that make something (the document tools, Myndir) sit on a calm panel, not in a box */
.doc-setup.card, .image-form.card, .schedule-setup.card { background: var(--surface-sunken); border: 0; border-radius: var(--radius-xl); }
.doc-setup > * + * { margin-top: var(--space-3); }
.doc-setup .frame-row { flex-wrap: wrap; }
.label-text { font-weight: 600; }
/* A drop area for a file: the real input lies over it, unseen, so a click or a drop both land in it */
.drop {
  position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1) 12px;
  min-height: 64px; padding: var(--space-2) 18px;
  background: rgba(255, 255, 255, .6); border: 1.5px dashed var(--field-border); border-radius: 10px;
  transition: background-color .12s, border-color .12s;
}
.drop > .icon { width: 26px; height: 26px; flex: none; color: var(--interactive); }
.drop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop:hover, .drop.is-over { background: var(--surface); border-color: var(--interactive); }
.drop:has(.drop-input:focus-visible) { box-shadow: var(--focus-ring); }
.drop-strong { font-weight: 600; }
.drop-link { color: var(--interactive); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.drop.has-file { border-style: solid; background: var(--surface); }
.drop-chosen { font-weight: 600; overflow-wrap: anywhere; }
.drop-clear { position: relative; z-index: 1; margin-left: auto; }
.more-settings { border-top: 1px solid var(--border); padding-top: var(--space-2); }
.more-settings > summary {
  display: flex; align-items: center; gap: var(--space-2); min-height: 36px; cursor: pointer; list-style: none;
  font-weight: 600; color: var(--heading);
}
.more-settings > summary::-webkit-details-marker { display: none; }
.more-settings > summary::before {
  content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s;
}
.more-settings[open] > summary::before { transform: rotate(45deg); }
.more-body { padding: var(--space-2) 0 0 var(--space-4); }

/* Skipulag kennslu's saved plans: one compact row each, the open one marked with the accent */
.doc-saved { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.doc-saved > summary {
  display: flex; align-items: center; gap: var(--space-2); min-height: var(--target); cursor: pointer; list-style: none; color: var(--heading);
}
.doc-saved > summary::-webkit-details-marker { display: none; }
.doc-saved > summary::before {
  content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s;
}
.doc-saved[open] > summary::before { transform: rotate(45deg); }
.saved-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.saved-list > li { display: flex; align-items: center; gap: var(--space-2); border-top: 1px solid var(--border); }
.saved-open {
  flex: 1; min-width: 0; min-height: var(--target); display: flex; align-items: baseline; gap: var(--space-2);
  padding: var(--space-1) var(--space-2); border: 0; border-left: 4px solid transparent; background: none;
  font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.saved-open:hover { background: var(--interactive-soft); }
.saved-open:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.saved-open[aria-current="true"] { border-left-color: var(--accent); font-weight: 600; }
.saved-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-when { flex: none; font-size: var(--fs-sm); font-weight: 400; }
.saved-undo { padding: var(--space-1) var(--space-2); }
.more-body > * + * { margin-top: var(--space-3); }
.setup-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.tick-cat { margin-top: var(--space-2); font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.tick-cat:first-child { margin-top: 0; }

/* The settings, the sheet and the change box. Narrow: one column, the change box under the sheet.
   Wide, once there is a sheet: settings left with the change box pinned at their foot, the sheet
   right; each side scrolls on its own and together they fill the window (as Viskubrunnur's
   Spjall með færni, Bergmann 2 Dec 2026). */
.doc-split { display: flex; flex-direction: column; gap: var(--space-4); scroll-margin-top: var(--space-4); }
.doc-side { display: contents; }
.doc-split .doc-setup { order: 1; }
.doc-split .doc-out { order: 2; }
.doc-split .doc-adjust { order: 3; }
@media (min-width: 1200px) {
  .main-inner:has(.doc-out:not([hidden])) { max-width: 1680px; }
  .doc-split:has(> .doc-out:not([hidden])) {
    display: grid; grid-template-columns: minmax(380px, 5fr) minmax(0, 7fr); gap: var(--space-4);
    height: calc(100dvh - 2 * var(--space-4)); min-height: 560px;
  }
  .doc-split:has(> .doc-out:not([hidden])) > .doc-side { display: flex; flex-direction: column; gap: var(--space-3); min-height: 0; }
  .doc-split:has(> .doc-out:not([hidden])) .doc-setup { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
  .doc-split:has(> .doc-out:not([hidden])) .doc-adjust { flex: none; max-width: none; margin: auto 0 0; box-shadow: 0 -1px 0 var(--border); }
  .doc-split:has(> .doc-out:not([hidden])) .doc-out { min-height: 0; overflow-y: auto; padding: 0 6px 6px; scrollbar-gutter: stable; }
  .doc-split:has(> .doc-out:not([hidden])) .doc-out > * + * { margin-top: var(--space-3); }
  .doc-split .doc-bar { position: sticky; top: 0; z-index: 1; padding-bottom: var(--space-2); background: var(--ground); }
  .doc-split .doc-body { padding: 44px 48px 52px; }
}

/* What the tool wrote: the bar, then the document itself as a sheet of paper */
.doc-out.card { padding: 0; background: none; border: 0; border-radius: 0; }
.doc-out > * + * { margin-top: var(--space-3); }
.doc-bar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
.doc-bar h2 { font-size: var(--fs-lg); margin-right: auto; }
.doc-versions { display: flex; align-items: center; gap: var(--space-1); font-size: var(--fs-sm); }
.doc-actions { display: flex; gap: var(--space-1); }
.doc-tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); width: 100%; order: 5; }
.doc-tab {
  min-height: 36px; padding: 0 var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
}
.doc-tab:hover { background: var(--interactive-soft); }
.doc-tab[aria-selected="true"] { background: var(--interactive-soft); border-color: var(--interactive); box-shadow: inset 0 0 0 1px var(--interactive); }
.doc-note { max-width: 70ch; padding-left: 14px; border-left: 3px solid var(--interactive); color: var(--text-muted); font-size: 0.9375rem; }
.doc-stale { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-1) var(--space-3); background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); font-size: var(--fs-sm); font-weight: 600; }
.doc-stale svg { width: 18px; height: 18px; flex: none; }

.doc-body {
  max-width: 800px; margin-left: auto; margin-right: auto; padding: 52px 60px 60px;
  background: var(--surface); border-radius: 3px; box-shadow: var(--shadow-sheet);
}
.doc-body:empty { min-height: 320px; }
@media (max-width: 860px) { .doc-body { padding: var(--space-4) 20px; } }
.doc-body > * + * { margin-top: var(--space-2); }
.doc-body h3 { font-size: 1.875rem; font-weight: 700; line-height: 1.15; margin-bottom: var(--space-1); }
.doc-body h4 { margin-top: var(--space-5); font-size: 1.1875rem; font-weight: 650; }
.doc-body h3 + h4, .doc-body h3 + p + h4 { margin-top: var(--space-3); }
.doc-body ul { padding-left: 1.25em; list-style: disc; }
.doc-body ol { padding-left: 1.5em; list-style: decimal; }
.doc-body li + li { margin-top: var(--space-1); }
.doc-body em { color: var(--text-muted); }
.doc-body hr { border: 0; border-top: 1px dashed var(--border-strong); }
.doc-body .table-wrap, .msg-body .table-wrap { overflow-x: auto; background: none; border: 0; border-radius: 0; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.doc-table th, .doc-table td { padding: var(--space-2) 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.doc-table th { font-family: var(--font-display); font-weight: 650; color: var(--heading); border-bottom: 2px solid var(--interactive); }
.doc-table td:first-child { font-weight: 600; color: var(--heading); }
.doc-table td:first-child { white-space: nowrap; }
.doc-table tr.grp td { padding-top: var(--space-3); background: none; color: var(--heading); font-family: var(--font-display); font-weight: 650; white-space: normal; border-bottom-color: var(--border-strong); }

.pieces { max-width: 800px; margin-left: auto; margin-right: auto; padding-top: var(--space-2); }
.pieces > * + * { margin-top: var(--space-2); }
.pieces .btn svg { width: 16px; height: 16px; }
.pieces-more > summary { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 36px; cursor: pointer; list-style: none; font-weight: 600; color: var(--heading); }
.pieces-more > summary::-webkit-details-marker { display: none; }
.pieces-more > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.pieces-more[open] > summary::before { transform: rotate(45deg); }
.pieces-more > .chips { margin-top: var(--space-2); }
.pieces [data-pieces-main]:empty { display: none; }
.doc-adjust { max-width: 800px; margin-left: auto; margin-right: auto; padding: var(--space-3); background: var(--surface-sunken); border-radius: var(--radius-xl); }
.doc-adjust > * + * { margin-top: var(--space-2); }
.quick .btn, .pieces .btn { min-height: 36px; padding: 0 14px; border-color: var(--border-strong); border-radius: 999px; font-weight: 500; font-size: 0.9375rem; color: var(--text); }
.quick .btn:hover, .pieces .btn:hover { border-color: var(--interactive); color: var(--heading); }
@media (max-width: 640px) {
  .doc-bar h2 { width: 100%; }
  .doc-table td:first-child { white-space: normal; }
}

/* --- Myndir --- */
/* Two rows of four, so every name and its note fit on a line each (Bergmann, 1 Dec 2026) */
.mode-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-1); }
@media (max-width: 560px) { .mode-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mode-tab {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: var(--target);
  padding: var(--space-1) var(--space-2); text-align: left; cursor: pointer; font: inherit;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.mode-tab:hover { background: var(--interactive-soft); }
.mode-tab[aria-selected="true"] { background: var(--interactive-soft); border-color: var(--interactive); box-shadow: inset 0 0 0 1px var(--interactive); }
.mode-tab:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.mode-name, .mode-sub { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-name { font-weight: 700; font-size: var(--fs-sm); color: var(--heading); }
.mode-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.mode-pane > * + * { margin-top: var(--space-3); }
.image-form .frame-row { flex-wrap: wrap; }
.image-form .input-tool > .input { min-height: var(--target); }

.gallery-head h2 { font-size: var(--fs-lg); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--space-3); }
.pic { display: flex; flex-direction: column; gap: var(--space-1); }
.pic-open { display: block; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: zoom-in; overflow: hidden; }
.pic-open img { display: block; width: 100%; height: auto; }
.pic-open:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.pic-caption { font-size: var(--fs-sm); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pic-actions { display: flex; gap: var(--space-1); margin-left: calc(-1 * var(--space-2)); }
.pic.is-deleted .pic-open, .pic.is-deleted .pic-caption, .pic.is-deleted .pic-actions { display: none; }
.pic-undo { font-size: var(--fs-sm); padding: var(--space-2); background: var(--surface-sunken); border-radius: var(--radius); }
.pic-wait {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1; padding: var(--space-2);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-sunken);
  font-size: var(--fs-sm); color: var(--text-muted); text-align: center;
}
.lightbox { max-width: min(92vw, 1100px); }
.lightbox img { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto; }
.lightbox-caption { margin-top: var(--space-2); font-size: var(--fs-sm); color: var(--text-muted); }

/* Stundaskrá: the editor */
.steps-edit { display: flex; flex-direction: column; gap: var(--space-1); counter-reset: step; }
.steps-head { display: grid; grid-template-columns: 2.2em 6.5em 1fr 52px auto; gap: var(--space-2); font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }
.steps-head span:first-child { grid-column: 2; }
.step-row { display: grid; grid-template-columns: 2.2em 6.5em 1fr 52px auto; align-items: center; gap: var(--space-1) var(--space-2); }
.step-row::before { counter-increment: step; content: counter(step) "."; color: var(--text-muted); font-size: var(--fs-sm); text-align: right; }
.step-time, .step-text { min-height: 40px; }
.step-pic {
  width: 52px; height: 52px; padding: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
  border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--surface-sunken); cursor: pointer;
  font: inherit; font-size: var(--fs-xs); color: var(--text-muted);
}
.step-pic img { width: 100%; height: 100%; object-fit: cover; }
.step-tools { display: flex; }
.step-tools .btn { min-width: 36px; padding: 0 var(--space-1); }
.step-panel { grid-column: 2 / -1; padding: var(--space-2); background: var(--surface-sunken); border-radius: var(--radius); }
.step-panel > * + * { margin-top: var(--space-2); }
.step-matches { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.step-match { width: 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--surface); }
.step-match img { width: 100%; height: 100%; object-fit: cover; }
.step-match.is-on { border-color: var(--interactive); }
@media (max-width: 640px) {
  .step-row { grid-template-columns: 1.6em 5em 1fr 44px; }
  .steps-head { display: none; }
  .step-tools { grid-column: 2 / -1; justify-content: flex-end; }
}

/* Stundaskrá: the sheet, the same layout on screen and on paper (sizes in cqw of the sheet) */
.sheets { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.sheet { width: min(100%, 420px); aspect-ratio: 196 / 282; container-type: inline-size; background: #fff; border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(42, 33, 27, .08); padding: 4cqw; position: relative; }
.sheet-side { position: absolute; bottom: 1.5cqw; right: 3cqw; font-size: 2.6cqw; color: #9A948A; }
.strip { margin: 0 auto; width: fit-content; padding: 2.5cqw 3cqw; border: .4cqw dashed #9A948A; border-radius: 2cqw; display: flex; flex-direction: column; gap: 1.6cqw; color: #1A1815; font-family: var(--font); }
.strip-title { text-align: center; font-size: 5cqw; font-weight: 800; color: #1A1815; margin: 0 0 .5cqw; }
.strip-row { display: flex; align-items: center; gap: 2.5cqw; }
.strip-row.is-pad { visibility: hidden; }
.strip-time { width: 14cqw; text-align: right; font-weight: 800; font-size: 3.4cqw; }
.strip-card { width: 28cqw; border: .6cqw solid #1A1815; border-radius: 2.4cqw; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.strip-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.strip-missing { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 2cqw; text-align: center; font-size: 2.8cqw; color: #9A948A; background: repeating-linear-gradient(45deg, #f4f1ec 0 1.2cqw, #fff 1.2cqw 2.4cqw); }
.strip-label { border-top: .5cqw solid #1A1815; padding: .8cqw 1cqw; text-align: center; font-weight: 800; font-size: 3.4cqw; line-height: 1.15; overflow-wrap: normal; word-break: keep-all; }
.strip-done { width: 10cqw; height: 10cqw; border: .5cqw solid #1A1815; border-radius: 1.4cqw; display: flex; align-items: flex-end; justify-content: center; padding-bottom: .6cqw; font-size: 2.2cqw; font-weight: 700; }

@media print {
  html.printing-schedule body * { visibility: hidden; }
  html.printing-schedule [data-sheets], html.printing-schedule [data-sheets] * { visibility: visible; }
  html.printing-schedule [data-sheets] { position: absolute; left: 0; top: 0; width: 100%; display: block; }
  html.printing-schedule .sheet { width: 196mm; height: 281mm; aspect-ratio: auto; border: 0; box-shadow: none; padding: 6mm; break-after: page; }
  html.printing-schedule .sheet:last-child { break-after: auto; }
  html.printing-schedule .sheet-side { display: none; }
  @page { size: A4 portrait; margin: 7mm; }
}
