@font-face {
  font-family: 'Nunito';
  src: url(../fonts/Nunito-latin.woff2) format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --ink: #111111;
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #111111;
  --muted: #6b6b6b;
  --border: #e3e3e3;
  --accent: #d7263d;
  --accent-dark: #b81d31;
  --due: #8a5a00;
  --due-bg: #fdf3dc;
  --due-mark: #e0a526;
  --overdue: #c4202f;
  --overdue-bg: #fdeaec;
  --done: #1f7a5c;
  --done-bg: #e3f4ec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --radius-pill: 999px;
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3 { font-weight: 700; }

h2.page-title, .section-title { font-family: var(--font-serif); }

header.site {
  position: sticky;
  top: 12px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 12px auto 0;
  padding: 10px 14px 10px 20px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  white-space: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  height: 40px;
  width: auto;
  margin-right: 10px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  margin: 8px 0 24px;
}

.hero .clock-wrap {
  flex: 0 1 300px;
  margin: 0;
}

.kalle {
  flex: 0 1 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.kalle[hidden] { display: none; }

.kalle-img {
  width: 180px;
  max-width: 100%;
  height: auto;
  mix-blend-mode: multiply;
}

@media (prefers-reduced-motion: no-preference) {
  .kalle-bubble { animation: pop 0.25s ease-out; }
}

@keyframes pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.kalle-bubble {
  position: relative;
  padding: 14px 18px;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.kalle-bubble::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 16px;
  height: 16px;
  background: inherit;
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  transform: translateX(-50%) rotate(45deg);
}

.kalle-concerned .kalle-bubble,
.kalle-exhausted .kalle-bubble { background: var(--due-bg); }
.kalle-sad .kalle-bubble { background: var(--overdue-bg); }

header.site nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

header.site nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  transition: color 0.12s, background 0.12s;
}

header.site nav a:hover { color: var(--ink); background: var(--bg); }

header.site nav a.active {
  color: var(--ink);
  background: #f0f0f0;
}

.subnav {
  display: flex;
  justify-content: center;
  gap: 4px;
  max-width: 1100px;
  margin: 14px auto 0;
  padding: 0 16px;
  overflow-x: auto;
}

.subnav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  transition: color 0.12s, background 0.12s;
}

.subnav a:hover { color: var(--ink); background: var(--bg); }

.subnav a.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.nav-tools { display: flex; align-items: center; gap: 8px; }

.search-toggle {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.search-toggle:hover { color: var(--ink); background: var(--bg); }

.global-search {
  flex-basis: 100%;
  padding: 4px 6px 8px;
}
.global-search[hidden] { display: none; }
.global-search-input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #cfcfcf;
  border-radius: var(--radius-pill);
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
.global-search-results { max-height: 60vh; overflow-y: auto; margin-top: 6px; }
.gs-group {
  margin: 10px 8px 2px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.gs-item {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.gs-item small { color: var(--muted); font-weight: 400; }
.gs-item:hover, .gs-item:focus-visible { background: var(--bg); }
.gs-empty { padding: 8px 12px; margin: 0; }

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

h2 { margin-top: 0; font-size: 1.5rem; }

.page-hero { padding: 56px 0 40px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.page-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 20px;
  word-break: break-word;
}
.page-sub { font-size: clamp(1.1rem, 2.4vw, 1.4rem); color: var(--muted); max-width: 46em; margin: 0 0 24px; line-height: 1.45; }
.page-hero .form-actions { margin-top: 28px; }
.card-header .page-title { font-size: clamp(2rem, 6vw, 3.5rem); margin-bottom: 16px; }

main a:not(.btn) {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

main a:not(.btn):hover { color: var(--accent); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 12px;
}

.card.status-overdue { border-left: 4px solid var(--overdue); }
.card.status-due { border-left: 4px solid var(--due-mark); }

.card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px 12px;
}

.card-title { font-weight: 700; font-size: 1.05rem; }

.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.status-due { background: var(--due-bg); color: var(--due); }
.badge.status-overdue { background: var(--overdue-bg); color: var(--overdue); }
.badge.status-done { background: var(--done-bg); color: var(--done); }
.badge.status-upcoming { background: #efefef; color: var(--muted); }

.card-meta { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 10px 26px;
  min-height: 48px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--ink);
}

.btn.secondary:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

.btn.danger {
  background: var(--surface);
  color: var(--overdue);
  border-color: var(--overdue);
}

.btn.danger:hover { background: var(--overdue); color: #fff; }

.btn.small { padding: 8px 18px; min-height: 38px; font-size: 0.85rem; }

.empty-state {
  color: var(--muted);
  padding: 24px;
  text-align: center;
  border: 1px dashed #cfcfcf;
  border-radius: var(--radius);
}

.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 40px 0 16px;
}

.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 40px 0 16px; }
.section-head .section-title { margin: 0; }

.clock-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 24px;
}

.clock-wrap svg { max-width: 280px; width: 100%; height: auto; }

.quarter-slice { cursor: pointer; }
.quarter-slice:hover path { opacity: 1 !important; filter: brightness(1.08); }
.quarter-slice:focus-visible path { outline: none; filter: brightness(1.15); }

.help-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}

.help-btn:hover { background: var(--ink); color: #fff; }

.help-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.help-overlay.open { display: flex; }

.help-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 24px 24px;
  position: relative;
}

.help-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.help-close:hover { background: var(--bg); }

.help-content h2 { margin-top: 0; }
.help-content h3 { margin: 20px 0 6px; font-size: 1rem; }
.help-content p { margin: 6px 0; }
.help-content ul { margin: 6px 0; padding-left: 20px; }
.help-content li { margin-bottom: 4px; }

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

form.task-form label {
  display: block;
  font-weight: 700;
  margin: 14px 0 4px;
}

.field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-header label { margin: 14px 0 4px; }

form.task-form input[type="text"],
form.task-form textarea,
form.task-form input[type="number"],
form.task-form input[type="date"],
form.task-form select,
.complete-row input[type="date"],
.complete-row input[type="text"],
.tag-add-row input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

form.task-form textarea { min-height: 140px; resize: vertical; }

.quarters-check {
  display: flex;
  gap: 16px;
  margin-top: 6px;
}

.quarters-check label,
.months-check label {
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

.months-check {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 12px;
  margin-top: 6px;
}

.interval-fields {
  display: flex;
  gap: 16px;
}

.interval-fields > div { flex: 1; }

.recurrence-toggle {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.recurrence-toggle button {
  flex: 1;
  padding: 8px;
  border: 1px solid #cfcfcf;
  background: var(--surface);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  color: var(--text);
  transition: background 0.12s, color 0.12s;
}

.recurrence-toggle button:hover { border-color: var(--ink); }

.recurrence-toggle button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.form-actions {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.complete-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.complete-row input[type="date"] { flex: 1 1 150px; width: auto; min-width: 0; padding: 10px; }
.complete-row input[type="text"] { flex: 1 1 160px; width: auto; min-width: 0; padding: 10px; }
.complete-row button { flex: 1 1 100%; }

.instructions-preview {
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.instructions-preview :first-child { margin-top: 0; }
.instructions-preview :last-child { margin-bottom: 0; }

.attachment-list, .completion-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.attachment-list li, .completion-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.attachment-list a {
  color: var(--ink);
  word-break: break-word;
}

.completion-list li > span { word-break: break-word; }

.muted { color: var(--muted); }

.task-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.task-row-meta { color: var(--muted); font-size: 0.88rem; }

.tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag-pill {
  display: inline-block;
  background: #efefef;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cfcfcf;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  min-height: 36px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.tag-chip:hover { border-color: var(--ink); }

.tag-chip.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.tag-filter-bar, .tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-filter-bar { margin-bottom: 16px; }

.filter-chip-wrap { padding: 7px 8px 7px 14px; gap: 8px; overflow: hidden; }

.filter-chip-wrap .filter-chip-btn {
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
  padding: 0;
}

.filter-chip-wrap .tag-chip-remove {
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--overdue-bg);
  color: var(--overdue);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.filter-chip-wrap .tag-chip-remove:hover,
.filter-chip-wrap .tag-chip-remove:active {
  background: var(--overdue);
  color: #fff;
}

.tag-add-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.tag-add-row input { flex: 1; width: auto; min-width: 0; }

a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 700px) {
  main { padding: 16px 16px 60px; }
  header.site { margin: 8px 8px 0; top: 8px; gap: 8px 12px; padding: 10px 14px; border-radius: 28px; }
  header.site nav { order: 3; flex-basis: 100%; gap: 2px; overflow-x: auto; flex-wrap: nowrap; }
  header.site nav { scrollbar-width: none; justify-content: space-between; }
  header.site nav::-webkit-scrollbar { display: none; }
  header.site nav a { white-space: nowrap; padding: 6px 7px; font-size: 0.85rem; }
  .nav-tools { margin-left: auto; }
  .page-hero { padding: 36px 0 28px; }
  .section-title, .section-head { margin-top: 28px; }
}

@media (max-width: 600px) {
  .hero { flex-direction: column; gap: 16px; }
  .hero .clock-wrap, .kalle { flex-basis: auto; width: 100%; }
  .kalle-img { width: 130px; }
  .kalle-bubble { font-size: 0.95rem; padding: 10px 14px; }
  .brand-logo { height: 32px; margin-right: 8px; }
}

/* Equipment */
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.equipment-grid > .empty-state { grid-column: 1 / -1; }

.equipment-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
  text-align: center;
  color: inherit;
  text-decoration: none;
}
.equipment-tile:hover { border-color: var(--ink); }
.equipment-tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.equipment-icon { font-size: 2.2rem; line-height: 1.2; }
.equipment-tile-name { font-weight: 800; font-size: 1.05rem; word-break: break-word; }
.equipment-tile-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 4px; }
.equipment-tile .tag-pills { justify-content: center; margin-top: 4px; }
.equipment-tile .equipment-snippet {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.equipment-filters { display: grid; gap: 8px; margin-bottom: 16px; }
.equipment-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.equipment-filter-label { color: var(--muted); font-size: 0.85rem; font-weight: 700; min-width: 64px; }

.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-choice {
  min-width: 42px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 1.2rem;
  cursor: pointer;
}
.icon-choice.auto { font-size: 0.9rem; font-family: inherit; }
.icon-choice:hover { border-color: var(--ink); }
.icon-choice.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.equipment-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 8px 0 0;
  font-size: 0.92rem;
}
.equipment-facts dt { color: var(--muted); }
.equipment-facts dd { margin: 0; word-break: break-word; }

.manual-viewer { margin-top: 10px; }
.manual-frame {
  display: block;
  width: 100%;
  height: 75vh;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.manual-image { display: block; max-width: 100%; margin: 0 auto; border-radius: var(--radius); }
.manual-links { display: flex; gap: 16px; margin-top: 8px; font-size: 0.9rem; }
.manual-links a { color: var(--ink); }
@media (max-width: 600px) {
  .manual-frame { height: 60vh; min-height: 320px; }
}

.equipment-snippet {
  margin-top: 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.88rem;
}
.guide-heading { font-size: 0.95rem; margin: 14px 0 6px; }
#equipment-guide .field-header { margin-bottom: 8px; }
@media (max-width: 600px) {
  .equipment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .equipment-tile { padding: 12px 8px; }
  .equipment-tile-name { font-size: 0.95rem; }
}

/* Materials */
.search-input {
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 12px;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
.color-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 50%;
  vertical-align: -2px;
}
.color-line { display: inline-flex; align-items: center; justify-content: center; }
.color-row { display: flex; align-items: center; gap: 12px; }
.color-row input[type="color"] { width: 48px; height: 36px; padding: 2px; border: 1px solid #cfcfcf; border-radius: 8px; background: var(--surface); }
form.task-form label.inline-check { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 8px; }
.material-photo { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius); }
@media (max-width: 600px) {
  header.site nav a { font-size: 0.85rem; }
}

.back-row { max-width: 1000px; margin: 0 auto; padding: 16px 24px 0; }
.back-row + main { padding-top: 12px; }
.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
  font-size: 1.2rem;
}
.back-btn:hover { background: var(--surface); }
@media (max-width: 600px) { .back-row { padding: 12px 16px 0; } }

.template-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 14px 20px; }
.template-row.added { opacity: 0.6; }
.template-check { display: flex; align-items: center; gap: 14px; cursor: pointer; flex: 1; min-width: 0; }
.template-check input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.template-check > span { display: flex; flex-direction: column; gap: 2px; }
.template-row.added .template-check { cursor: default; }
.template-details { flex-basis: 100%; font-size: 0.9rem; color: var(--muted); }
.template-details summary { cursor: pointer; }
.template-details p { white-space: pre-line; margin: 8px 0 0; }
.template-bar {
  position: sticky;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 12px 12px 12px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.template-bar[hidden] { display: none; }

/* Huoltokirja */
.huoltokirja section { margin-bottom: 8px; }
.hk-table-wrap { overflow-x: auto; margin-bottom: 12px; }
.hk-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.92rem; }
.hk-table th, .hk-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.hk-table th { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.hk-table td.num { text-align: right; white-space: nowrap; }
.hk-table .tick { text-align: center; width: 64px; color: var(--done); font-weight: 700; }
.hk-table tr.group-row th { background: var(--bg, #f6f6f6); color: var(--text); text-transform: none; font-size: 0.9rem; }
.huoltokirja .section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.huoltokirja .section-head select { padding: 6px 8px; border: 1px solid #cfcfcf; border-radius: 8px; font: inherit; }

}
.hk-doc-title { font-size: 0.95rem; margin: 12px 0 4px; }
.hk-doc-title:first-child { margin-top: 0; }
.huoltokirja .section-head select { max-width: 100%; }
.huoltokirja .section-head label.btn { cursor: pointer; }
.hk-multi { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 4px 0; }
.hk-multi .tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hk-chip-remove { border: 0; background: none; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0 0 4px; color: var(--muted); }
.hk-chip-remove:hover { color: var(--accent); }
.hk-picker { max-width: 480px; display: flex; flex-direction: column; }
.hk-picker-title { margin: 0 32px 12px 0; }
.hk-picker-list { display: flex; flex-direction: column; gap: 8px; max-height: 45vh; overflow-y: auto; padding: 4px 2px; margin-bottom: 8px; }

/* ---- Accounts, sign-in pages and the update prompt (hosted version) ---- */
.account-link {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
}
.account-link:hover, .account-link.active { color: var(--ink); background: #f1f1f1; }

body.auth-page main { max-width: 440px; margin: 48px auto; padding: 0 16px; }
body.auth-page .brand-header { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
body.auth-page .brand-header img { height: 44px; }
body.auth-page .brand-header span { font-family: var(--font-serif); font-size: 1.4rem; font-weight: 700; }

.auth-card, .account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.auth-card h2, .account-card h3 { margin-top: 0; font-family: var(--font-serif); }

form.auth-form label { display: block; font-weight: 700; margin: 14px 0 4px; }
form.auth-form input[type="text"],
form.auth-form input[type="email"],
form.auth-form input[type="password"],
form.auth-form input[type="file"],
form.auth-form select,
.account-card input[type="text"],
.account-card input[type="password"],
.account-card input[type="email"],
.account-card input[type="number"],
.account-card select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
form.auth-form .btn { margin-top: 18px; width: 100%; }
.auth-error { color: var(--overdue); background: var(--overdue-bg); border-radius: 8px; padding: 8px 12px; margin-top: 12px; }
.auth-ok { color: var(--done); background: var(--done-bg); border-radius: 8px; padding: 8px 12px; margin-top: 12px; }
.auth-error:empty, .auth-ok:empty { display: none; }
.auth-hint { color: var(--muted); font-size: 0.9rem; margin-top: 14px; }

.account-card .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.account-card table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.account-card th, .account-card td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.account-card code { background: #f3f3f3; padding: 2px 6px; border-radius: 6px; word-break: break-all; }

.update-banner {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  width: min(560px, calc(100% - 32px));
  background: var(--ink);
  color: #fff;
  border-radius: 18px;
  padding: 14px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.update-banner .update-text { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; font-size: 0.92rem; }
.update-banner ul { margin: 6px 0 0; padding-left: 18px; font-size: 0.85rem; opacity: 0.9; }
.update-banner .update-actions { display: flex; gap: 8px; }
.update-banner .btn.secondary { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.update-banner .btn.secondary:hover { background: #fff; color: var(--ink); }
.update-banner.update-required { bottom: 50%; transform: translate(-50%, 50%); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45), 0 8px 30px rgba(0, 0, 0, 0.3); }
@media print { .update-banner { display: none; } }
