  /* ===================================================================
     THEME TOKENS — reskin the whole board from here
     =================================================================== */
  :root {
    --bg:        #0a1420;   /* app background */
    --bg-2:      #0d1a2a;   /* gradient end */
    --panel:     #10202f;   /* column surface */
    --panel-2:   #16293c;   /* card surface / raised */
    --panel-3:   #1c344b;   /* hover / input */
    --line:      #21384f;   /* borders */
    --line-2:    #2c4a68;   /* stronger borders */
    --text:      #eaf3ff;   /* primary text */
    --muted:     #8ba6c4;   /* secondary text */
    --faint:     #5c7593;   /* placeholder / meta */
    --azure:     #35c0f5;   /* primary accent */
    --azure-ink: #0a1420;
    --gold:      #fbcf5b;   /* secondary accent */
    --red:       #f77070;
    --green:     #4bd196;
    --radius:    14px;
    --radius-sm: 10px;
    --shadow:    0 18px 40px -20px rgba(0,0,0,.7);
    --shadow-sm: 0 6px 18px -10px rgba(0,0,0,.6);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;

    /* label palette — id -> color (also mirrored in JS LABELS) */
    --lab-azure:  #35c0f5;
    --lab-gold:   #fbcf5b;
    --lab-green:  #4bd196;
    --lab-red:    #f77070;
    --lab-purple: #b98cff;
    --lab-pink:   #ff8fc7;
    --lab-teal:   #43d6c4;
    --lab-slate:  #8ba6c4;
  }

  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; height: 100%; }
  body {
    font-family: var(--font);
    color: var(--text);
    background:
      radial-gradient(1200px 700px at 78% -10%, rgba(53,192,245,.10), transparent 60%),
      radial-gradient(900px 600px at 8% 4%, rgba(251,207,91,.06), transparent 55%),
      linear-gradient(180deg, var(--bg), var(--bg-2));
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  button, input, textarea, select { font-family: inherit; }

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

  /* ===================================================================
     TOP BAR
     =================================================================== */
  header.top {
    flex: none;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(10,20,32,.7);
    backdrop-filter: blur(10px);
  }
  .brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .mark {
    width: 40px; height: 40px; border-radius: 12px; flex: none;
    display: grid; place-items: center;
    background: linear-gradient(150deg, var(--azure), #2a86d8);
    box-shadow: 0 8px 20px -8px rgba(53,192,245,.75);
  }
  .mark svg { width: 22px; height: 22px; display: block; }
  .brand h1 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin: 0; line-height: 1; }
  .brand p  { margin: 3px 0 0; font-size: 12px; color: var(--faint); font-weight: 600; }

  .top .grow { flex: 1; }

  /* search */
  .search { position: relative; }
  .search svg {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--faint); pointer-events: none;
  }
  .search input {
    width: 210px; max-width: 42vw;
    font-size: 14px; color: var(--text);
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 999px; padding: 10px 34px 10px 34px;
    outline: none; transition: border-color .15s, box-shadow .15s, width .2s;
  }
  .search input::placeholder { color: var(--faint); }
  .search input:focus { border-color: var(--azure); box-shadow: 0 0 0 3px rgba(53,192,245,.16); }
  .search .x {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    border: none; background: var(--panel-3); color: var(--muted);
    width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
    display: none; place-items: center; font-size: 15px; line-height: 1;
  }
  .search.has .x { display: grid; }
  .search .x:hover { color: var(--text); background: var(--line-2); }

  .btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 700; letter-spacing: .01em;
    border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
    padding: 10px 15px; border-radius: 11px; cursor: pointer;
    transition: transform .12s, background .15s, border-color .15s, filter .15s;
    white-space: nowrap;
  }
  .btn svg { width: 17px; height: 17px; }
  .btn:hover { background: var(--panel-3); border-color: var(--azure); }
  .btn:active { transform: scale(.96); }
  .btn:focus-visible { outline: 3px solid rgba(53,192,245,.4); outline-offset: 2px; }
  .btn.primary {
    background: linear-gradient(150deg, var(--azure), #2a86d8);
    color: var(--azure-ink); border-color: transparent;
    box-shadow: 0 10px 22px -12px rgba(53,192,245,.9);
  }
  .btn.primary:hover { filter: brightness(1.06); }
  .btn.ghost { background: transparent; }
  .btn.icon { padding: 10px; }
  .btn.danger:hover { border-color: var(--red); color: var(--red); }

  /* ===================================================================
     BOARD
     =================================================================== */
  .board-wrap { flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; }
  .board {
    display: flex;
    align-items: stretch;
    gap: 16px;
    height: 100%;
    padding: 18px 20px 22px;
    min-width: min-content;
  }

  .col {
    flex: 0 0 300px;
    width: 300px;
    max-width: 84vw;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--panel), rgba(16,32,47,.6));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    max-height: 100%;
    transition: border-color .15s, box-shadow .15s, transform .12s;
  }
  .col.drop-col { border-color: var(--azure); box-shadow: 0 0 0 3px rgba(53,192,245,.18) inset; }
  .col.dragging-col { opacity: .5; }

  .col-head {
    display: flex; align-items: center; gap: 8px;
    padding: 13px 12px 11px 14px;
    border-bottom: 1px solid var(--line);
  }
  .col-grip {
    color: var(--faint); cursor: grab; flex: none;
    display: grid; place-items: center; width: 16px; height: 22px;
    touch-action: none;
  }
  .col-grip:active { cursor: grabbing; }
  .col-grip svg { width: 14px; height: 14px; }
  .col-title {
    flex: 1; min-width: 0;
    font-size: 14.5px; font-weight: 800; letter-spacing: .01em; color: var(--text);
    background: transparent; border: 1px solid transparent; border-radius: 8px;
    padding: 5px 7px; margin: 0; outline: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    transition: background .15s, border-color .15s;
  }
  .col-title:hover { background: var(--panel-2); }
  .col-title:focus {
    background: var(--panel-3); border-color: var(--azure);
    white-space: normal; text-overflow: clip;
  }
  .col-count {
    flex: none; font-size: 12px; font-weight: 800; color: var(--muted);
    background: var(--panel-2); border: 1px solid var(--line);
    min-width: 24px; text-align: center;
    padding: 3px 8px; border-radius: 999px;
  }
  .col-menu { flex: none; position: relative; }
  .col-menu > button {
    border: none; background: transparent; color: var(--muted);
    width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
    display: grid; place-items: center; font-size: 18px; line-height: 1;
  }
  .col-menu > button:hover { background: var(--panel-3); color: var(--text); }

  .menu {
    position: absolute; right: 0; top: 34px; z-index: 30;
    background: var(--panel-2); border: 1px solid var(--line-2);
    border-radius: 12px; padding: 6px; min-width: 168px;
    box-shadow: var(--shadow);
    display: none; flex-direction: column; gap: 2px;
  }
  .menu.open { display: flex; animation: menuIn .14s ease both; }
  @keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
  .menu button {
    display: flex; align-items: center; gap: 10px;
    text-align: left; width: 100%;
    font-size: 13.5px; font-weight: 600; color: var(--text);
    background: transparent; border: none; border-radius: 8px;
    padding: 9px 10px; cursor: pointer;
  }
  .menu button svg { width: 15px; height: 15px; color: var(--muted); }
  .menu button:hover { background: var(--panel-3); }
  .menu button.danger { color: var(--red); }
  .menu button.danger svg { color: var(--red); }

  .cards {
    flex: 1; min-height: 0;
    overflow-y: auto;
    padding: 10px;
    display: flex; flex-direction: column; gap: 10px;
    scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
  }
  .cards::-webkit-scrollbar { width: 9px; }
  .cards::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

  /* card */
  .card {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 12px 12px;
    cursor: grab;
    box-shadow: var(--shadow-sm);
    transition: transform .12s, border-color .15s, box-shadow .15s, opacity .18s;
    animation: cardIn .28s cubic-bezier(.2,.9,.3,1.15) both;
    position: relative;
  }
  @keyframes cardIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
  .card:hover { border-color: var(--line-2); transform: translateY(-1px); box-shadow: var(--shadow); }
  .card:focus-visible { outline: 3px solid rgba(53,192,245,.45); outline-offset: 2px; }
  .card:active { cursor: grabbing; }
  .card.dragging { opacity: .35; }
  .card.ghost-hidden { display: none; }

  .card .labels { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
  .card .labels:empty { display: none; }
  .lab {
    height: 7px; width: 30px; border-radius: 999px; background: var(--c, var(--azure));
    box-shadow: 0 0 0 1px rgba(0,0,0,.15) inset;
  }
  .card .title {
    font-size: 14.5px; font-weight: 650; line-height: 1.35; color: var(--text);
    letter-spacing: -.005em; word-break: break-word;
  }
  .card .foot {
    display: flex; align-items: center; gap: 10px; margin-top: 9px;
    font-size: 11.5px; color: var(--faint); font-weight: 600;
  }
  .card .foot .chip {
    display: inline-flex; align-items: center; gap: 4px;
  }
  .card .foot .chip svg { width: 13px; height: 13px; }
  .card .foot .spacer { flex: 1; }

  mark.hl { background: rgba(251,207,91,.28); color: var(--gold); border-radius: 3px; padding: 0 1px; }

  /* drop placeholder */
  .placeholder {
    border: 2px dashed var(--azure);
    border-radius: var(--radius-sm);
    background: rgba(53,192,245,.08);
    min-height: 44px;
    flex: none;
  }

  /* add-card row */
  .add-card {
    display: flex; align-items: center; gap: 8px;
    margin: 2px 10px 12px;
    padding: 9px 10px;
    font-size: 13.5px; font-weight: 700; color: var(--muted);
    background: transparent; border: 1px dashed var(--line-2); border-radius: 10px;
    cursor: pointer; transition: color .15s, border-color .15s, background .15s;
  }
  .add-card:hover { color: var(--azure); border-color: var(--azure); background: rgba(53,192,245,.06); }
  .add-card svg { width: 16px; height: 16px; }

  .col-empty {
    text-align: center; color: var(--faint); font-size: 12.5px; font-weight: 600;
    padding: 14px 10px; line-height: 1.4;
  }

  /* add-column tile */
  .add-col {
    flex: 0 0 260px; width: 260px; max-width: 84vw;
    align-self: flex-start;
    display: flex; align-items: center; justify-content: center; gap: 9px;
    font-size: 14px; font-weight: 700; color: var(--muted);
    background: rgba(22,41,60,.4); border: 1px dashed var(--line-2);
    border-radius: var(--radius); padding: 16px; cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
  }
  .add-col:hover { color: var(--azure); border-color: var(--azure); background: rgba(53,192,245,.06); }
  .add-col svg { width: 18px; height: 18px; }

  /* ===================================================================
     MODAL (card editor)
     =================================================================== */
  .scrim {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(4,10,18,.62); backdrop-filter: blur(3px);
    display: none; align-items: flex-start; justify-content: center;
    padding: max(24px, 6vh) 16px 24px; overflow-y: auto;
  }
  .scrim.open { display: flex; animation: fade .18s ease both; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }

  .modal {
    width: 100%; max-width: 480px;
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line-2); border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 20px 20px 18px;
    animation: modalIn .22s cubic-bezier(.2,.9,.3,1.15) both;
  }
  @keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

  .modal h2 { margin: 0 0 2px; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
  .modal .sub { margin: 0 0 16px; font-size: 12.5px; color: var(--faint); font-weight: 600; }

  .field { margin-bottom: 14px; }
  .field label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
  .field input[type=text], .field textarea {
    width: 100%; font-size: 15px; color: var(--text);
    background: var(--panel); border: 1px solid var(--line-2); border-radius: 11px;
    padding: 11px 13px; outline: none; resize: vertical;
    transition: border-color .15s, box-shadow .15s;
  }
  .field textarea { min-height: 92px; line-height: 1.5; }
  .field input:focus, .field textarea:focus { border-color: var(--azure); box-shadow: 0 0 0 3px rgba(53,192,245,.16); }
  .field input::placeholder, .field textarea::placeholder { color: var(--faint); }

  .swatches { display: flex; flex-wrap: wrap; gap: 9px; }
  .swatch {
    width: 30px; height: 30px; border-radius: 9px; cursor: pointer; position: relative;
    background: var(--c); border: 2px solid transparent;
    transition: transform .12s, box-shadow .15s;
  }
  .swatch:hover { transform: translateY(-2px); }
  .swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 3px rgba(53,192,245,.3); }
  .swatch[aria-pressed="true"]::after {
    content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
    color: rgba(10,20,32,.85); font-size: 15px; font-weight: 900;
  }
  .swatch:focus-visible { outline: 3px solid rgba(53,192,245,.5); outline-offset: 2px; }

  .modal-foot { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
  .modal-foot .spacer { flex: 1; }

  /* toast */
  .toast {
    position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(18px);
    z-index: 120; background: var(--panel-2); color: var(--text);
    border: 1px solid var(--line-2);
    font-size: 14px; font-weight: 600; padding: 11px 16px; border-radius: 13px;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px;
    opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.2,.9,.3,1.3);
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
  .toast button { font: inherit; font-weight: 800; color: var(--azure); background: none; border: none; cursor: pointer; padding: 0; }

  @media (max-width: 560px) {
    header.top { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
    .top .grow { order: 5; flex-basis: 100%; height: 0; }
    .search input { width: 100%; max-width: none; }
    .search { order: 6; flex: 1 1 100%; }
    .board { padding: 14px; gap: 12px; }
  }

  @media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition-duration: .01ms !important; }
  }
