/* Game Art Studio — dark neutral theme, desktop-first, phone-usable. */

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

:root {
  --bg: #151619;
  --surface: #1e2024;
  --surface-2: #26292e;
  --border: #33373d;
  --text: #e8e8ea;
  --muted: #9a9ea6;
  --accent: #6aa9ff;
  --accent-strong: #3b82f6;
  --danger: #ef5350;
  --ok: #4caf50;
  --warn: #f5b942;
  --teal: #2bb3a3;
  --checker-a: #2a2d33;
  --checker-b: #3a3e46;
  --radius: 10px;
  --tap: 40px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

html, body { background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* Header */
header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 56px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--accent); }
.header-nav { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-cost { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.header-cost.over { color: var(--danger); font-weight: 600; }
.header-cost.warn { color: var(--warn); }
.header-link { padding: 8px 6px; min-height: var(--tap); display: inline-flex; align-items: center; }
.header-user { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }

h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 12px; }
.subtitle { color: var(--muted); margin-bottom: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.breadcrumb { color: var(--muted); font-size: 0.9rem; margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 8px 14px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn-primary:hover { background: #2f6fd6; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--border); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
/* Compact look, but never below the --tap target size (finding: 34 px). */
.btn-sm { min-height: var(--tap); padding: 6px 12px; font-size: 0.9rem; }

input[type="text"], input[type="password"], textarea, select {
  width: 100%; min-height: var(--tap); padding: 8px 12px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
textarea { resize: vertical; min-height: 88px; line-height: 1.4; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row > .field { flex: 1 1 160px; margin-bottom: 0; }
.row > .field.grow { flex: 3 1 260px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.error { color: var(--danger); font-size: 0.9rem; margin-top: 8px; }
.notice { color: var(--muted); font-size: 0.9rem; }
.notice.saved { color: var(--ok); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* Panels / cards */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.panel summary { cursor: pointer; font-weight: 600; font-size: 1.05rem; list-style: none; display: flex; align-items: center; gap: 8px; min-height: var(--tap); }
.panel summary::-webkit-details-marker { display: none; }
.panel summary::before { content: '▸'; color: var(--muted); transition: transform 0.15s; }
.panel[open] summary::before { transform: rotate(90deg); }
.panel[open] summary { margin-bottom: 14px; }
.panel summary .notice { font-weight: 400; margin-left: auto; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 6px; color: var(--text);
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card .title { font-weight: 600; font-size: 1.05rem; }
.card .meta { color: var(--muted); font-size: 0.9rem; display: flex; gap: 10px; flex-wrap: wrap; }
.card.new { align-items: stretch; justify-content: center; border-style: dashed; }

/* Checkerboard behind every image so transparency is visible at a glance. */
.checker {
  background-color: var(--checker-a);
  background-image:
    linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%),
    linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.pill.tp { border-color: var(--teal); color: var(--teal); }
.pill.op { border-color: var(--border); color: var(--muted); background: var(--surface-2); }

/* Set / motif tiles */
.tile { padding: 0; overflow: hidden; }
.tile .thumb {
  aspect-ratio: 1; width: 100%; background: var(--surface-2); position: relative;
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.9rem;
}
.tile .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile .thumb .spinner.overlay { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-width: 2px; }
.mosaic { width: 100%; height: 100%; display: grid; gap: 2px; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; background: var(--border); }
.mosaic img { width: 100%; height: 100%; object-fit: cover; min-height: 0; }
.mosaic.n1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.mosaic.n2 { grid-template-rows: 1fr; }
.mosaic.n3 img:first-child { grid-row: 1 / span 2; }
.tile .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em;
}
.pill.q-low { border-color: #557; }
.pill.q-medium { border-color: #5a7; }
.pill.q-high { border-color: var(--warn); color: var(--warn); }

/* Style refs */
.refs { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.ref { position: relative; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.ref img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 40 px hit area with a 28 px visible disc (drawn as a radial gradient). */
.ref .ref-del {
  position: absolute; top: -2px; right: -2px; width: var(--tap); height: var(--tap); border-radius: 50%;
  border: none; padding: 0; color: #fff; cursor: pointer; font-size: 1rem; line-height: 1;
  background: radial-gradient(circle, rgba(0,0,0,0.65) 0 14px, transparent 14.5px);
}
.ref-upload { width: 96px; height: 96px; border: 1px dashed var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; font-size: 1.6rem; }
.ref-upload:hover, .ref-upload:focus-visible { border-color: var(--accent); color: var(--accent); }
.ref-upload:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ref .ref-del:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.ref-upload input { display: none; }

/* Gallery */
.gallery { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.gen {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; cursor: pointer; position: relative;
}
.gen:hover { border-color: var(--accent); }
.gen:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.gen.favorite { border-color: var(--warn); }
.gen .thumb { aspect-ratio: 1; background: var(--surface-2); display: flex; align-items: center; justify-content: center; padding: 0; }
.gen .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gen.wide .thumb { aspect-ratio: 3 / 2; }
.gen.tall .thumb { aspect-ratio: 2 / 3; }
.gen .body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.gen .badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.gen .cost { margin-left: auto; font-variant-numeric: tabular-nums; }
.gen .who { color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.gen.failed { border-color: var(--danger); }
.gen.failed .thumb { color: var(--danger); font-size: 0.85rem; padding: 12px; text-align: center; align-items: flex-start; overflow: auto; }
.gen .star { position: absolute; top: 8px; left: 8px; color: var(--warn); font-size: 1.2rem; text-shadow: 0 0 4px #000; z-index: 1; }
.gen .prompt-line { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Variants hang below their source: accent connector on the left + chip. */
.gen.variant { border-left: 3px solid var(--accent); }
.gen.variant::before { content: ''; position: absolute; left: -3px; top: -15px; width: 3px; height: 15px; background: var(--accent); }
.chip { display: inline-block; font-size: 0.75rem; color: var(--accent); background: rgba(106, 169, 255, 0.12); border-radius: 6px; padding: 1px 6px; align-self: flex-start; }

/* Delete button: 40 px target, trash icon, second click within 4 s confirms. */
.del-gen { min-width: var(--tap); min-height: var(--tap); padding: 6px; color: var(--muted); gap: 4px; }
.del-gen:hover { color: var(--danger); border-color: var(--danger); }
.del-gen.armed { background: var(--danger); border-color: var(--danger); color: #fff; padding: 6px 12px; font-size: 0.85rem; }
.gen .del-gen.on-card { position: absolute; top: 6px; right: 6px; z-index: 1; background: rgba(15, 16, 18, 0.72); border-color: transparent; }
.gen .del-gen.on-card:hover { border-color: var(--danger); }
.gen .del-gen.on-card.armed { background: var(--danger); }

.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.thumb .state { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); font-size: 0.85rem; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.82);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.lightbox-inner {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  width: min(1100px, 100%); max-height: 100%; overflow: auto; box-shadow: var(--shadow);
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
}
.lightbox-img { display: flex; align-items: center; justify-content: center; min-height: 240px; }
.lightbox-img img { max-width: 100%; max-height: 80vh; display: block; }
.lightbox-side { padding: 16px; display: flex; flex-direction: column; gap: 10px; border-left: 1px solid var(--border); }
.lightbox-side .close { align-self: flex-end; }
.lightbox-side .btn { width: 100%; }
.lightbox-side .lb-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lightbox-side .lb-top .close { width: auto; }
.lightbox-side .lb-id { font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lightbox-side .badges { display: flex; gap: 6px; flex-wrap: wrap; }
.lightbox-side .lb-del { margin-top: auto; }

/* Download menu */
.dl-menu summary { list-style: none; }
.dl-menu summary::-webkit-details-marker { display: none; }
.dl-menu .menu { margin-top: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); overflow: hidden; }
.dl-menu .menu-item { display: flex; align-items: center; min-height: var(--tap); padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--border); }
.dl-menu .menu-item:hover { background: var(--surface-2); text-decoration: none; }
.dl-menu .custom-size { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 0.85rem; }
.dl-menu .menu-label { color: var(--muted); }
.dl-menu .size-row { display: flex; align-items: center; gap: 6px; }
.dl-menu .size-row input { width: 100%; min-width: 0; min-height: var(--tap); padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.dl-menu .check { display: flex; align-items: center; gap: 8px; min-height: var(--tap); color: var(--text); font-size: 0.85rem; margin: 0; cursor: pointer; }
.dl-menu .check input { width: 18px; height: 18px; }
.dl-menu .btn.disabled { opacity: 0.5; pointer-events: none; }
.dl-menu .error { margin: 0; }
.lightbox-side dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 0.85rem; color: var(--muted); }
.lightbox-side dd { color: var(--text); }
.lightbox-side pre { white-space: pre-wrap; font-size: 0.8rem; background: var(--bg); padding: 10px; border-radius: 8px; max-height: 240px; overflow: auto; }
.variant-form { display: flex; flex-direction: column; gap: 8px; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 600; border-bottom: none; }
.tables { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 20px; }
.tables .panel { margin-bottom: 0; }
.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav .btn { min-width: var(--tap); }
.month-nav .month { font-weight: 600; min-width: 130px; text-align: center; }
.totals { font-size: 1.4rem; font-weight: 700; margin: 8px 0 18px; }
.totals small { font-size: 0.9rem; color: var(--muted); font-weight: 400; }
.status-done { color: var(--ok); }
.status-failed { color: var(--danger); }
.status-queued, .status-running { color: var(--warn); }

/* Login */
.login { max-width: 360px; margin: 12vh auto 0; }
.login h1 { text-align: center; margin-bottom: 20px; }
.login .btn { width: 100%; margin-top: 6px; }

/* Toast */
#toast-root { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--surface-2); border: 1px solid var(--border); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: 0.9rem; }
.toast.err { border-color: var(--danger); }

@media (max-width: 720px) {
  header { padding: 0 12px; gap: 8px; }
  .header-user { display: none; }
  main { padding: 14px 12px 50px; }
  .lightbox { padding: 0; align-items: stretch; }
  .lightbox-inner { grid-template-columns: 1fr; border-radius: 0; width: 100%; }
  .lightbox-side { border-left: none; border-top: 1px solid var(--border); }
  .lightbox-img img { max-height: 55vh; }
  .grid, .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Stil-Werkstatt ─────────────────────────────────────────────────────── */
.ws-tile .thumb { aspect-ratio: 3 / 2; }
.ws-assign { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.ws-assign select { width: auto; max-width: 180px; }
.ws-round { padding: 14px 16px; }
.ws-round-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 12px; }
.ws-round-head h2 { margin: 0; }
.ws-round-head .notice { font-weight: 400; }
.ws-round-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.ws-quote { color: var(--text); }
.ws-parents a { margin: 0 1px; }
.ws-gallery { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.ws-cand .thumb { aspect-ratio: 3 / 2; }
.ws-axes { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
/* Select checkbox overlay: 40 px hit area, stops the card click. */
.ws-select {
  position: absolute; top: 6px; left: 6px; z-index: 1; width: var(--tap); height: var(--tap); margin: 0;
  display: flex; align-items: center; justify-content: center; border-radius: 8px; background: rgba(15, 16, 18, 0.72); cursor: pointer;
}
.ws-select input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.ws-select input:disabled { cursor: default; opacity: 0.4; }
.ws-select:has(input:focus-visible) { outline: 2px solid var(--accent); }

/* Refine bar: sticky at the bottom of the workspace. */
.ws-refine { position: sticky; bottom: 0; z-index: 15; box-shadow: var(--shadow); margin-top: 8px; }
.ws-refine[open] { max-height: min(75vh, 620px); overflow: auto; }
.ws-refine summary .notice { margin-left: auto; text-align: right; }
.ws-selected { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; min-height: var(--tap); }
.ws-sel { position: relative; width: 96px; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--accent); background: var(--surface-2); }
.ws-sel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ws-sel .ref-del {
  position: absolute; top: -2px; right: -2px; width: var(--tap); height: var(--tap); border-radius: 50%;
  border: none; padding: 0; color: #fff; cursor: pointer; font-size: 1rem; line-height: 1;
  background: radial-gradient(circle, rgba(0,0,0,0.65) 0 14px, transparent 14.5px);
}
.ws-sel .ref-del:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.ws-chips { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.chip-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip-label { font-size: 0.85rem; color: var(--muted); min-width: 96px; }
.chip-btn {
  min-height: var(--tap); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.9rem; cursor: pointer;
}
.chip-btn:hover { border-color: var(--accent); }
.chip-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-btn[aria-pressed="true"] { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.chip-free { min-width: 32px; }
.ws-controls { align-items: flex-end; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg); }
.stepper button { min-width: var(--tap); min-height: var(--tap); border: none; background: var(--surface-2); color: var(--text); font: inherit; font-size: 1.2rem; cursor: pointer; }
.stepper button:hover { color: var(--accent); }
.stepper button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.stepper span { min-width: 40px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.ws-check { display: flex; align-items: center; gap: 8px; min-height: var(--tap); color: var(--text); font-size: 0.9rem; margin: 0; cursor: pointer; }
.ws-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.ws-estimate { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Finish dialog (same overlay as the lightbox). */
.ws-dialog {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  width: min(720px, 100%); max-height: 100%; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.ws-dialog .lb-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ws-dialog textarea { min-height: 110px; }
.ws-refpick { display: flex; flex-wrap: wrap; gap: 8px; }
.ws-refpick label { position: relative; width: 132px; height: 88px; border-radius: 8px; overflow: hidden; border: 2px solid var(--border); cursor: pointer; margin: 0; }
.ws-refpick label.on { border-color: var(--accent); }
.ws-refpick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ws-refpick input { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }
.ws-refpick label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.ws-target { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.ws-target legend { padding: 0 6px; color: var(--muted); font-size: 0.85rem; }
.radio-row { display: flex; align-items: center; gap: 8px; min-height: var(--tap); color: var(--text); font-size: 0.95rem; margin: 0; cursor: pointer; }
.radio-row input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.ws-target select:disabled, .ws-target input:disabled { opacity: 0.5; }

@media (max-width: 720px) {
  .ws-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chip-label { min-width: 100%; }
  .ws-assign select { max-width: 130px; }
  .ws-dialog { border-radius: 0; padding: 14px; }
}

/* Narrow phones: five header items must fit 375 px without horizontal overflow. */
@media (max-width: 480px) {
  header { gap: 8px; }
  .brand { font-size: 0.9rem; }
  .header-nav { gap: 6px; }
  .header-link { padding: 8px 4px; font-size: 0.9rem; }
  #logout-btn { padding: 6px 8px; font-size: 0.85rem; }
}
@media (max-width: 420px) {
  /* Icon-only logout keeps the budget indicator visible; the text stays as accessible name. */
  #logout-btn { font-size: 0; min-width: var(--tap); padding: 6px; }
  #logout-btn::before { content: '⏻'; font-size: 1.1rem; line-height: 1; }
}
