/* ————————————————————————————————————————————————
   WUBV Projekte — Board
   Ruhiges Arbeits-Board. Gedeckte Paletten, warme Neutrals.
———————————————————————————————————————————————— */

:root {
  /* Surface */
  --bg:          oklch(97.5% 0.006 85);
  --bg-soft:     oklch(95% 0.008 85);
  --bg-paper:    oklch(99% 0.004 85);
  --ink:         oklch(22% 0.01 80);
  --ink-soft:    oklch(45% 0.012 80);
  --ink-faint:   oklch(62% 0.012 80);
  --rule:        oklch(88% 0.008 85);
  --rule-strong: oklch(78% 0.01 85);

  /* Tile palettes — desaturated, print-friendly */
  --sage-bg:  oklch(78% 0.075 150);   --sage-ink:  oklch(28% 0.05 150);
  --plum-bg:  oklch(55% 0.11 300);    --plum-ink:  oklch(98% 0.005 300);
  --lilac-bg: oklch(78% 0.06 310);    --lilac-ink: oklch(32% 0.05 310);
  --amber-bg: oklch(76% 0.13 55);     --amber-ink: oklch(30% 0.06 55);
  --steel-bg: oklch(70% 0.10 245);    --steel-ink: oklch(98% 0.005 245);
  --slate-bg: oklch(38% 0.015 260);   --slate-ink: oklch(96% 0.005 260);
  --brick-bg: oklch(50% 0.14 25);     --brick-ink: oklch(98% 0.005 25);
  --brick-soft-bg: oklch(78% 0.06 25);--brick-soft-ink: oklch(32% 0.05 25);

  /* Status colors (match the legend circles) */
  --st-W: oklch(70% 0.005 80);
  --st-K: oklch(32% 0.005 80);
  --st-P: oklch(55% 0.15 260);
  --st-U: oklch(55% 0.18 25);
  --st-L: oklch(58% 0.15 150);
  --st-O: oklch(60% 0.20 25);

  /* Flag colors */
  --login: oklch(50% 0.12 255);
  --paid:  oklch(55% 0.14 145);

  --shadow-sm: 0 1px 2px rgba(30,25,20,0.06), 0 1px 3px rgba(30,25,20,0.04);
  --shadow-md: 0 4px 14px rgba(30,25,20,0.08), 0 2px 4px rgba(30,25,20,0.05);
  --shadow-lg: 0 18px 40px rgba(30,25,20,0.14), 0 4px 10px rgba(30,25,20,0.08);

  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; }

/* ——————— App shell ——————— */
.app {
  display: grid;
  grid-template-rows: auto auto 1fr;
  height: 100vh;
}

/* ——————— Topbar ——————— */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: var(--bg-paper);
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: flex; align-items: baseline; gap: 10px;
  margin-right: auto;
}
.brand .mark {
  width: 14px; height: 14px; border-radius: 3px;
  background: var(--ink);
  display: inline-block;
}
.brand h1 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
.brand .sub {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.search {
  position: relative;
  width: 260px;
}
.search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-soft);
  font: inherit; font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 140ms, background 140ms;
}
.search input:focus { border-color: var(--rule-strong); background: #fff; }
.search .icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}
.search .kbd {
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  color: var(--ink-faint);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1px 5px;
}

.tool-btn {
  padding: 7px 12px;
  font-size: 12.5px;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 120ms, border-color 120ms;
}
.tool-btn:hover { background: #fff; border-color: var(--rule-strong); }
.tool-btn.primary {
  background: var(--ink);
  color: var(--bg-paper);
  border-color: var(--ink);
}
.tool-btn.primary:hover { background: #000; }

/* ——————— Filter bar ——————— */
.filterbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  background: var(--bg-paper);
  border-bottom: 1px solid var(--rule);
}
.filter-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 120ms;
}
.filter-pill:hover { color: var(--ink); background: var(--bg-soft); }
.filter-pill.active {
  background: var(--ink);
  color: var(--bg-paper);
  border-color: var(--ink);
}
.filter-pill .count {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}
.filter-pill .dot {
  width: 8px; height: 8px; border-radius: 2px;
}
.filter-pill .dot.login { background: var(--login); }
.filter-pill .dot.paid  { background: var(--paid); }
.filter-pill .dot.open  { background: repeating-linear-gradient(45deg, var(--ink-faint) 0 3px, transparent 3px 6px); }

.filterbar .sep {
  width: 1px; height: 22px;
  background: var(--rule);
  margin: 0 10px;
}

.legend {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.legend .lg .b {
  width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 9.5px; font-weight: 700;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ——————— Canvas ——————— */
.canvas-wrap {
  position: relative;
  overflow: auto;
  background:
    radial-gradient(circle at 1px 1px, oklch(82% 0.008 85) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bg);
}
.canvas {
  position: relative;
  width: 1520px;
  height: 900px;
}

/* ——————— Task tile ——————— */
.tile {
  position: absolute;
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 140ms, opacity 180ms, filter 180ms, transform 60ms;
  cursor: grab;
  user-select: none;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.06);
}
.tile:hover { box-shadow: var(--shadow-md); }
.tile.dragging { cursor: grabbing; box-shadow: var(--shadow-lg); z-index: 100; }
.tile.selected { outline: 2px solid var(--ink); outline-offset: 2px; }
.tile.dimmed { opacity: 0.18; filter: saturate(0.3); }
.tile.match-highlight {
  box-shadow: var(--shadow-md), 0 0 0 2px oklch(70% 0.15 90);
}

/* color variants */
.tile.c-sage  { background: var(--sage-bg);  color: var(--sage-ink); }
.tile.c-plum  { background: var(--plum-bg);  color: var(--plum-ink); }
.tile.c-lilac { background: var(--lilac-bg); color: var(--lilac-ink); }
.tile.c-amber { background: var(--amber-bg); color: var(--amber-ink); }
.tile.c-steel { background: var(--steel-bg); color: var(--steel-ink); }
.tile.c-slate { background: var(--slate-bg); color: var(--slate-ink); }
.tile.c-brick { background: var(--brick-bg); color: var(--brick-ink); }
.tile.c-brick-soft { background: var(--brick-soft-bg); color: var(--brick-soft-ink); }

.tile .title {
  font-size: 13px;
  font-weight: 550;
  line-height: 1.25;
  letter-spacing: -0.005em;
  text-wrap: pretty;
  flex: 1;
  padding-right: 22px;
}
.tile.big .title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }

.tile .status-badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; font-weight: 700;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.85);
  cursor: pointer;
}
.tile.c-slate .status-badge, .tile.c-plum .status-badge, .tile.c-steel .status-badge, .tile.c-brick .status-badge {
  box-shadow: 0 0 0 2px rgba(0,0,0,0.25);
}
.status-badge[data-status="W"] { background: var(--st-W); color: #2a2420; }
.status-badge[data-status="K"] { background: var(--st-K); }
.status-badge[data-status="P"] { background: var(--st-P); }
.status-badge[data-status="U"] { background: var(--st-U); }
.status-badge[data-status="L"] { background: var(--st-L); }
.status-badge[data-status="O"] {
  background: transparent;
  color: var(--st-O);
  font-size: 15px;
  box-shadow: none;
}

/* flag pills at bottom of tile */
.tile .flags {
  display: flex; gap: 4px;
  margin-top: 6px;
}
.tile .flag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px 2px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,0.85);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms, border-color 120ms;
}
.tile.c-slate .flag, .tile.c-plum .flag, .tile.c-steel .flag, .tile.c-brick .flag {
  background: rgba(255,255,255,0.92);
}
.tile .flag.off { background: rgba(255,255,255,0.25); color: inherit; opacity: 0.55; }
.tile.c-slate .flag.off, .tile.c-plum .flag.off, .tile.c-steel .flag.off, .tile.c-brick .flag.off {
  background: rgba(0,0,0,0.2);
  color: rgba(255,255,255,0.7);
}
.tile .flag.on.login { background: var(--login); color: #fff; }
.tile .flag.on.paid  { background: var(--paid); color: #fff; }
.tile .flag:hover { border-color: rgba(0,0,0,0.15); }
.tile .flag .glyph { font-size: 9px; }

/* ——————— Side panel ——————— */
.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  background: var(--bg-paper);
  border-left: 1px solid var(--rule);
  box-shadow: -20px 0 40px rgba(0,0,0,0.08);
  z-index: 500;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(.4,0,.2,1);
}
.panel.open { transform: translateX(0); }

.panel header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 10px;
}
.panel header .close {
  margin-left: auto;
  width: 28px; height: 28px;
  border: 1px solid var(--rule);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
}
.panel header .close:hover { background: var(--bg-soft); color: var(--ink); }
.panel .ptitle {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel .body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.panel .body .field { margin-bottom: 18px; }
.panel .body label {
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.panel .body input[type="text"],
.panel .body textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 7px;
  outline: none;
  resize: vertical;
}
.panel .body input:focus, .panel .body textarea:focus { border-color: var(--rule-strong); background: #fff; }
.panel .body textarea { min-height: 80px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.chip:hover { background: var(--bg-soft); }
.chip.active { background: var(--ink); color: var(--bg-paper); border-color: var(--ink); }

.chip-color {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
}
.chip-color.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--bg-paper) inset; }

.flag-toggles { display: flex; gap: 8px; }
.flag-toggle {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  text-align: left;
}
.flag-toggle:hover { background: var(--bg-soft); }
.flag-toggle .sw {
  width: 14px; height: 14px; border-radius: 3px;
  border: 1.5px solid var(--ink-faint);
  background: transparent;
  flex-shrink: 0;
}
.flag-toggle.on.login { background: oklch(95% 0.03 255); border-color: var(--login); color: var(--login); }
.flag-toggle.on.login .sw { background: var(--login); border-color: var(--login); }
.flag-toggle.on.paid  { background: oklch(95% 0.03 145); border-color: var(--paid); color: var(--paid); }
.flag-toggle.on.paid .sw { background: var(--paid); border-color: var(--paid); }

.meta {
  padding-top: 14px;
  margin-top: 10px;
  border-top: 1px dashed var(--rule);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px;
}
.meta b { color: var(--ink-soft); font-weight: 500; }

.danger {
  margin-top: 16px;
  padding: 8px 12px;
  font-size: 12px;
  background: transparent;
  border: 1px solid oklch(85% 0.05 25);
  color: oklch(45% 0.15 25);
  border-radius: 6px;
  cursor: pointer;
}
.danger:hover { background: oklch(96% 0.02 25); }

/* ——————— Empty state / Toast ——————— */
.toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 18px;
  background: var(--ink);
  color: var(--bg-paper);
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity 200ms, transform 200ms;
  z-index: 1000;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ——————— Group labels ——————— */
.label-tile {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  border-radius: 5px;
  cursor: grab;
  user-select: none;
  z-index: 1;
  transition: background 120ms;
}
.label-tile:hover { background: rgba(0,0,0,0.04); }
.label-tile.selected {
  outline: 1.5px dashed var(--rule-strong);
  outline-offset: 3px;
}
.label-tile.dragging { cursor: grabbing; z-index: 50; }

.label-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: -0.02em;
  line-height: 1.25;
  white-space: nowrap;
}
.label-tile.selected .label-text { color: var(--ink); }

.label-edit {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: inherit;
  color: var(--ink);
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  min-width: 80px;
}

.label-del {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--bg-paper);
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
.label-del:hover {
  background: oklch(96% 0.02 25);
  color: oklch(45% 0.15 25);
  border-color: oklch(85% 0.05 25);
}
