/* Boxer — base theme, layout, shared components (frontend-board) */

:root {
  --bg: #0d1117;
  --bg-elevated: #11161d;
  --panel: #161b22;
  --panel-2: #1c222b;
  --border: #30363d;
  --border-soft: #21262d;
  --text: #e6edf3;
  --muted: #8b949e;
  --muted-2: #6e7681;
  --accent: #58a6ff;
  --accent-strong: #388bfd;
  --kind-story: #f0883e;
  --kind-task: #58a6ff;
  --danger: #f85149;
  --warn: #d29922;
  --ok: #3fb950;
  --accent-codex: #a371f7;
  --shadow: 0 8px 24px rgba(1, 4, 9, 0.6);
  --radius: 6px;
  --radius-lg: 10px;
  --taskbar-h: 36px;
  font-size: 14px;
  color-scheme: dark; /* native scrollbars, selects and form controls render dark */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* scrollbar-width is not inherited, so the viewport rule above does not reach nested scroll areas */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* Older Chromium/Edge: Chromium 121+ honours scrollbar-color above and ignores these */
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: content-box;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: content-box; }
  ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
  ::-webkit-scrollbar-corner { background: transparent; }
}

/* keyboard-focusable scroll regions (.spend-table-wrap): themed ring instead of the browser's white one */
[tabindex="0"][role="region"]:focus { outline: none; }
[tabindex="0"][role="region"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Ubuntu, Roboto, Helvetica, Arial, sans-serif;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* phones: the visible height, so the taskbar is not under the browser's own bar */
  overflow: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, .mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ---------- Top bar ---------- */

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  min-height: 52px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

#topbar-left, #topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* phones (#200): the bar grows to as many rows as its controls need, so nothing is clipped and no
   horizontal scroll is needed; the views below and #window-layer follow its real height (--topbar-h) */
@media (max-width: 760px) {
  #topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 6px 10px;
    gap: 6px 10px;
    justify-content: flex-start;
  }
  #topbar-left, #topbar-right { flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
  #topbar-right { flex: 1 1 100%; }
  #repo-switcher { margin-right: 0; }
  #repo-name { max-width: 40vw; }
  .tab { padding: 6px 9px; }
  /* a wrapped trigger can sit anywhere in the row: its menu spans the viewport under the bar instead */
  #topbar .menu, #topbar #repo-switcher .menu { /* the id beats `#repo-switcher .menu { left: 0; right: auto }` below */
    position: fixed;
    top: calc(var(--topbar-h, 52px) + 4px);
    left: 8px;
    right: 8px;
    min-width: 0;
    max-width: calc(100vw - 16px);
    box-sizing: border-box;
  }
}

#repo-name {
  color: var(--muted);
  font-size: 13px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#repo-name:empty { display: none; }

/* project switcher: plain text until /api/instances reports another instance (instances_ui.js) */
#repo-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}
#repo-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: inherit;
  font: inherit;
  cursor: default;
}
#repo-switch-btn.switchable { padding: 3px 6px; margin: -3px -6px; cursor: pointer; }
#repo-switch-btn.switchable:hover, #repo-switch-btn.switchable:focus-visible { background: var(--panel-2); outline: none; }
#repo-switch-btn.switchable:hover #repo-name { color: var(--text); }
#repo-switch-caret { color: var(--muted); font-size: 11px; }
#repo-switcher .menu { left: 0; right: auto; }
.menu-item.instance-item { display: flex; align-items: center; gap: 8px; }
.instance-item .instance-check { width: 12px; color: var(--ok); }
.instance-item .instance-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.instance-item.current .instance-name { font-weight: 600; }
.instance-item .instance-port { color: var(--muted); font-size: 12px; min-width: 6ch; text-align: right; }
.instance-item .instance-badge { display: inline-flex; width: 16px; }  /* keeps the ports aligned */
/* a backend the relay knows but that is not connected: listed, greyed out, not switchable (instances_ui.js) */
.instance-item.offline { opacity: 0.55; cursor: default; }
.instance-item.offline:hover, .instance-item.offline:focus-visible { background: none; }
.instance-item.offline .instance-port { min-width: 0; }

/* remote access chips (remote.js): "Remote · read-only|write" through the relay, "Relayed · N viewers" when direct */
.remote-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.remote-chip[hidden], #remote-chip-wrap[hidden] { display: none; }
.remote-chip:hover, .remote-chip:focus-visible { border-color: var(--muted-2); outline: none; }
.remote-chip.is-write { color: var(--warn); border-color: var(--warn); }
.relayed-chip.state-connected { color: var(--ok); }
.relayed-chip.state-connecting { color: var(--warn); }
.relayed-chip.state-refused, .relayed-chip.state-error { color: var(--danger); }
.remote-menu { min-width: 180px; }

/* the password dialog: a modal without a way out except the login (remote.js) */
.remote-login { min-width: min(360px, calc(100vw - 32px)); }
.remote-login input { width: 100%; box-sizing: border-box; }
.remote-login-error { min-height: 1.2em; color: var(--danger); font-size: 13px; }
/* the settings-password pop-up (#197): Cancel or the password, once per settings change */
.remote-settings-password { min-width: min(380px, calc(100vw - 32px)); }
.remote-settings-password input { width: 100%; box-sizing: border-box; }
.remote-settings-password-error { min-height: 1.2em; color: var(--danger); font-size: 13px; }
.remote-settings-password-row input { margin-top: 4px; }
.remote-access-section .modal-row input[type=password], .remote-access-section .modal-row input[type=text] { width: 100%; box-sizing: border-box; }
.remote-access-section .remote-status { margin: 8px 0; }
.remote-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 2px 0 8px; background: var(--muted-2); vertical-align: middle; }
.remote-dot.state-connected { background: var(--ok); }
.remote-dot.state-connecting { background: var(--warn); }
.remote-dot.state-refused, .remote-dot.state-error { background: var(--danger); }
.remote-summary-text { color: var(--muted); font-size: 12px; }
.remote-status-block { border: 1px solid var(--border, var(--muted-2)); border-radius: 6px; padding: 8px 10px; margin: 8px 0; font-size: 13px; }
.remote-state-line .remote-dot { margin-left: 0; margin-right: 6px; }
.remote-status-row { display: flex; gap: 8px; margin-top: 4px; }
.remote-status-label { flex: 0 0 120px; color: var(--muted); }
.remote-status-value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#logo {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.2px;
  color: var(--text);
  margin-right: 6px;
  user-select: none;
}

#view-tabs { display: flex; gap: 2px; }

.tab {
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}
.tab:hover { color: var(--text); text-decoration: none; background: var(--panel-2); }
.tab.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--border); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}
.pill.state-running { color: var(--ok); }
.pill.state-running::before { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.pill.state-paused { color: var(--warn); }
.pill.state-paused::before { background: var(--warn); }
.pill.state-idle { color: var(--muted); }

.badge {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge.runner-copilot,
.badge.runner-claude { color: var(--accent); border-color: var(--accent-strong); }
.badge.runner-codex { color: var(--accent-codex); border-color: var(--accent-codex); }
.badge.runner-mixed { color: var(--text); border-color: var(--muted-2); } /* several runners in play */

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--border-soft); border-color: var(--muted-2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}
.btn-primary:hover { background: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-icon { font-size: 15px; padding: 6px 9px; line-height: 1; }
.btn-sm { padding: 3px 8px; font-size: 12px; }

/* ---------- Dropdown menu (top bar "Commands") ---------- */

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 150;
  min-width: 220px;
  max-width: 420px;
  max-height: 70vh;
  overflow: auto;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.menu-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-2); outline: none; }
.menu-empty { padding: 7px 10px; font-size: 13px; color: var(--muted); }
.menu-footer {
  margin-top: 4px;
  padding: 6px 10px 4px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
}
.menu-footer-title { color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.menu-error { color: var(--danger); margin-bottom: 3px; overflow-wrap: anywhere; }
.command-description { font-size: 13px; color: var(--muted); max-width: 70ch; }

.menu-section-title {
  margin-top: 4px;
  padding: 6px 10px 4px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.schedule-row { padding: 6px 10px 8px; }
.schedule-row + .schedule-row { border-top: 1px solid var(--border-soft); }
.schedule-line1 { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.schedule-label { font-weight: 600; }
.schedule-muted { color: var(--muted); font-size: 12px; }
.schedule-line2 { margin: 2px 0 6px; font-size: 12px; color: var(--muted); }
.schedule-line2 a { color: var(--accent); }
.schedule-failing { color: var(--warn); }
.schedule-line3 { display: flex; gap: 6px; }
.sched-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted-2); }
.sched-dot.ok { background: var(--ok); }
.sched-dot.danger { background: var(--danger); }
.sched-dot.muted { background: var(--muted-2); }
.sched-dot.running { background: var(--accent); animation: role-pulse 1.6s ease-in-out infinite; }
#commands-btn.commands-attention { border-color: var(--warn); }

#view-root {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* ---------- Role badges (shared by board + agents) ---------- */

.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  color: #06090d;
  border: 1px solid rgba(0,0,0,0.25);
  flex: none;
}
.role-badge.lit {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.08), 0 0 10px 1px currentColor;
  animation: role-pulse 1.6s ease-in-out infinite;
}
@keyframes role-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 4, 9, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  /* grows with its content (tables, grids), never below 520px on a normal window nor past the window edge */
  width: max-content;
  min-width: min(520px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: 86vh;
  overflow: auto;
  padding: 18px 20px;
}
.modal h2 {
  margin: 0 0 14px 0;
  font-size: 16px;
}
.modal-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.modal-row label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.modal-row.inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.modal-danger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.modal-danger-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.modal-danger-hint {
  flex-basis: 100%;
  max-width: 70ch;
  font-size: 12px;
  color: var(--muted);
}

input[type=text], input[type=number], input[type=password], textarea, select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent-strong); }

.ticket-kind-options {
  display: flex;
  align-items: center;
  gap: 16px;
}
.ticket-kind-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  cursor: pointer;
}

/* ---------- Model pickers (per-role defaults, per-ticket overrides) ---------- */

.model-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 12px;
}
.model-details > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.model-details > summary::marker { color: var(--muted); }
.model-details .modal-row { margin-bottom: 8px; }
.model-details .modal-row:first-child { margin-top: 10px; }
.model-details select { max-width: 100%; }
/* runner + model + effort side by side: a <select> is as wide as its longest option, so give the
   model picker the remaining width (and let it truncate) and the runner/effort pickers fixed ones */
.drawer-row.model-pair { flex-wrap: nowrap; gap: 6px; } /* beats board.css's later .drawer-row wrap */
.model-pair .runner-select { flex: 0 0 8.5em; width: 8.5em; }
.model-pair .model-select { flex: 1 1 auto; min-width: 0; width: 100%; }
.model-pair .effort-select { flex: 0 0 8.5em; width: 8.5em; }
.model-pair .model-select.is-unusable { border-color: var(--warn); }
.model-hint { font-size: 12px; color: var(--muted); max-width: 70ch; }
.model-hint.is-warn { color: var(--warn); } /* a role that kept its value after "Suggest with AI" */
/* a button waiting on a slow request ("Suggest with AI"): a small spinner before its label */
.btn.is-busy::before {
  content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
}
.btn.is-busy:disabled { opacity: 0.8; cursor: progress; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
/* "Model catalog" table (catalogEditor(), inside its own .model-details collapsible): the allow-list */
.model-catalog-wrap { overflow-x: auto; margin-top: 10px; } /* never widens the modal */
.catalog-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.catalog-filter.active { border-color: var(--accent); color: var(--text); }
.model-catalog td.model-id { white-space: nowrap; }
table.model-catalog {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.model-catalog th, .model-catalog td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.model-catalog th {
  font-weight: 600;
  color: var(--muted);
}
.model-catalog tbody tr:nth-child(even) { background: var(--bg-elevated); }
.model-catalog td:nth-child(4), .model-catalog td:nth-child(5) { white-space: normal; }
.model-catalog th:last-child, .model-catalog td:last-child { width: 1%; text-align: right; }
.model-catalog select.preferred-runner { font-size: 12px; padding: 2px 4px; } /* "runs on" (#121) */
/* Settings "CLI commands & isolation": one group per CLI, headed by its name + install chip */
.cli-group { margin-top: 10px; }
.cli-group + .cli-group { padding-top: 8px; border-top: 1px solid var(--border-soft); }
.cli-group-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; margin-bottom: 6px; }

/* ---------- Toasts ---------- */

#toast-root {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 400;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: var(--shadow);
  max-width: 360px;
  animation: toast-in 0.15s ease-out;
}
.toast.info { border-left-color: var(--accent); }
.toast.success { border-left-color: var(--ok); }
.toast.warning { border-left-color: var(--warn); cursor: pointer; }
@keyframes toast-in {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- Floating windows (windows.js, #144) ---------- */

/* below the top-bar menus (150), modals (200), banner (250), toasts (400) and tooltips (1000); the view
   behind stays usable wherever no window covers it */
#window-layer {
  position: fixed;
  top: var(--topbar-h, 52px); /* the measured bar height (app.js): it wraps taller on a phone */
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 140;
  pointer-events: none;
}
.window {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.window:focus { outline: none; } /* the top window's accent border marks it */
.window.is-focused { border-color: var(--accent); }
.window-titlebar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 4px 0 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-soft);
  cursor: move;
  touch-action: none;
  user-select: none;
}
.window-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.window.is-focused .window-title { color: var(--text); }
.window-keep,
.window-minimize,
.window-close {
  flex: none;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 2px 8px;
  cursor: pointer;
}
.window-keep:hover,
.window-minimize:hover,
.window-close:hover { color: var(--text); background: var(--panel-2); }
/* the "new window" toggle (#153): a kept window is never reused by a click */
.window-keep { font-size: 14px; padding: 2px 6px; }
.window-keep[aria-pressed="true"] { color: var(--accent); }
.window-minimize { font-size: 13px; }
/* minimized (#185): the node stays mounted (state, drafts and live updates keep running) but is hidden
   and out of the way of layout, focus and Escape; its taskbar button restores it */
.window.window-minimized { display: none; }
.window-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* resize grips: 6 px strips along the inside of each edge, 14 px squares at the corners */
.window-grip { position: absolute; z-index: 2; touch-action: none; }
.window-grip[data-edge="n"] { top: 0; left: 14px; right: 14px; height: 6px; cursor: ns-resize; }
.window-grip[data-edge="s"] { bottom: 0; left: 14px; right: 14px; height: 6px; cursor: ns-resize; }
.window-grip[data-edge="e"] { right: 0; top: 14px; bottom: 14px; width: 6px; cursor: ew-resize; }
.window-grip[data-edge="w"] { left: 0; top: 14px; bottom: 14px; width: 6px; cursor: ew-resize; }
.window-grip[data-edge="nw"] { top: 0; left: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.window-grip[data-edge="se"] { bottom: 0; right: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.window-grip[data-edge="ne"] { top: 0; right: 0; width: 14px; height: 14px; cursor: nesw-resize; }
.window-grip[data-edge="sw"] { bottom: 0; left: 0; width: 14px; height: 14px; cursor: nesw-resize; }
/* narrow screens: every window fills the layer (windows_core.js displayRect) */
#window-layer.narrow .window { border-radius: 0; }
#window-layer.narrow .window-grip { display: none; }
#window-layer.narrow .window-titlebar { cursor: default; }
body.window-dragging { user-select: none; }

/* ---------- Taskbar (windows.js, #185): one button per open window, bottom-of-page ---------- */

/* a normal flex child of #app (unlike the fixed #window-layer), so #view-root loses exactly this much
   height when it is shown; #window-layer gets the same space back via .has-taskbar below */
#taskbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--taskbar-h);
  padding: 0 8px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  overflow-x: auto;
}
#window-layer.has-taskbar { bottom: var(--taskbar-h); }
.taskbar-item {
  display: flex;
  align-items: center;
  flex: none;
  gap: 4px;
  max-width: 220px;
  height: 26px;
  padding: 0 4px 0 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}
.taskbar-item.is-focused { color: var(--text); border-color: var(--accent); background: var(--bg-elevated); }
.taskbar-item.is-minimized { opacity: 0.55; }
.taskbar-btn {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  gap: 6px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
}
.taskbar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  color: #06090d;
  flex: none;
}
.taskbar-badge-ticket { background: var(--kind-task); }
.taskbar-badge-agent { background: var(--accent-codex); }
.taskbar-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
}
.taskbar-close {
  flex: none;
  width: 18px;
  height: 18px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.taskbar-close:hover { color: var(--text); background: var(--border-soft); }

.empty-hint {
  color: var(--muted);
  font-size: 13px;
  padding: 24px;
  text-align: center;
}

/* hidden attribute must win over display rules */
[hidden] { display: none !important; }
