/* ————— Docket · team inbox ————— */

@font-face { font-family: 'Space Grotesk'; src: url('assets/space-grotesk.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Work Sans'; src: url('assets/work-sans.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('assets/ibm-plex-mono.ttf') format('truetype'); font-display: swap; }

:root {
  --bg: #F5F5F2;
  --surface: #FFFFFF;
  --surface-2: #FAFAF7;
  --ink: #1A1C20;
  --ink-2: #575C64;
  --ink-3: #6E747D;
  --line: #E5E5DF;
  --line-strong: #D8D8D0;
  --accent: #1E6E50;
  --accent-soft: rgba(30, 110, 80, 0.10);
  --st-todo: #59606A;
  --st-progress: #1D5FC2;
  --st-blocked: #BE3B24;
  --st-done: #1E7A54;
  --prio-high: #BE3B24;
  --prio-med: #8A6A1E;
  --prio-low: #6E747D;
  --toast-bg: #1A1C20;
  --toast-fg: #F5F5F2;
  --btn-fg: #ffffff;
  --font-ui: 'Work Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Work Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --r: 10px; /* controls, panels */
  --topbar-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131519;
    --surface: #1B1E23;
    --surface-2: #20242A;
    --ink: #ECEDEF;
    --ink-2: #A2A8B1;
    --ink-3: #7F8590;
    --line: #2A2E35;
    --line-strong: #363B44;
    --accent: #45B388;
    --accent-soft: rgba(69, 179, 136, 0.14);
    --st-todo: #A8AEB9;
    --st-progress: #7CABFF;
    --st-blocked: #FF8A73;
    --st-done: #45B388;
    --prio-high: #FF8A73;
    --prio-med: #D9B36A;
    --prio-low: #A2A8B1;
    --toast-bg: #ECEDEF;
    --toast-fg: #131519;
    --btn-fg: #10251C;
  }
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  height: 100dvh;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::placeholder { color: var(--ink-3); opacity: 1; }

/* ————— Top bar ————— */
.topbar {
  flex: 0 0 auto;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { flex: 0 0 auto; }
.brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  border-left: 1px solid var(--line-strong);
  padding-left: 10px;
  margin-left: 2px;
}
.team { display: flex; align-items: center; gap: 6px; }
.team-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  margin-right: 6px;
}
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: #fff;
  flex: 0 0 auto;
}
.team .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--bg); }

/* ————— Frame: rail / board / panel ————— */
.frame {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 0px;
  transition: grid-template-columns 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.frame.detail-open { grid-template-columns: 220px minmax(0, 1fr) 400px; }

/* ————— Rail ————— */
.rail {
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  overflow-y: auto;
}
.rail-heading {
  margin: 0 0 10px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-3);
}
.rail-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
}
.rail-btn:hover { background: var(--surface); color: var(--ink); }
.rail-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.rail-count { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.rail-btn[aria-pressed="true"] .rail-count { color: inherit; }

/* ————— Board ————— */
.board { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.board-head { flex: 0 0 auto; padding: 26px 32px 2px; }
.board-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.board-sub { margin: 6px 0 0; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }

.toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 32px 16px;
}
.searchbox { position: relative; flex: 0 1 340px; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none;
}
input[type="search"] {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}
input[type="search"]:focus { border-color: var(--accent); outline: none; }
input[type="search"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.filterbox { display: flex; align-items: center; gap: 8px; }
.filter-label { font-size: 13px; color: var(--ink-2); }

.selectwrap { position: relative; display: inline-flex; }
.selectwrap::after {
  content: '';
  position: absolute; right: 14px; top: 50%;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
select {
  appearance: none; -webkit-appearance: none;
  height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}
select:focus { border-color: var(--accent); outline: none; }
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ————— List ————— */
.list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 6px 32px 56px;
  list-style: none;
  container-type: inline-size;
}
.list li + li { border-top: 1px solid var(--line); }

button.row {
  width: 100%;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto 64px 44px 16px;
  align-items: center;
  gap: 14px;
  padding: 13px 8px;
  border: 0;
  background: none;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease;
}
button.row:hover { background: var(--surface); }
button.row:active { background: var(--surface-2); transform: translateY(1px); }

li.open .row {
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--accent);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  justify-self: start;
  white-space: nowrap;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-todo    { color: var(--st-todo);    background: color-mix(in srgb, var(--st-todo) 11%, transparent); }
.st-in-progress { color: var(--st-progress); background: color-mix(in srgb, var(--st-progress) 11%, transparent); }
.st-blocked { color: var(--st-blocked); background: color-mix(in srgb, var(--st-blocked) 11%, transparent); }
.st-done    { color: var(--st-done);    background: color-mix(in srgb, var(--st-done) 11%, transparent); }

.row-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-title {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-sub { font-size: 12.5px; color: var(--ink-2); }
.row-assignee { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.row-due { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); text-align: right; }
.row-comments {
  display: flex; align-items: center; justify-content: flex-end; gap: 5px;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-3);
}
.row-comments svg { flex: 0 0 auto; }
.row-chevron { color: var(--ink-3); display: grid; place-items: center; }

/* Rows adapt to their container, so they also stay readable when the
   detail panel narrows the board on mid-size desktops. */
@container (max-width: 720px) {
  button.row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "pill due"
      "main main"
      "assignee assignee";
    row-gap: 6px;
    padding: 12px 6px;
  }
  .row .pill { grid-area: pill; }
  .row-main { grid-area: main; }
  .row-assignee { grid-area: assignee; margin-top: -2px; }
  .row-due { grid-area: due; font-size: 11.5px; }
  .row-comments { display: none; }
  .row-chevron { display: none; }
  .row-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* ————— Empty state ————— */
.empty { padding: 72px 32px; text-align: center; }
.empty h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 19px; letter-spacing: -0.01em; }
.empty p { margin: 8px auto 20px; max-width: 42ch; color: var(--ink-2); }
.btn-primary {
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r);
  background: var(--accent);
  color: var(--btn-fg);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }

/* ————— Detail panel ————— */
.panel {
  grid-column: 3;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  visibility: hidden;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.22s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 0.3s;
}
.panel.open {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity 0.22s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.frame.detail-open .panel { border-left: 1px solid var(--line); }

.panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-id { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn:active { transform: translateY(1px); }

.panel-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 22px 24px 48px; }
.panel-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  background: var(--surface-2);
}

.field { margin-bottom: 20px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.status-wrap select {
  height: 40px;
  padding-left: 34px;
  padding-right: 38px;
  font-weight: 500;
}
.status-wrap::before {
  content: '';
  position: absolute; left: 13px; top: 50%;
  width: 8px; height: 8px; border-radius: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.status-wrap.st-todo::before { background: var(--st-todo); }
.status-wrap.st-in-progress::before { background: var(--st-progress); }
.status-wrap.st-blocked::before { background: var(--st-blocked); }
.status-wrap.st-done::before { background: var(--st-done); }

.meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 22px;
  margin: 0 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
}
.meta dt {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.meta dd { margin: 0; font-size: 14px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.meta .mono { font-family: var(--font-mono); font-size: 13px; }
.avatar.lg { width: 22px; height: 22px; font-size: 8.5px; }

.prio { font-family: var(--font-mono); font-size: 12.5px; }
.p-high { color: var(--prio-high); }
.p-medium { color: var(--prio-med); }
.p-low { color: var(--prio-low); }

.panel-text p { margin: 0 0 14px; font-size: 14.5px; line-height: 1.68; color: var(--ink); }
.outcome {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  padding: 12px 14px !important;
}
.outcome-k {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--accent);
  margin-bottom: 5px;
}

/* ————— Toast ————— */
.toast {
  position: fixed;
  z-index: 60;
  left: 24px; bottom: 24px;
  max-width: min(340px, calc(100vw - 48px));
  padding: 10px 16px;
  border-radius: var(--r);
  background: var(--toast-bg);
  color: var(--toast-fg);
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 0.25s;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ————— Mobile ————— */
@media (max-width: 1023px) {
  .topbar { padding: 0 16px; }
  .brand-tag { display: none; }
  .team-label { display: none; }
  .team .avatar { width: 24px; height: 24px; }

  .frame { grid-template-columns: minmax(0, 1fr); transition: none; }
  .frame.detail-open { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }

  .board-head { padding: 18px 16px 0; }
  .board-head h1 { font-size: 22px; }
  .toolbar { padding: 12px 16px 14px; }  .searchbox { flex: 1 1 100%; }
  .list { padding: 4px 16px 48px; }

  .panel {
    position: fixed;
    inset: 0;
    z-index: 40;
    border-left: 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
  }
  .panel-scroll { padding: 18px 16px 40px; }
  .panel-title { font-size: 20px; }
  .meta { grid-template-columns: 1fr; }

  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

/* ————— Reduced motion ————— */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
