/* Design tokens from .planning/design/design_handoff_hub_zgloszen/DESIGN.md §1.1–1.4.
   The dark theme is the same variables with other values and nothing else: one
   set of components, two sets of numbers (DESIGN.md §7). */

:root {
  --bg-app: #F6F7F9;
  --bg-panel: #FFFFFF;
  --bg-panel-alt: #FAFBFC;
  --bg-subtle: #FAFBFC;
  --bg-chip: #F3F4F6;
  --bg-selected: #F7F9FF;
  --bg-accent-soft: #EFF4FF;
  --border: #E5E7EB;
  --border-subtle: #F0F1F4;
  --border-dashed: #C7CDD6;
  --border-control: #D7DBE2;
  --text-primary: #111827;
  --text-body: #1F2937;
  --text-secondary: #374151;
  --text-tertiary: #4B5563;
  --text-muted: #6B7280;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-text: #1D4ED8;
  --redmine: #4338CA;
  --danger: #DC2626;
  --danger-bg: #FEE2E2;
  --danger-text: #B91C1C;
  --warning: #D97706;
  --warning-bg: #FEF3C7;
  --warning-text: #92400E;
  --warning-on-white: #B45309;
  --success: #16A34A;
  --success-bg: #DCFCE7;
  --success-text: #15803D;
  --violet: #7C3AED;
  --row-hover: #FAFBFC;
  --chip-on-bg: #111827;
  --chip-on-text: #FFFFFF;
  --error-row: #FFF7F6;
  --shadow-window: 0 18px 40px rgba(15, 23, 42, 0.10);
  --shadow-overlay: 0 20px 44px rgba(15, 23, 42, 0.18);

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --titlebar-h: 40px;
  --rail-w: 214px;
  --list-w: 392px;
  --settings-nav-w: 230px;
}

[data-theme="dark"] {
  --bg-app: #0F1115;
  --bg-panel: #151922;
  --bg-panel-alt: #12151B;
  --bg-subtle: #12151B;
  --bg-chip: #222834;
  --bg-selected: #172032;
  --bg-accent-soft: #1E2531;
  --border: #262B36;
  --border-subtle: #1E232D;
  --border-dashed: #323846;
  --border-control: #2C323E;
  --text-primary: #E7EAF0;
  --text-body: #D5DAE3;
  --text-secondary: #B6BDC9;
  --text-tertiary: #AFB7C3;
  --text-muted: #9AA3B2;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-text: #93B4FF;
  --redmine: #4338CA;
  --danger: #EF4444;
  --danger-bg: #2E1618;
  --danger-text: #F87171;
  --warning: #FBBF24;
  --warning-bg: #2B2114;
  --warning-text: #FBBF24;
  --warning-on-white: #FBBF24;
  --success: #22C55E;
  --success-bg: #14261A;
  --success-text: #4ADE80;
  --violet: #C4B5FD;
  --row-hover: #1A1F29;
  --chip-on-bg: #2563EB;
  --chip-on-text: #FFFFFF;
  --error-row: #1F1416;
  --shadow-window: 0 18px 40px rgba(0, 0, 0, 0.45);
  --shadow-overlay: 0 20px 44px rgba(0, 0, 0, 0.55);
}

*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

/* One column for the whole window: the title bar, whatever flashes are showing
   and then the rest. The old rule took the title bar off the shell with a calc,
   which was right until a flash appeared above it — then the shell hung 53 px
   below the fold and the window grew a second scrollbar. Anything that lands
   between the bar and the shell is now simply another row. */
body {
  display: flex;
  flex-direction: column;
  margin: 0;
  height: 100%;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-body);
  background: var(--bg-app);
}

/* Scrollbars are the columns' own business, and on the dark theme the platform
   default is a bright strip down the middle of the screen. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-control) transparent;
}

a { color: var(--accent-text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Title bar. The window "lights" from the mockup are a macOS desktop build,
   which this is not, so the bar is 40 px and not 44 (DESIGN.md §2.1). */
.titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  height: var(--titlebar-h);
  padding: 0 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.titlebar__logo {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--accent);
  flex: none;
}

.titlebar__name {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-primary);
}

.titlebar__spacer { flex: 1; }

.search {
  width: 420px;
  height: 28px;
  padding: 0 10px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-body);
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.shell {
  display: grid;
  grid-template-columns: var(--rail-w) var(--list-w) 1fr;
  flex: 1;
  /* Without this the grid refuses to shrink below its content and the columns
     never get a scrollbar of their own. */
  min-height: 0;
}

.shell--settings {
  grid-template-columns: var(--settings-nav-w) 1fr;
}

.rail, .list {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.detail { background: var(--bg-app); overflow-y: auto; }

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.btn {
  height: 28px;
  padding: 0 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }

.btn--secondary {
  background: var(--bg-panel);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn--secondary:hover { background: var(--bg-subtle); border-color: var(--border-control); }

.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.mono { font-family: var(--font-mono); font-size: 11.5px; }

/* Sign-in. Not in the mockups — the mockups start after the login — so it is
   built from the same tokens and nothing more. */
.signin {
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 0;
}

.signin__card {
  width: 320px;
  padding: 22px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow-window);
}

.signin__card h1 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.field { margin-bottom: 12px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  font: inherit;
  color: var(--text-body);
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.alert {
  margin-bottom: 12px;
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 7px;
  background: var(--danger-bg);
  color: var(--danger-text);
}

.theme-switch {
  display: inline-flex;
  padding: 2px;
  background: var(--bg-chip);
  border-radius: 999px;
}

.theme-switch button {
  padding: 4px 10px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.theme-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Fields rendered by yiisoft/form-model pick these up through the theme
   configured in config/common/bootstrap.php. */

.field--invalid input,
.field--invalid select,
.field--invalid textarea { border-color: var(--danger); }

.field__error {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--danger-text);
}

.field__hint {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.field select,
.field textarea {
  width: 100%;
  padding: 7px 10px;
  font: inherit;
  color: var(--text-body);
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.flash {
  margin-bottom: 14px;
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.flash--success { background: var(--success-bg); color: var(--success-text); }
.flash--error { background: var(--danger-bg); color: var(--danger-text); }

/* Settings-shaped pages: one content column inside the shell. The three-column
   hub layout arrives in plan 09-05. */

.page {
  max-width: 940px;
  margin: 0 auto;
  padding: 20px;
}

/* A page that is not inside one of the shell's columns scrolls on its own. */
body > .page { flex: 1; min-height: 0; overflow-y: auto; }

.page--empty { text-align: center; padding-top: 80px; }

.page h1 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.page h2 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-primary);
}

.muted { color: var(--text-muted); font-size: 12.5px; }

.card {
  margin-bottom: 18px;
  padding: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.card--danger { border-color: var(--danger-bg); }

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.bar__spacer { flex: 1; }

.table { width: 100%; border-collapse: collapse; }

.table th {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-muted);
  background: var(--bg-panel-alt);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 9px 10px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: 0; }

.table--grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

.badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  background: var(--bg-chip);
  color: var(--text-tertiary);
}

.badge--active { background: var(--success-bg); color: var(--success-text); }
.badge--revoked { background: var(--danger-bg); color: var(--danger-text); }
.badge--server { background: var(--bg-accent-soft); color: var(--accent-text); }

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

.key code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-body);
}

.snippet {
  margin: 8px 0 0;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: pre;
  overflow-x: auto;
  color: var(--text-body);
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.inline-form { display: flex; align-items: flex-end; gap: 8px; }
.inline-form .field { flex: 1; margin-bottom: 0; }

.titlebar__nav { display: flex; gap: 4px; }

.titlebar__nav a {
  padding: 5px 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 7px;
}

.titlebar__nav a:hover { background: var(--bg-chip); }

.flashes { flex: none; max-width: 940px; margin: 10px auto 0; padding: 0 20px; }

/* ---------------------------------------------------------------------------
   The main view: project rail, report list, detail panel.
   Values from DESIGN.md §2.2, §2.3 and §2.4.
   --------------------------------------------------------------------------- */

.rail { display: flex; flex-direction: column; padding: 12px 10px; }

.rail__head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; }

.rail__add {
  width: 20px; height: 20px; line-height: 18px; text-align: center;
  color: var(--text-muted); text-decoration: none; border-radius: 6px; font-size: 15px;
}
.rail__add:hover { background: var(--bg-chip); color: var(--text-primary); }

.rail__list { display: flex; flex-direction: column; gap: 1px; }

.rail__item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 8px;
  font-size: 13px; color: var(--text-secondary); text-decoration: none;
}
.rail__item:hover { background: var(--bg-chip); }
.rail__item.is-active { background: var(--bg-accent-soft); color: var(--accent-text); font-weight: 600; }

.rail__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__eyebrow { padding: 16px 4px 6px; }
.rail__mockup { margin: 0 4px; font-size: 11.5px; color: var(--text-muted); }
.rail__foot { margin-top: auto; padding-top: 16px; }
.rail__sync { display: flex; align-items: center; gap: 6px; margin: 10px 4px 0; font-size: 11.5px; color: var(--text-muted); }

.dropzone {
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px; text-align: center;
  border: 1px dashed var(--border-dashed); border-radius: 9px;
}
.dropzone strong { font-size: 12px; color: var(--text-secondary); }
.dropzone span { font-size: 11px; color: var(--text-muted); }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 999px; flex: none; }
.dot--active { background: var(--accent); }
.dot--critical { background: var(--danger); }
.dot--quiet { background: var(--border-control); }
.dot--p-critical { background: var(--danger); }
.dot--p-high { background: var(--warning); }
.dot--p-medium, .dot--p-low { background: var(--text-muted); }

.count { padding: 1px 6px; font-size: 11px; font-weight: 600; border-radius: 999px; }
.count--accent { background: var(--accent); color: #fff; }
.count--critical { background: var(--danger-bg); color: var(--danger-text); }
.count--plain { color: var(--text-muted); }

/* --- list ---------------------------------------------------------------- */

.list { display: flex; flex-direction: column; }
.list--empty, .detail--empty { display: grid; place-items: center; text-align: center; padding: 24px; }

.list__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border-subtle);
}
.list__head strong { font-size: 14px; font-weight: 650; color: var(--text-primary); }
.list__count { margin-left: 6px; font-size: 14px; font-weight: 500; color: var(--text-muted); }

.list__filters summary { list-style: none; cursor: pointer; display: inline-block; line-height: 26px; }
.list__filters summary::-webkit-details-marker { display: none; }

.filters {
  position: absolute; z-index: 5; right: 0; margin-top: 6px; width: 360px; padding: 14px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-overlay);
}
.list__filters { position: relative; }
.filters__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters__set { margin: 8px 0 0; padding: 8px; border: 1px solid var(--border-subtle); border-radius: 8px; }
.filters__set legend { padding: 0 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.filters__check { display: inline-flex; align-items: center; gap: 5px; margin-right: 10px; font-size: 12.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 3px 9px; font: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--text-tertiary); background: var(--bg-chip);
  border: 0; border-radius: 999px; text-decoration: none; cursor: pointer;
}
.chip.is-on, .chip[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-text); }
.chip__count { opacity: 0.72; }

.list__day {
  margin: 0; padding: 4px 14px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-muted); background: var(--bg-subtle);
}

.list__empty { padding: 28px 14px; text-align: center; }
.list__more { margin: 12px 14px; }

.row {
  display: block; padding: 11px 14px; text-decoration: none;
  border-bottom: 1px solid var(--border-subtle); border-left: 3px solid transparent;
}
.row:hover { background: var(--row-hover); }
.row.is-selected { background: var(--bg-selected); border-left-color: var(--accent); }
.row.is-read { opacity: 0.72; }

.row__line1 { display: flex; align-items: baseline; gap: 7px; }
.row__title { flex: 1; font-size: 13.5px; font-weight: 600; line-height: 1.3; color: var(--text-primary); }
.row.is-selected .row__title { font-weight: 650; }
.row__time { font-size: 11px; color: var(--text-muted); }
.row__line2, .row__line3 { display: block; margin-left: 16px; margin-top: 3px; font-size: 11.5px; color: var(--text-muted); }
.row__line3 { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.badge--p-critical { background: var(--danger-bg); color: var(--danger-text); }
.badge--p-high { background: var(--warning-bg); color: var(--warning-text); }
.badge--p-medium, .badge--p-low { background: var(--bg-chip); color: var(--text-tertiary); }
.badge--s-new { background: var(--bg-accent-soft); color: var(--accent-text); }
.badge--s-resolved { background: var(--success-bg); color: var(--success-text); }
.badge--s-progress, .badge--s-rejected, .badge--s-duplicate { background: var(--bg-chip); color: var(--text-tertiary); }

.tag { font-size: 11px; color: var(--text-muted); }

.avatar {
  margin-left: auto; width: 20px; height: 20px; line-height: 20px; text-align: center;
  font-size: 9.5px; font-weight: 700; border-radius: 999px;
  background: var(--bg-accent-soft); color: var(--accent-text);
}

/* --- detail -------------------------------------------------------------- */

/* Sticky, because the tabs and the status control are what you reach for while
   reading, and a forty-six step report scrolled both off the top. */
.detail__head {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 20px 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}
.detail__ids { margin: 0 0 6px; color: var(--text-muted); }
.detail__title { margin: 0 0 10px; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; color: var(--text-primary); }
.detail__actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.detail__foot { margin: 10px 0 0; }

.btn--redmine { background: var(--redmine); color: #fff; }

.tabs { display: flex; gap: 14px; }
.tabs__tab {
  padding: 7px 0 8px; font-size: 13px; color: var(--text-secondary);
  text-decoration: none; border-bottom: 2px solid transparent;
}
.tabs__tab.is-active { color: var(--accent-text); font-weight: 650; border-bottom-color: var(--accent); }
.tabs__count { margin-left: 4px; font-size: 11px; color: var(--text-muted); }

.detail__body { padding: 18px 20px; }
.cards { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; }
.prose { font-size: 13.5px; line-height: 1.55; color: var(--text-body); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 12.5px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; overflow: hidden; text-overflow: ellipsis; }

.files { margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.files li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }

.thumbs, .gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.gallery { gap: 14px; }
.thumb { margin: 0; }
.thumb img { display: block; width: 168px; height: 104px; object-fit: cover; border: 1px solid var(--border); border-radius: 8px; }
.thumb__missing {
  display: grid; place-items: center; width: 168px; height: 104px;
  font-size: 11.5px; color: var(--text-muted);
  border: 1px dashed var(--border-dashed); border-radius: 8px;
}
.thumb figcaption { margin-top: 4px; font-size: 10.5px; color: var(--text-muted); }

.stream { margin: 8px 0 0; padding: 0; list-style: none; font-family: var(--font-mono); font-size: 11.5px; }
.stream__row { display: flex; gap: 10px; padding: 3px 6px; border-radius: 4px; }
.stream__row.is-failed { background: var(--error-row); }
.stream__row.is-pointed { outline: 2px solid var(--accent); outline-offset: 1px; }
.stream__time { width: 64px; flex: none; color: var(--text-muted); }
.stream__label { width: 84px; flex: none; overflow: hidden; text-overflow: ellipsis; }
.stream__label--step { color: var(--violet); }
.stream__label--console { color: var(--danger-text); font-weight: 700; }
.stream__label--network { color: var(--warning-on-white); }
/* The colour the design handoff assigns to `apache` is the token already here. */
.stream__label--server { color: var(--warning-on-white); font-weight: 700; }

.check { display: flex; align-items: center; gap: 7px; margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.stream__text { flex: 1; overflow-wrap: anywhere; color: var(--text-secondary); }
.stream--compact .stream__time { width: 62px; }

.sources { display: flex; gap: 4px; }

.table tr.is-failed td { background: var(--error-row); }

.raw {
  max-height: 420px; overflow: auto; margin: 0;
  padding: 12px; font-family: var(--font-mono); font-size: 11.5px;
  background: var(--bg-app); border: 1px solid var(--border); border-radius: 8px;
}

@media (max-width: 1180px) {
  .shell { grid-template-columns: 56px var(--list-w) 1fr; }
  .rail__name, .rail__mockup, .dropzone span { display: none; }
}

/* --- triage --------------------------------------------------------------
   The controls above the tabs, and the saved views in the rail (plan 09-07).
   Everything here goes out with the module when phase 10 lifts the panel into
   the PHP core, so it stays in one block rather than sprinkled above.
   ------------------------------------------------------------------------- */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.triage { display: flex; align-items: center; gap: 6px; flex: none; }
.triage__form { display: inline-flex; align-items: center; gap: 4px; margin: 0; }

/* Status and person read as one control each (DESIGN.md §2.4): a dot or an
   avatar, then the name, then the arrow. The native select stays underneath and
   keeps its keyboard, its focus ring and its disabled state — the pill is the
   border around it, not a replacement for it. */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-control); border-radius: 999px;
}
.pill:focus-within { border-color: var(--accent); }
.pill select {
  height: 24px; padding: 0 2px; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--text-primary); background: none; border: 0; cursor: pointer;
}
.pill select:focus { outline: none; }

.dot--s-new { background: var(--accent); }
.dot--s-progress { background: var(--warning); }
.dot--s-resolved { background: var(--success); }
.dot--s-rejected, .dot--s-duplicate { background: var(--text-muted); }

.avatar--sm { width: 18px; height: 18px; line-height: 18px; font-size: 9px; margin-left: 0; }
.avatar--empty { background: var(--bg-chip); color: var(--text-muted); }

/* The select posts on change; the button is what keeps it working without it. */
.triage__go { display: none; }
.no-js .triage__go, .triage__form:focus-within .triage__go { display: inline-block; }

/* "⋯" from the mockup: priority, the duplicate pointer, tags and the package
   downloads. Native <details>, because a menu that opens is one line of HTML
   and none of JavaScript. */
.menu { position: relative; }
.menu__button {
  display: grid; place-items: center;
  width: 28px; height: 28px; list-style: none; cursor: pointer;
  font-size: 15px; line-height: 1; color: var(--text-secondary);
  background: var(--bg-panel); border: 1px solid var(--border-control); border-radius: 7px;
}
.menu__button::-webkit-details-marker { display: none; }
.menu__button:hover { background: var(--bg-subtle); }

.menu__panel {
  position: absolute; right: 0; z-index: 20; width: 300px; margin-top: 6px; padding: 12px;
  text-align: left;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 11px; box-shadow: var(--shadow-overlay);
}
.menu__panel .eyebrow { display: block; margin: 10px 0 5px; }
.menu__panel .eyebrow:first-child { margin-top: 0; }
.menu__panel form { display: flex; gap: 5px; margin: 0; }
.menu__panel select, .menu__panel input {
  flex: 1; min-width: 0; height: 28px; padding: 0 7px; font: inherit; font-size: 12.5px;
  color: var(--text-primary); background: var(--bg-app);
  border: 1px solid var(--border-control); border-radius: 7px;
}
.menu__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.menu__tags form { display: inline-flex; }
.menu__tags:empty { display: none; }
.menu__links { display: flex; gap: 12px; font-size: 12.5px; }

.tag--on {
  padding: 2px 7px; font: inherit; font-size: 11px; cursor: pointer;
  color: var(--text-secondary); background: var(--bg-chip);
  border: 0; border-radius: 999px;
}
.tag--on:hover { color: var(--danger-text); background: var(--danger-bg); }

.triage__note {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 0; font-size: 11.5px;
}
.triage__note .badge a { color: inherit; }

.rail__item--view { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 13px; }
.rail__item--view:hover { background: var(--bg-chip); border-radius: 8px; }
.rail__item--view .rail__name { color: var(--text-secondary); text-decoration: none; }
.rail__item--view form { margin: 0; }

.rail__drop {
  padding: 0 4px; font: inherit; font-size: 13px; line-height: 1; cursor: pointer;
  color: var(--text-muted); background: none; border: 0;
}
.rail__drop:hover { color: var(--danger-text); }

.rail__save, .rail__rename form { display: flex; gap: 4px; margin: 6px 4px 0; }
.rail__save input, .rail__rename input, .rail__rename select {
  flex: 1; min-width: 0; height: 26px; padding: 0 6px; font: inherit; font-size: 12px;
  color: var(--text-primary); background: var(--bg-app);
  border: 1px solid var(--border-control); border-radius: 7px;
}
.rail__rename { margin: 8px 4px 0; font-size: 11.5px; color: var(--text-muted); }
.rail__rename summary { cursor: pointer; }
.rail__rename form { flex-wrap: wrap; margin-left: 0; margin-right: 0; }

/* --- settings screen -----------------------------------------------------
   DESIGN.md §3, checked against zrzuty/3-ustawienia-ciemny.png. Two of the
   five sections work; the rest are drawings, and everything inside them is
   disabled. The look is the same either way — that is the point of the plan.
   ------------------------------------------------------------------------- */

.settings-nav {
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  background: var(--bg-panel-alt);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.settings-nav__head { padding: 4px 8px 10px; }
.settings-nav__list { display: flex; flex-direction: column; gap: 1px; }

.settings-nav__item {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
}
.settings-nav__item:hover { background: var(--bg-chip); }
.settings-nav__item.is-active {
  background: var(--bg-accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.settings-nav__foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: auto;
  padding: 14px 8px 4px;
  border-top: 1px solid var(--border);
}

.settings-nav__foot .theme-switch { flex-wrap: wrap; }

.settings__body { overflow-y: auto; }

/* Settings content is left-aligned against the navigation, not centred in the
   window: the mockup's tables run the width of the screen. */
.settings__body .page { max-width: 1080px; margin: 0; }

/* The information bar every mockup section wears. Amber, not red: nothing is
   broken, it is simply not built. */
.mockup-note {
  margin: 0 0 16px;
  padding: 9px 11px;
  font-size: 12px;
  color: var(--warning-text);
  background: var(--warning-bg);
  border-radius: 8px;
}

.card--table { padding: 0; overflow: hidden; border-radius: 11px; }
.card__foot { margin: 0; padding: 12px 14px; border-top: 1px solid var(--border-subtle); }

.dot--ok { background: var(--success); }
.danger { color: var(--danger-text); }

/* Toggle: 34 × 19 px with a 15 px knob (DESIGN.md §3). Native checkbox
   underneath, so it keeps its label, its focus ring and its disabled state. */
.toggle {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 34px;
  height: 19px;
  margin: 0;
  background: var(--border-control);
  border-radius: 999px;
  cursor: pointer;
  transition: background 140ms ease-out;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  background: var(--text-muted);
  border-radius: 999px;
  transition: transform 140ms ease-out, background 140ms ease-out;
}
.toggle:checked { background: var(--accent); }
.toggle:checked::after { background: #fff; transform: translateX(15px); }
.toggle[disabled] { cursor: not-allowed; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 12.5px;
  color: var(--text-body);
}

.mapping {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px 10px;
}
.mapping .badge { justify-self: start; }
.mapping input {
  height: 28px;
  padding: 0 8px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-body);
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.chips--plain { padding: 0; border-bottom: 0; }
/* §3 wants the channel chips softer than the status chips of §2.3: the accent
   tint rather than the solid accent. Same component, two lines of difference. */
.chips--plain .chip.is-on { background: var(--bg-accent-soft); color: var(--accent-text); }

.btn--link { background: none; border: 0; color: var(--accent-text); padding: 0 4px; }
.btn--quiet { color: var(--text-muted); }

/* The notification toast of DESIGN.md §3. Rendered once, on the section that
   would configure it, because that is the only place it can be looked at. */
.toast {
  width: 330px;
  padding: 12px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-control);
  border-radius: 11px;
  box-shadow: var(--shadow-overlay);
}
.toast__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-primary);
}
.toast__text { margin: 0 0 8px; font-size: 12px; color: var(--text-muted); }
.toast__actions { display: flex; gap: 10px; }

.retention-form { display: flex; align-items: center; gap: 6px; margin: 0; }
.retention-form input[type="number"] {
  width: 76px;
  height: 26px;
  padding: 0 6px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-body);
  background: var(--bg-app);
  border: 1px solid var(--border-control);
  border-radius: 7px;
}

/* --- closing the gap to the handoff --------------------------------------
   Differences found by putting the running hub next to
   zrzuty/1-hub-widok-glowny.png: the title row of the detail panel, the two
   columns of the overview, card headers with their link on the right, and the
   title bar's own furniture.
   ------------------------------------------------------------------------- */

.search { position: relative; }
.search__box { position: relative; display: flex; align-items: center; }
.search__box .search { padding-right: 46px; }

.search__kbd {
  position: absolute; right: 7px;
  padding: 1px 5px; font-size: 10.5px; font-weight: 600;
  color: var(--text-muted); border: 1px solid var(--border-control); border-radius: 5px;
  pointer-events: none;
}

.titlebar__bell { position: relative; display: grid; place-items: center; width: 28px; height: 28px; }

.titlebar__badge {
  position: absolute; top: -2px; right: -4px; min-width: 15px;
  padding: 0 4px; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
  color: #fff; background: var(--danger);
  border: 2px solid var(--bg-panel); border-radius: 999px;
}

.titlebar .avatar { margin-left: 0; width: 28px; height: 28px; line-height: 28px; font-size: 11px; }

/* Filters open from a link, not from a button: the mockup gives the button
   weight to the actions, and this is a disclosure. */
.list__filters-toggle {
  list-style: none; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--accent-text);
}
.list__filters-toggle::-webkit-details-marker { display: none; }

.list__count { font-weight: 500; }

/* One wrapping row holds the identity line, the triage controls, the title and
   the triage note. `order` puts them where DESIGN.md §2.4 draws them without
   splitting the triage include into two places. */
.detail__top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.detail__ids { order: 1; flex: 1; min-width: 0; margin: 0; font-size: 11.5px; }
.detail__top .triage { order: 2; }
.detail__title { order: 3; flex-basis: 100%; margin: 0; }
.triage__note { order: 4; flex-basis: 100%; }

/* Two columns, each stacking its own cards. A single grid would pair them
   across the gap and put the environment next to the pictures. */
.cards { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; align-items: start; }
.cards__col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cards .card { margin-bottom: 0; }
.card--fill { display: flex; flex-direction: column; flex: 1; }

.card__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 8px;
}
.card__head .eyebrow { margin: 0; }
.card__head a { font-size: 12px; text-decoration: none; }
.card__head a:hover { text-decoration: underline; }

.card__foot-bar { margin: auto 0 0; padding-top: 12px; }
.card__foot-bar .btn { line-height: 26px; text-decoration: none; }

/* The overview picture: thumbnail beside its own metadata, time and trigger
   written on the image rather than under it. */
.screen { display: flex; gap: 12px; align-items: flex-start; }
.screen__meta { flex: 1; min-width: 0; font-size: 12.5px; }
.screen__meta .prose { margin: 0 0 6px; font-size: 12.5px; }
.screen__meta .mono { color: var(--text-muted); overflow-wrap: anywhere; }

.thumb--overlay { position: relative; }
.thumb--overlay figcaption {
  position: absolute; right: 5px; bottom: 5px;
  margin: 0; padding: 2px 6px;
  font-size: 10.5px; color: #fff;
  background: rgba(17, 24, 39, 0.78); border-radius: 5px;
}
.thumbs--rest { margin-top: 10px; }
.thumbs--rest .thumb img, .thumbs--rest .thumb__missing { width: 104px; height: 64px; }

.stream--ruled .stream__row { border-bottom: 1px solid var(--border-subtle); border-radius: 0; }
.stream--ruled .stream__row:last-child { border-bottom: 0; }

.files li { align-items: baseline; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border-subtle); }
.files li:last-child { border-bottom: 0; }
.files__glyph { flex: none; width: 18px; color: var(--text-muted); font-size: 11px; }
.files__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1400px) {
  .cards { grid-template-columns: 1fr; }
}

/* --- the picture viewer ---------------------------------------------------
   A screenshot opens over the report, not in another tab: DESIGN.md §2.4 asks
   for a full-screen preview, and losing the report to look at its own picture
   is the opposite of that. Native <dialog>, so Escape, the backdrop and the
   focus trap come from the browser instead of from a library.
   ------------------------------------------------------------------------- */

.viewer {
  width: 92vw;
  max-width: 1600px;
  padding: 0;
  color: var(--text-body);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-overlay);
}
.viewer::backdrop { background: rgba(8, 11, 16, 0.72); }

.viewer__head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--border-subtle);
}
.viewer__caption { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-muted); }

.viewer__nav, .viewer__close {
  display: grid; place-items: center;
  width: 28px; height: 28px; padding: 0; cursor: pointer;
  font: inherit; font-size: 14px; line-height: 1;
  color: var(--text-secondary); background: var(--bg-panel);
  border: 1px solid var(--border-control); border-radius: 7px;
}
.viewer__nav:hover, .viewer__close:hover { background: var(--bg-subtle); }
.viewer__nav[disabled] { opacity: 0.4; cursor: default; }

.viewer__frame { display: grid; place-items: center; padding: 12px; background: var(--bg-app); }
.viewer__frame img { max-width: 100%; max-height: 78vh; border-radius: 8px; }

/* The thumbnail is a link first, so it still opens without JavaScript and a
   middle click still works. The script only takes over the plain click. */
.thumb a { display: block; }
