:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --text: #172b4d;
  --muted: #6b778c;
  --line: #dfe1e6;
  --accent: #0c66e4;
  --accent-dark: #0055cc;
  --hover: #f1f5fb;
  /* Heights of the sticky top bar and footer; app.js sets the real values. */
  --topbar-h: 52px;
  --footer-h: 36px;
  --cols: 32px minmax(130px, 210px) minmax(200px, 1fr) 170px 120px 90px 140px 96px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 8px); scroll-padding-bottom: calc(var(--footer-h) + 8px); }
/* The top bar and footer stay in view (sticky); on short pages the footer sits at the bottom. */
body { margin: 0; background: var(--bg); font-size: 14px; display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 0 auto; width: 100%; padding: 16px; max-width: 1500px; margin: 0 auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.grow { flex: 1; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20; gap: 10px;
  min-height: 52px; padding: 0 16px; background: var(--accent); color: #fff;
  box-shadow: 0 1px 3px rgba(9, 30, 66, 0.25);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; }
.topbar .brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: rgba(255, 255, 255, 0.18); }
.brand-mark .icon { width: 18px; height: 18px; }
.brand-logo { width: 24px; height: 26px; }
.brand-for { font-weight: 500; opacity: 0.85; }
.brand-accent { color: #ffd84d; }
.version { padding: 1px 7px; border-radius: 10px; background: rgba(255, 255, 255, 0.18); color: #e3ecff; font-size: 11px; font-weight: 600; }

/* Version pill in the top bar: opens "What's new" (_whats_new.html, from CHANGELOG.md) */
.version-menu > summary.version { display: inline-block; padding: 1px 7px; border-radius: 10px; cursor: pointer; }
.version-menu > summary.version:hover, .version-menu[open] > summary.version { background: rgba(255, 255, 255, 0.3); color: #fff; }
.version-menu > summary.version.unseen::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 1px 5px; border-radius: 50%; background: #ffc439; vertical-align: middle; }
.version-menu .whats-new { left: 0; right: auto; width: 380px; padding: 12px 16px; line-height: 1.5; font-weight: 400; }
.whats-new p { margin: 0 0 6px; }
.whats-new-title { font-size: 15px; }
.whats-new-entry { padding: 8px 0; border-top: 1px solid var(--line); }
.whats-new-entry h3 { margin: 0 0 2px; font-size: 14px; }
.whats-new-entry h4 { margin: 6px 0 0; color: var(--accent); font-size: 12px; font-weight: 600; }
.whats-new-entry ul { margin: 2px 0 0; padding-left: 18px; }
.whats-new-entry code { padding: 0 4px; border-radius: 4px; background: var(--hover); font-size: 12px; }
.whats-new-older > summary { padding: 8px 0 2px; border-top: 1px solid var(--line); color: var(--accent); cursor: pointer; }
@media (max-width: 700px) { .version-menu .whats-new { position: fixed; top: calc(var(--topbar-h, 52px) + 6px); left: 16px; right: 16px; width: auto; max-height: calc(100vh - var(--topbar-h, 52px) - 24px); } }

/* Account menu (a <details>, so it opens without JavaScript too) */
.account-menu { position: relative; }
.account-menu > summary {
  display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 20px;
  list-style: none; cursor: pointer; user-select: none;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover, .account-menu[open] > summary { background: rgba(255, 255, 255, 0.15); }
.avatar {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}
.account-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.menu-panel {
  position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; min-width: 240px; padding: 6px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(9, 30, 66, 0.18);
  /* The top bar doesn't scroll, so a long menu scrolls inside itself. */
  max-height: calc(100vh - var(--topbar-h) - 16px); overflow-y: auto;
}
.menu-panel form { margin: 0; }
.menu-user { margin: 6px 8px 8px; line-height: 1.5; overflow-wrap: anywhere; }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px; border: 0; border-radius: 6px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--hover); }

/* Icons: one stroke set (templates/_icons.html) */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary .icon { stroke: #fff; }

/* Keyboard focus and skip link */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.topbar :focus-visible { outline-color: #fff; }
main:focus { outline: none; }
.skip-link { position: absolute; left: 8px; top: -40px; z-index: 50; padding: 8px 12px; border-radius: 6px; background: #fff; color: var(--accent); }
.skip-link:focus { top: 8px; }
kbd { padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: #fff; font: 12px Consolas, "Courier New", monospace; color: var(--text); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }
.notice.error { border-color: #f5b5b5; background: #fff5f5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--text); font: inherit; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-link { border: 0; background: none; padding: 0; color: var(--accent); }
.btn-link:hover { background: none; text-decoration: underline; }

/* Search panel grid:
   row 1: JQL label, field, Search, Save filter
   row 2: Quick filters                 | Saved filters (as wide as both buttons)
   row 3: Recent filters                | Blank card templates
   row 4: "Searching Jira..." while a search loads */
.search-panel { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; }
.search { display: contents; }
.jql-entry { grid-column: 2; grid-row: 1; min-width: 0; align-self: stretch; }
.jql-control { position: relative; }
.jql-control > input { box-sizing: border-box; width: 100%; min-width: 0; }
.jql-suggestions { position: absolute; z-index: 25; top: calc(100% + 3px); left: 0; right: 0; max-height: 240px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); box-shadow: 0 6px 18px rgba(20, 32, 54, 0.18); }
.jql-suggestions li { overflow: hidden; padding: 6px 9px; border-radius: 4px; color: var(--text); cursor: pointer; text-overflow: ellipsis; white-space: nowrap; }
.jql-suggestions li[aria-selected="true"], .jql-suggestions li:hover { background: var(--hover); color: var(--accent); }
.jql-feedback, .jql-autocomplete-status { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.jql-feedback.error { color: #ae2e24; }
.jql-feedback:empty, .jql-autocomplete-status:empty { display: none; }
.search-panel > .quick { grid-column: 1 / 3; margin: 0; }
.search-panel > .quick:not(.recent) { grid-row: 2; }
.search-panel > .quick.recent { grid-row: 3; }
/* As wide as Saved filters above it. */
.search-panel > .templates-link { grid-row: 3; grid-column: 3 / 5; justify-self: stretch; }
/* The sticky note sheet is step 1 of the workflow: a yellow button, like a sticky note. */
.btn.templates-link { border-color: #f5cd47; background: #fff8db; }
.btn.templates-link:hover { background: #fff3c4; }
.quick-filter::before { content: "\25B6"; margin-right: 5px; color: var(--accent); font-size: 10px; }
.search-panel > .search-status { grid-row: 4; grid-column: 1 / -1; margin: 0; }
.quick > .muted:first-child { flex: none; width: 7.2em; }
.search label { font-weight: 600; }
.search input { flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font: 13px Consolas, "Courier New", monospace; }
.quick { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 0; }
.push-right { margin-left: auto; }
.quick.recent { margin-top: 6px; align-items: center; }
.recent-filter { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inline-form { display: inline; margin: 0; }
.btn-link.muted { color: var(--muted); }

/* Busy indicator while a search loads */
.spinner { display: none; width: 12px; height: 12px; vertical-align: -1px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn.busy { pointer-events: none; }
.btn.busy .spinner { display: inline-block; }
.btn.busy .icon-search { display: none; }
.search-status { color: var(--muted); }
.search-status .dots span { animation: blink 1.2s infinite both; }
.search-status .dots span:nth-child(2) { animation-delay: 0.2s; }
.search-status .dots span:nth-child(3) { animation-delay: 0.4s; }
body.searching main > section.panel ~ :not(.skeleton):not(dialog) { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .spinner, .search-status .dots span { animation-duration: 3s; }
}

/* Saved filters dropdown (a <details> so it opens without JavaScript too) */
.saved-menu { position: relative; grid-row: 2; grid-column: 3 / 5; }
.saved-menu > summary.btn { display: flex; justify-content: space-between; align-items: center; }
.saved-menu > summary { list-style: none; user-select: none; }
.saved-menu > summary::-webkit-details-marker { display: none; }
.saved-menu[open] > summary { background: var(--hover); }
.saved-panel {
  position: absolute; z-index: 20; top: calc(100% + 4px); right: 0; width: min(520px, 90vw);
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px;
  box-shadow: 0 8px 24px rgba(9, 30, 66, 0.15);
}
.saved-panel p { margin: 6px 4px; }
.saved-filter { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.saved-scroll { max-height: 360px; overflow-y: auto; margin-top: 6px; }
.saved-list { list-style: none; margin: 0; padding: 0; }
.saved-group + .saved-group { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 4px; }
.saved-panel .saved-group-title { margin: 4px 8px 2px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.saved-group-title .muted { text-transform: none; font-weight: 400; letter-spacing: 0; }
.saved-item { display: flex; align-items: center; gap: 4px; border-radius: 6px; }
.saved-item:hover, .saved-item:focus-within { background: var(--hover); }
.saved-item.current .saved-name::after { content: " · current"; color: var(--muted); font-weight: 400; }
.saved-item a { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 6px 8px; color: var(--text); }
.saved-item a:hover, .saved-item a:focus { text-decoration: none; outline: none; }
.saved-name { font-weight: 600; }
.saved-jql { font: 12px Consolas, "Courier New", monospace; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-item .remove { color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 8px; }
.saved-item .remove:hover { color: #ae2e24; text-decoration: none; }

/* Save filter dialog */
.save-dialog { width: min(560px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; color: var(--text); }
.save-dialog::backdrop { background: rgba(9, 30, 66, 0.35); }
.save-dialog h2 { margin: 0 0 10px; font-size: 18px; }
.save-dialog p { margin: 10px 0 4px; }
.save-dialog label { display: block; font-weight: 600; margin: 12px 0 4px; }
.save-dialog input[type="text"] { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.jql-preview {
  margin: 0; padding: 8px 10px; max-height: 160px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; font: 13px Consolas, "Courier New", monospace;
}
.small { font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.check { display: inline-flex; gap: 6px; align-items: center; }
.badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge-warn { background: #fff4e5; color: #974f0c; }

/* Tree: every row is a grid so columns line up across nesting levels. */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: var(--cols); gap: 8px; align-items: center;
  padding: 6px 4px; border-bottom: 1px solid #f0f1f4;
}
.row > span { min-width: 0; }
.tree-head { font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
summary.row { cursor: pointer; list-style: none; }
summary.row::-webkit-details-marker { display: none; }
.tree .row:hover { background: var(--hover); }
.key { display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.key::before { content: ""; display: inline-block; width: 14px; flex: none; color: var(--muted); text-align: center; }
summary .key::before { content: "▸"; transition: transform 120ms ease; }
details[open] > summary .key::before { transform: rotate(90deg); }
.key img { flex: none; }
.depth-1 { padding-left: 16px; }
.depth-2 { padding-left: 32px; }
.depth-3 { padding-left: 48px; }
.depth-4 { padding-left: 64px; }
.depth-5 { padding-left: 80px; }
.depth-6 { padding-left: 96px; }
.depth-7 { padding-left: 112px; }
.depth-8 { padding-left: 128px; }
.progress-cell { display: flex; align-items: center; gap: 6px; }
.tree-progress { width: 60px; height: 6px; flex: none; }
.tree-progress .track { fill: #e5e7eb; }
.tree-progress .fill { fill: #4caf50; }
.progress-cell .ratio { font-size: 12px; color: var(--muted); white-space: nowrap; }
.summary, .clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.status { display: inline-block; max-width: 100%; padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid transparent; }
.status-default { background: #f4f5f7; color: #42526e; border-color: #dfe1e6; }
.status-open { background: #e8f4ff; color: #0a3d62; border-color: #b3d7ff; }
.status-progress { background: #fff6e5; color: #8a4b00; border-color: #ffd48a; }
.status-analysis { background: #efe6ff; color: #3b1f7a; border-color: #c8b3ff; }
.status-review { background: #e8f5ff; color: #0b4f71; border-color: #9ad1ff; }
.status-test { background: #0b3b8a; color: #fff; border-color: #082a61; }
.status-ready { background: #e5fff4; color: #0b5c3b; border-color: #9ee6c4; }
.status-done { background: #e6ffed; color: #0f5132; border-color: #a3e3b1; }
.status-cancelled { background: #f7e6e6; color: #7a1f1f; border-color: #e0b3b3; }

@media (max-width: 900px) {
  :root { --cols: 28px minmax(110px, 160px) 1fr 130px; }
  .row > span:nth-child(n + 5) { display: none; }
}

/* Results: filter bar, sortable sticky header, selection bar */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.filter-bar input[type="search"] { width: min(340px, 100%); padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.filter-bar select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; color: var(--text); max-width: 200px; }
.filter-bar select:disabled { color: var(--muted); }
.tree-head { position: sticky; top: var(--topbar-h); z-index: 5; background: var(--panel); }
.tree-head .sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.tree-head .sort:hover { color: var(--text); }
.tree-head [aria-sort="ascending"] .sort, .tree-head [aria-sort="descending"] .sort { color: var(--text); }
.tree li.context > details > summary.row > span:not(:first-child) { opacity: 0.55; }
.selection-bar {
  position: sticky; bottom: var(--footer-h); z-index: 5; display: flex; align-items: center; gap: 12px;
  margin: 10px -16px -14px; padding: 10px 16px; background: #e9f2ff; border-top: 1px solid #b3d4ff;
  border-radius: 0 0 8px 8px; box-shadow: 0 -4px 12px rgba(9, 30, 66, 0.08);
}
#filter-none { margin: 12px 4px; }

/* Filter chips (quick and recent filters) */
.filter-label { display: inline-flex; align-items: center; gap: 5px; }
.filter-label .icon { width: 14px; height: 14px; }
.quick > .filter-label:first-child { width: 8.5em; }
.quick { align-items: center; gap: 6px; }
.chip {
  display: inline-block; max-width: 260px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--hover); text-decoration: none; }
.templates-link { display: inline-flex; align-items: center; gap: 5px; }
.saved-menu > summary.btn > span { display: inline-flex; align-items: center; gap: 6px; }
.saved-menu .count { padding: 0 6px; border-radius: 9px; background: var(--bg); color: var(--muted); font-size: 12px; }
.saved-menu[open] > summary .icon-chevron-down { transform: rotate(180deg); }
.saved-item .remove .icon { width: 15px; height: 15px; }
.filter-icon { color: var(--muted); display: inline-flex; }
.notice .icon { color: var(--muted); }
.notice.error .icon { color: #ae2e24; }

/* Toasts */
.toasts { position: fixed; z-index: 40; right: 16px; bottom: calc(var(--footer-h) + 12px); display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: min(440px, calc(100vw - 32px));
  padding: 10px 10px 10px 14px; border-radius: 8px; background: #172b4d; color: #fff;
  box-shadow: 0 8px 24px rgba(9, 30, 66, 0.3); animation: toast-in 0.2s ease-out;
}
.toast > .icon { color: #7ee2b8; }
.toast-text { flex: 1; }
.toast-action { border: 0; background: none; color: #85b8ff; font: inherit; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.toast-action:hover { text-decoration: underline; }
.toast-close { display: grid; place-items: center; border: 0; background: none; color: #b3bac5; cursor: pointer; padding: 4px; border-radius: 4px; }
.toast-close:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Welcome state */
.welcome { padding: 28px 28px 22px; }
.welcome h1 { margin: 0 0 18px; font-size: 20px; }
/* "How it works" on the welcome page: four steps, each with a line drawing (templates/_howto.html). */
.howto { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0 0 20px; padding: 0; list-style: none; }
@media (max-width: 1100px) { .howto { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .howto { grid-template-columns: 1fr; } }
.howto li { display: flex; flex-direction: column; gap: 6px; line-height: 1.45; }
.howto strong { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.step-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #e9f2ff; color: var(--accent); font-size: 13px; font-weight: 700; }
.howto-art { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; max-height: 150px; border-radius: 10px; background: #f4f7fb; }
.howto-art .d-paper { fill: #fff; stroke: #8590a2; stroke-width: 1.2; }
.howto-art .d-line { fill: #fff; stroke: #44546f; stroke-width: 1.5; stroke-linejoin: round; }
.howto-art .d-dot, .howto-art .d-fill { fill: var(--accent); }
.howto-art .d-outline { fill: none; stroke: #8590a2; stroke-width: 0.8; stroke-dasharray: 2 1.4; }
.howto-art .d-postit { fill: #fde68a; stroke: #d4a017; stroke-width: 0.8; }
.howto-art .d-stripe { fill: #36b37e; }
.howto-art .d-text { fill: none; stroke: #44546f; stroke-width: 1.2; stroke-linecap: round; }
.howto-art .d-tick { fill: none; stroke: #fff; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.howto-art .d-arrow { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.welcome > p { margin: 0 0 8px; }

/* Skeleton rows while a search loads */
.skeleton { padding-top: 16px; }
.skeleton-row { display: grid; grid-template-columns: 18px 120px 1fr 80px; gap: 16px; align-items: center; padding: 10px 4px; border-bottom: 1px solid #f0f1f4; }
.skeleton-bar { display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #eceef1 0%, #f6f7f9 50%, #eceef1 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton-bar.wide { width: 220px; height: 14px; margin: 0 0 14px; }
.skeleton-bar.box { width: 14px; height: 14px; border-radius: 3px; }
.skeleton-bar.pill { height: 16px; border-radius: 4px; }
.skeleton-bar.w1 { width: 72%; } .skeleton-bar.w2 { width: 58%; } .skeleton-bar.w3 { width: 80%; } .skeleton-bar.w4 { width: 64%; }
.skeleton-bar.w5 { width: 52%; } .skeleton-bar.w6 { width: 76%; } .skeleton-bar.w7 { width: 60%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton-bar, .toast { animation: none; }
}
@media (max-width: 700px) {
  .account-name { display: none; }
}

/* Privacy policy and terms (templates/privacy.html, templates/terms.html) */
.legal { max-width: 820px; margin: 0 auto 16px; padding: 8px 32px 24px; line-height: 1.5; }
.legal h2 { font-size: 1.1rem; margin: 24px 0 6px; }
.legal-date { color: var(--muted); }

/* Footer on every app page (base.html) */
.site-footer {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px;
  padding: 9px 16px; background: var(--panel); border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer .icon { width: 13px; height: 13px; margin-right: 3px; }

/* "Support this app" in the top bar (a <details> like the account menu) and the story on the welcome page (_support.html) */
.topbar-right { display: flex; align-items: center; gap: 6px; }
.support-menu > summary { padding: 6px 12px; font-size: 13px; }
.support-menu > summary .icon { width: 15px; height: 15px; }
.support-panel { width: 340px; padding: 12px 16px; line-height: 1.5; }
.support-panel p { margin: 0 0 10px; }
.support-panel p:last-child { margin-bottom: 0; }
.support-title { font-size: 15px; }
/* PayPal's official Donate button image (static/paypal-donate.png, served by the app so no PayPal request happens before a click) */
.donate-btn { display: inline-block; line-height: 0; border-radius: 6px; }
.donate-btn img { display: block; }
.donate-btn:hover img { filter: brightness(0.97); }
.about { max-width: 760px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); line-height: 1.5; }
.about h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 15px; }
.about h2 .icon { color: #e2483d; fill: #e2483d; }
.about p { margin: 0 0 8px; }
@media (max-width: 700px) {
  .support-label { display: none; }
  .support-panel { width: min(340px, calc(100vw - 32px)); right: -60px; }
}

/* Privacy, terms and security pages: a way back to the app and to the other two pages (_legal_nav.html). */
.legal-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.legal-back { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.legal-tab { padding: 5px 10px; border-radius: 14px; }
.legal-tab[aria-current="page"] { background: #e9f2ff; color: #09326c; font-weight: 600; }
.site-footer a[aria-current="page"] { color: var(--text); font-weight: 700; }

/* --- Phones and tablets ---------------------------------------------------------------------------------
   Desktop (a mouse, wider than 1200px) keeps the layout above. These rules only apply to touch screens
   (pointer: coarse), narrower windows or short landscape phones. */

/* Laptops and tablets in landscape: the tree drops Priority and Created so its columns fit without a side scroll. */
@media (max-width: 1200px) and (min-width: 901px) {
  :root { --cols: 32px minmax(110px, 180px) minmax(180px, 1fr) 150px 120px 130px; }
  .row > span:nth-child(6), .row > span:nth-child(8) { display: none; }
}

/* Start page for signed-out visitors (templates/signin.html): hero with a sample sheet, the steps, Good to know, the story. */
.home { max-width: 1180px; margin: 8px auto 0; }
.home h1 { margin: 0 0 14px; font-size: 38px; line-height: 1.15; letter-spacing: -0.5px; }
.home-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; padding: 44px 48px; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, #fff 0%, #fff 55%, #eef4ff 100%); }
.home-eyebrow { display: inline-block; margin: 0 0 14px; padding: 4px 10px; border: 1px solid #f5e3a0; border-radius: 99px; background: #fff7d6; color: #7a5d00; font-size: 13px; font-weight: 600; }
.home-lead { max-width: 520px; margin: 0 0 22px; color: #44546f; font-size: 17px; line-height: 1.55; }
.home-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-large { padding: 11px 20px; border-radius: 8px; font-size: 16px; font-weight: 600; }
.btn-large:not(.btn-primary) { color: var(--accent); }
.btn-large .icon { stroke: currentColor; }
.home-ticks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 18px 0 0; padding: 0; list-style: none; color: #44546f; }
.home-ticks li { display: flex; align-items: center; gap: 6px; }
.home-ticks .icon { width: 16px; height: 16px; padding: 2px; border-radius: 50%; background: #dcfff1; stroke: #216e4e; }
/* The sample sheet: three issue cards printed on sticky notes, the last one peeling off. Decorative (role="img"). */
.home-art { display: flex; justify-content: center; padding: 10px 0; }
.sample-sheet { width: 330px; padding: 30px 30px 36px; border-radius: 6px; background: #fff; box-shadow: 0 18px 40px rgba(9, 30, 66, 0.16), 0 2px 6px rgba(9, 30, 66, 0.08); transform: rotate(2deg); }
.sample-note { display: flex; gap: 10px; height: 162px; margin-bottom: 16px; padding: 10px 12px 10px 10px; border-radius: 3px; background: #fde68a linear-gradient(rgba(0, 0, 0, 0.05), transparent 26px); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); color: #333; }
.sample-note:last-child { margin-bottom: 0; }
.sample-note.peel { transform: rotate(-5deg) translate(10px, 4px); box-shadow: 4px 10px 16px rgba(0, 0, 0, 0.18); }
.sample-stripe { display: flex; flex: none; flex-direction: column; align-items: center; justify-content: space-between; width: 22px; padding: 8px 0 3px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 700; }
.sample-stripe > span:first-child { writing-mode: vertical-rl; }
/* Issue type icon at the bottom of the stripe, like the printed cards: a white tile with the type's mark in its colour. */
.sample-icon { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 3px; background: #fff; }
.sample-icon svg { width: 12px; height: 12px; fill: currentColor; }
.type-epic .sample-icon { color: #7f5af0; }
.type-story .sample-icon { color: #36a36b; }
.type-bug .sample-icon { color: #e2483d; }
.sample-stripe.type-epic { background: #7f5af0; }
.sample-stripe.type-story { background: #36a36b; }
.sample-stripe.type-bug { background: #e2483d; }
.sample-body { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; font-size: 11.5px; line-height: 1.4; }
.sample-body strong { color: #111; font-size: 15px; line-height: 1.25; }
.sample-keys { display: flex; flex-direction: column; align-items: flex-end; margin-top: auto; color: #555; }
.sample-keys small { font-size: 9px; }
.sample-keys b { color: var(--text); font-size: 15px; }
.home .welcome { padding: 28px 32px 22px; border-radius: 12px; }
.home .welcome h2 { margin: 0 0 16px; font-size: 20px; }
.sign-in-first { color: var(--muted); font-style: italic; }
.home-section-title { margin: 28px 0 12px 4px; font-size: 20px; }
.home-faq { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.home-faq .panel { margin: 0; padding: 20px 22px; border-radius: 12px; }
.home-faq h3 { margin: 0 0 6px; font-size: 15px; }
.home-faq p { margin: 0; color: #44546f; line-height: 1.5; }
.home-story { display: flex; gap: 24px; align-items: center; margin-top: 16px; padding: 20px 24px; border-radius: 12px; line-height: 1.5; }
.home-story h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 15px; }
.home-story h2 .icon { color: #e2483d; fill: #e2483d; }
.home-story p { margin: 0 0 8px; color: #44546f; }
.home-story > p { flex: none; margin: 0; }
@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; gap: 24px; padding: 28px 24px 32px; }
  .home-faq { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 600px) {
  .home { margin-top: 0; }
  .home h1 { font-size: 28px; }
  .home-hero { padding: 24px 18px 28px; }
  .home-lead { font-size: 16px; }
  .home-cta .btn { width: 100%; }
  .sample-sheet { width: min(280px, 100%); padding: 22px 18px 26px; }
  .sample-note { height: 138px; }
  .home .welcome { padding: 18px 16px 16px; }
  .home-story { flex-direction: column; align-items: flex-start; padding: 18px 16px; }
}

/* Touch screens: tap targets of at least 44px, and 16px text in fields so iOS doesn't zoom in on focus. */
@media (pointer: coarse) {
  .btn, .saved-menu > summary.btn { min-height: 44px; }
  .chip { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; }
  .search input, .filter-bar input[type="search"], .filter-bar select, .saved-filter, .save-dialog input[type="text"] { min-height: 44px; font-size: 16px; }
  .version-menu > summary.version { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: 16px; }
  .account-menu > summary { min-height: 44px; }
  .menu-item { min-height: 44px; }
  .saved-item a { min-height: 44px; justify-content: center; }
  .saved-item .remove { min-width: 44px; min-height: 44px; }
  .btn-link { min-height: 32px; }
  .check { min-height: 44px; }
  .check input, .row input[type="checkbox"] { width: 22px; height: 22px; margin: 0; }
  .tree .row { min-height: 48px; }
  .tree-head .sort { min-height: 36px; }
  .key a { padding: 8px 0; }
  .site-footer { gap: 0 8px; padding: 2px 12px; }
  .site-footer a, .site-footer > span { display: inline-flex; align-items: center; min-height: 32px; padding: 0 4px; }
  .legal-back { min-height: 44px; }
  .legal-tab { display: inline-flex; align-items: center; min-height: 40px; }
  .toast-close { min-width: 40px; min-height: 40px; }
}

/* Phones (and short landscape phones): the footer scrolls with the page, so it doesn't take screen space from the results. */
@media (max-height: 500px), (max-width: 700px) {
  .site-footer { position: static; }
  .selection-bar { bottom: 0; }
  .toasts { bottom: 12px; }
}

/* Tablets in portrait and phones */
@media (max-width: 700px) {
  main { padding: 12px; }
  .topbar { padding: 0 12px; }
  /* Menus in the top bar open as a sheet across the screen, not off its edge. */
  .support-panel, .account-menu:not(.version-menu) > .menu-panel {
    position: fixed; top: calc(var(--topbar-h) + 6px); left: 12px; right: 12px; width: auto; min-width: 0;
    max-height: calc(100vh - var(--topbar-h) - 24px);
  }
  .version-menu .whats-new { left: 12px; right: 12px; }
  .panel { padding: 12px; }
  .welcome { padding: 18px 16px 16px; }
  .legal { padding: 8px 16px 20px; }
  .legal-nav .grow { display: none; }
  .legal-back { width: 100%; }

  /* Search panel: one column, the field on its own line, Search and Save filter side by side. */
  .search-panel { grid-template-columns: 1fr 1fr; }
  .search-panel label[for="jql"] { grid-column: 1 / -1; grid-row: 1; }
  .jql-entry { grid-column: 1 / -1; grid-row: 2; }
  #search-button { grid-column: 1; grid-row: 3; }
  #save-filter { grid-column: 2; grid-row: 3; }
  .saved-menu { grid-column: 1 / -1; grid-row: 4; }
  .saved-panel { left: 0; right: 0; width: auto; }
  .search-panel > .quick { grid-column: 1 / -1; }
  .search-panel > .quick:not(.recent) { grid-row: 5; }
  .search-panel > .quick.recent { grid-row: 6; }
  .search-panel > .templates-link { grid-column: 1 / -1; grid-row: 7; justify-self: stretch; }
  .search-panel > .search-status { grid-row: 8; }
  .quick > .filter-label:first-child { width: 100%; }
  .chip, .recent-filter { max-width: 100%; }

  /* Results toolbar and filters: buttons share the width, the filters stack. */
  #tree > .toolbar .grow { flex-basis: 100%; height: 0; }
  #tree > .toolbar .btn { flex: 1 1 calc(50% - 10px); }
  .filter-bar input[type="search"] { flex: 1 1 100%; width: 100%; }
  .filter-bar select { flex: 1 1 calc(50% - 8px); max-width: none; }
  .filter-bar .grow { display: none; }

  /* Selection bar: what's selected on one line, the print buttons on the next. */
  .selection-bar { flex-wrap: wrap; gap: 8px 12px; margin: 10px -12px -12px; padding: 10px 12px; }
  .selection-bar .grow { flex-basis: 100%; height: 0; }
  .selection-bar #print-hint { display: none; }
  .selection-bar .btn { flex: 1 1 0; }
  .toasts { left: 12px; right: 12px; }
  .toast { min-width: 0; max-width: none; }
}

/* Phones */
@media (max-width: 600px) {
  /* The tree keeps the checkbox, key and summary; nesting steps get smaller. */
  :root { --cols: 32px minmax(96px, auto) minmax(0, 1fr); }
  .row { gap: 6px; }
  .row > span:nth-child(n + 4) { display: none; }
  .depth-1 { padding-left: 10px; } .depth-2 { padding-left: 20px; } .depth-3 { padding-left: 30px; } .depth-4 { padding-left: 40px; }
  .depth-5, .depth-6, .depth-7, .depth-8 { padding-left: 48px; }
}
@media (max-width: 420px) {
  .brand-for { display: none; }
  .topbar .brand { gap: 8px; }
  .howto-art { max-height: 130px; }
}

/* Usage page (usage.html, app owner only). */
.usage { max-width: 1120px; margin: 0 auto 16px; padding: 8px 32px 24px; }
.usage-periods { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; font-size: 14px; }
.usage-scroll { overflow-x: auto; }
.usage-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.usage-table th, .usage-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.usage-table thead th { color: var(--muted); font-weight: 600; }
.usage-table th[scope="row"] { font-weight: 600; }
@media (max-width: 640px) {
  .usage { padding: 8px 16px 20px; }
  .usage-periods .legal-tab { display: inline-flex; align-items: center; min-height: 40px; }
}

/* The Usage link in the top bar, for the admin accounts only (_admin_link.html). Same shape as the support button. */
.topbar-link { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px; color: #fff; font-size: 13px; }
.topbar-link:hover, .topbar-link[aria-current="page"] { background: rgba(255, 255, 255, 0.15); text-decoration: none; }
.topbar-link .icon { width: 15px; height: 15px; }
@media (max-width: 700px) {
  .topbar-link { min-height: 44px; }
  .topbar-link-label { display: none; }
}

/* Privacy page: download your own data as a readable .txt or a JSON file (routes.your_data_download). */
.data-downloads { display: flex; flex-wrap: wrap; gap: 8px; }

/* Usage page: jump to a date (the browser's date picker), and Older / Newer under the table (usage.html). */
.usage-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 14px; }
.usage-jump input[type="date"] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; color: inherit; background: var(--panel); }
.usage-pager { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.usage-pager .grow { flex: 1; }
.usage-table .usage-period { text-align: left; }
@media (max-width: 640px) {
  .usage-jump input[type="date"], .usage-jump .btn, .usage-pager .btn { min-height: 44px; }
}
