/* Boards - SFR Business look, same tokens as Notes.
   Label colours are the validated categorical hues, and a label always carries a
   NAME beside its colour, never colour alone. */

:root {
  color-scheme: light;
  --sfr-red: #e2001a; --sfr-ink: #b80016; --sfr-wash: #fdeced;
  --sfr-fill: #e2001a; --on-fill: #ffffff;

  --bg: #f4f4f2; --surface-1: #ffffff; --surface-2: #fafaf9; --surface-3: #f0efec;
  --border: #e2e1dd; --border-strong: #cfcec9;
  --text-primary: #14140f; --text-secondary: #55544e; --text-muted: #86847c; --muted-ink: #6b6a63;

  --accent: #2a78d6; --accent-wash: #e6effb; --accent-ink: #1c5cab;
  --good: #167a4b; --good-wash: #e6f4ec; --good-fill: #167a4b;
  --warn-ink: #8a5200; --warn-wash: #fdf2dd;
  --critical: #c02128; --critical-wash: #fdecec;

  --c-blue: #2a78d6; --c-orange: #eb6834; --c-aqua: #1baf7a; --c-yellow: #eda100;
  --c-magenta: #e87ba4; --c-green: #008300; --c-violet: #4a3aa7; --c-red: #e34948;

  --radius: 10px; --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(20,20,15,.06), 0 1px 3px rgba(20,20,15,.05);
  --shadow-2: 0 14px 38px rgba(20,20,15,.16);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Poppins", var(--font);
  --header-h: 58px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --sfr-red: #ff6b78; --sfr-ink: #ff8a94; --sfr-wash: #35181c;
    --sfr-fill: #e01b30; --on-fill: #ffffff;
    --bg: #131312; --surface-1: #1a1a19; --surface-2: #202020; --surface-3: #2a2a28;
    --border: #333331; --border-strong: #4a4a46;
    --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #918f85; --muted-ink: #aaa89e;
    --accent: #3987e5; --accent-wash: #16283f; --accent-ink: #86b6ef;
    --good: #35c07d; --good-wash: #12291f; --good-fill: #178453;
    --warn-ink: #e0a52c; --warn-wash: #2e2413;
    --critical: #ff6b6b; --critical-wash: #33191a;
    --c-blue: #3987e5; --c-orange: #d95926; --c-aqua: #199e70; --c-yellow: #c98500;
    --c-magenta: #d55181; --c-green: #008300; --c-violet: #9085e9; --c-red: #e66767;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4);
    --shadow-2: 0 14px 38px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text-primary); font: 400 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; margin: 0; }
button { font: inherit; }
a { color: var(--accent-ink); }

.logo { display: inline-flex; align-items: center; flex: none; }
.logo-mark { background: var(--sfr-fill); color: var(--on-fill); font-family: var(--font-display); font-weight: 700; font-size: 15px; padding: 6px 8px; line-height: 1; }
.logo-word { font-family: var(--font-display); font-weight: 600; font-size: 15px; padding-left: 7px; }

.btn { display: inline-flex; align-items: center; gap: 7px; justify-content: center; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text-primary);
  padding: 8px 13px; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--sfr-fill); border-color: var(--sfr-fill); color: var(--on-fill); font-weight: 600; }
.btn-primary:hover { filter: brightness(.93); }
.btn-danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
.btn-danger:hover { background: var(--critical-wash); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text-primary); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }

label.field { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], textarea {
  width: 100%; padding: 9px 12px; border-radius: 9px; font: inherit;
  border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text-primary); }
input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; border-color: var(--accent); }
.help { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.lang { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: transparent; color: var(--text-secondary); padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--text-primary); color: var(--surface-1); }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(420px, 100%); background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); padding: 26px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card > p.sub { color: var(--text-secondary); font-size: 13.5px; margin: 0 0 20px; }
.auth-top { display: flex; align-items: center; margin-bottom: 22px; }
.auth-top .lang { margin-left: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs button { border: 0; background: none; padding: 9px 13px; cursor: pointer; font-size: 13.5px; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--sfr-ink); border-bottom-color: var(--sfr-fill); font-weight: 600; }
.field-row { margin-bottom: 14px; }
.form-error { background: var(--critical-wash); color: var(--critical); border: 1px solid color-mix(in srgb, var(--critical) 32%, transparent); padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.notice { background: var(--warn-wash); color: var(--warn-ink); border: 1px solid color-mix(in srgb, var(--warn-ink) 30%, transparent); padding: 9px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 16px; }

/* ---------- header ---------- */
.header { height: var(--header-h); display: flex; align-items: center; gap: 12px; padding: 0 18px;
  background: var(--surface-1); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.header .divider { width: 1px; height: 24px; background: var(--border); }
.header .spacer { flex: 1; }
.header h1 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.who { font-size: 12.5px; color: var(--text-muted); }
.avatar { width: 30px; height: 30px; border-radius: 999px; background: var(--sfr-wash); color: var(--sfr-ink); display: grid; place-items: center; font-weight: 700; font-size: 11.5px; flex: none; }

/* ---------- board index ---------- */
.index-wrap { padding: 28px 24px 60px; max-width: 1180px; margin: 0 auto; }
.index-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; }
.index-head h2 { font-size: 21px; }
.index-head .spacer { flex: 1; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.board-tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); padding: 16px 17px; cursor: pointer; text-align: left; }
.board-tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.board-tile h3 { font-size: 15px; margin-bottom: 6px; }
.board-tile p { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.board-tile .bar { height: 4px; border-radius: 999px; background: var(--sfr-fill); width: 42px; margin-bottom: 12px; }

/* ---------- board ---------- */
.board-wrap { height: calc(100vh - var(--header-h)); overflow-x: auto; overflow-y: hidden; padding: 18px; display: flex; gap: 14px; align-items: flex-start; }
.list {
  width: 290px; flex: none; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: 100%;
}
.list-head { display: flex; align-items: center; gap: 8px; padding: 11px 13px 9px; }
.list-head h3 { font-size: 13.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-head .count { font-size: 11.5px; color: var(--text-muted); background: var(--surface-3); border-radius: 999px; padding: 1px 7px; }
.list-head input { padding: 4px 8px; font-size: 13.5px; font-weight: 600; }
.list-body { overflow-y: auto; padding: 0 10px 6px; display: flex; flex-direction: column; gap: 8px; min-height: 14px; }
.list-body.drag-over { background: var(--accent-wash); border-radius: 8px; }
.list-foot { padding: 8px 10px 10px; }
.list-foot textarea { resize: none; font-size: 13.5px; }

.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 11px; box-shadow: var(--shadow-1); cursor: grab; font-size: 13.5px;
}
.card:hover { border-color: var(--border-strong); }
.card.dragging { opacity: .4; }
.card .title { display: block; }
.card .labels { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.badge { font-size: 10.5px; font-weight: 600; border-radius: 5px; padding: 2px 7px; color: #fff; }
.badge.c-yellow, .badge.c-aqua, .badge.c-magenta { color: #14140f; }
.card .foot { display: flex; align-items: center; gap: 9px; margin-top: 7px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-muted); }
.card .foot .chip { display: inline-flex; align-items: center; gap: 4px; }
.due { border-radius: 5px; padding: 1px 6px; font-weight: 600; }
.due.soon { background: var(--warn-wash); color: var(--warn-ink); }
.due.late { background: var(--critical-wash); color: var(--critical); }
.due.fine { background: var(--surface-3); color: var(--muted-ink); }
.drop-line { height: 3px; background: var(--accent); border-radius: 999px; margin: -4px 0; }

.add-list { width: 290px; flex: none; }
.add-list button { width: 100%; text-align: left; padding: 12px 14px; border-radius: var(--radius-lg); border: 1px dashed var(--border-strong); background: transparent; color: var(--text-secondary); cursor: pointer; }
.add-list button:hover { background: var(--surface-2); color: var(--text-primary); }

/* ---------- card panel ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20,20,15,.45); z-index: 60; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 96vw); z-index: 61;
  background: var(--surface-1); border-left: 1px solid var(--border); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.panel-head .grow { flex: 1; min-width: 0; }
.panel-head input.title { border: 0; background: transparent; padding: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text-primary); }
.panel-head .where { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.panel-body { padding: 18px 20px 40px; overflow-y: auto; }
.sect { margin-bottom: 24px; }
.sect > h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 9px; }
.row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

.toolbar { display: flex; gap: 3px; flex-wrap: wrap; padding: 6px; border: 1px solid var(--border); border-bottom: 0; border-radius: 9px 9px 0 0; background: var(--surface-2); }
.toolbar button { border: 1px solid transparent; background: transparent; color: var(--text-secondary); min-width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.toolbar button:hover { background: var(--surface-3); color: var(--text-primary); }
.toolbar .sep { width: 1px; background: var(--border); margin: 4px 4px; }
.editor { border: 1px solid var(--border); border-radius: 0 0 9px 9px; padding: 12px 14px; min-height: 120px; outline: 0; background: var(--surface-1); font-size: 14px; line-height: 1.65; }
.editor:empty::before { content: attr(data-placeholder); color: var(--text-muted); }
.editor h1 { font-size: 20px; margin: 12px 0 6px; }
.editor h2 { font-size: 17px; margin: 11px 0 5px; }
.editor h3 { font-size: 15px; margin: 10px 0 5px; }
.editor p { margin: 0 0 8px; }
.editor ul, .editor ol { margin: 0 0 8px; padding-left: 22px; }
.editor blockquote { margin: 0 0 8px; padding-left: 12px; border-left: 3px solid var(--border-strong); color: var(--text-secondary); }
.editor code { background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.editor a { color: var(--accent-ink); }

.check { display: flex; align-items: center; gap: 9px; padding: 5px 0; }
.check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--sfr-fill); flex: none; }
.check span { flex: 1; font-size: 13.5px; }
.check span.done { text-decoration: line-through; color: var(--text-muted); }
.check button { opacity: 0; }
.check:hover button { opacity: 1; }
.progress { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-bottom: 10px; }
.progress > i { display: block; height: 100%; background: var(--good-fill); border-radius: 999px; }

.comment { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; }
.comment:last-child { border-bottom: 0; }
.comment .grow { flex: 1; min-width: 0; }
.comment b { font-size: 13px; }
.comment .when { font-size: 11.5px; color: var(--text-muted); margin-left: 6px; font-weight: 400; }
.comment p { margin: 3px 0 0; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }

.label-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.label-pick button { border: 1px solid var(--border); background: var(--surface-1); border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.label-pick button[aria-pressed="true"] { border-color: var(--text-primary); font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.modal-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); width: min(430px, 100%); padding: 22px; }
.modal h3 { font-size: 16px; margin-bottom: 8px; }
.modal p { margin: 0 0 18px; color: var(--text-secondary); font-size: 13.5px; }
.modal-foot { display: flex; gap: 9px; justify-content: flex-end; }

.empty { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(12px); z-index: 90;
  background: var(--text-primary); color: var(--bg); padding: 11px 17px; border-radius: 9px; font-size: 13px;
  box-shadow: var(--shadow-2); opacity: 0; transition: all .18s; pointer-events: none; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--critical); color: #fff; }
