/* ============================================================
   Docket - team task inbox
   Type: Work Sans (variable, OFL) + IBM Plex Mono (OFL), both local.
   Radius system (locked): 10px for controls & containers,
   full pill for status chips and the toast. Nothing else.
   Z-index scale: topbar 5, scrim 40, detail 50, toast 60.
   ============================================================ */

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

:root {
  color-scheme: light dark;

  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --ink: #1b1e24;
  --ink-soft: #2f343c;
  --muted: #5a6170;
  --hairline: #e4e6ea;
  --hairline-strong: #c7cbd2;

  --accent: #2f55dc;
  --accent-ink: #2447c5;
  --accent-tint: rgba(47, 85, 220, 0.1);

  --chip-todo-bg: #e8eaed;
  --chip-todo-ink: #434a55;
  --chip-prog-bg: rgba(47, 85, 220, 0.12);
  --chip-prog-ink: #2447c5;
  --chip-block-bg: rgba(178, 58, 62, 0.12);
  --chip-block-ink: #b03a3e;
  --chip-done-bg: rgba(23, 107, 76, 0.13);
  --chip-done-ink: #176b4c;

  --avatar-bg: #262b33;
  --avatar-ink: #f4f6f9;
  --scrim: rgba(13, 16, 22, 0.44);
  --toast-bg: #1b1e24;
  --toast-ink: #f2f4f7;
  --ok: #176b4c;
  --shadow-panel: -24px 0 60px rgba(15, 20, 30, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1b1e23;
    --surface-2: #22262d;
    --ink: #e9ecf0;
    --ink-soft: #c6cbd3;
    --muted: #9aa2ae;
    --hairline: rgba(255, 255, 255, 0.09);
    --hairline-strong: rgba(255, 255, 255, 0.2);

    --accent: #7d94ff;
    --accent-ink: #a9bcff;
    --accent-tint: rgba(125, 148, 255, 0.16);

    --chip-todo-bg: rgba(255, 255, 255, 0.1);
    --chip-todo-ink: #c4c9d2;
    --chip-prog-bg: rgba(101, 130, 255, 0.2);
    --chip-prog-ink: #a9bcff;
    --chip-block-bg: rgba(235, 95, 100, 0.18);
    --chip-block-ink: #f2a0a3;
    --chip-done-bg: rgba(50, 160, 110, 0.18);
    --chip-done-ink: #83d6ab;

    --avatar-bg: #343b45;
    --avatar-ink: #edf0f4;
    --scrim: rgba(4, 6, 10, 0.6);
    --toast-bg: #e9ecf2;
    --toast-ink: #171a1f;
    --ok: #83d6ab;
    --shadow-panel: -24px 0 60px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 'Work Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ---------- App frame ---------- */

.app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100dvh;
}

/* ---------- Sidebar ---------- */

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  padding: 22px 14px 28px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 10px 20px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
}

.brand-mark svg { display: block; }

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.side-heading {
  font: 400 11px/1 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--muted);
  margin: 18px 10px 8px;
}

.side-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink-soft);
  font: 500 13.5px/1.2 'Work Sans', sans-serif;
  cursor: pointer;
  text-align: left;
}

.side-btn:hover { background: var(--surface-2); color: var(--ink); }

.side-btn.active {
  background: var(--accent-tint);
  color: var(--accent-ink);
  font-weight: 600;
}

.side-count {
  font: 400 11.5px/1 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--muted);
}

.side-btn.active .side-count { color: var(--accent-ink); }

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}

.topbar-inner {
  display: flex;
  align-items: flex-end;
  gap: 22px;
  max-width: 920px;
  margin: 0 auto;
  padding: 14px 28px;
}

.mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 2px;
}

.mobile-brand .brand-name { font-size: 16px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > label {
  font: 400 11px/1 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--muted);
  padding-left: 2px;
}

.search-field { flex: 1; max-width: 420px; min-width: 0; }

input[type='search'],
select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: 400 13.5px/1 'Work Sans', sans-serif;
  padding: 9px 12px;
}

input[type='search'] { padding-right: 12px; }

input[type='search']::placeholder { color: var(--muted); opacity: 1; }

select {
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235a6170' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

@media (prefers-color-scheme: dark) {
  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%239aa2ae' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

.filter-field select { min-width: 150px; }

.project-clear {
  margin-left: auto;
  align-self: flex-end;
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: 500 12px/1 'Work Sans', sans-serif;
  padding: 9px 12px;
  cursor: pointer;
}

.project-clear:hover { color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Content ---------- */

.content {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 28px 90px;
}

.masthead {
  padding: 30px 0 10px;
}

.masthead h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.masthead p {
  margin: 0;
  font: 400 12.5px/1.5 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--muted);
}

/* ---------- Task list ---------- */

.task-list {
  list-style: none;
  margin: 0;
  border-top: 1px solid var(--hairline);
}

.task-row { border-bottom: 1px solid var(--hairline); }

.task-btn {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 190px 84px;
  gap: 8px 24px;
  align-items: center;
  width: 100%;
  padding: 15px 10px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  transition: background-color 0.13s ease;
}

.task-btn:hover { background: var(--surface); }

.task-btn:focus-visible,
.side-btn:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.st-todo { background: var(--chip-todo-bg); color: var(--chip-todo-ink); }
.st-in-progress { background: var(--chip-prog-bg); color: var(--chip-prog-ink); }
.st-blocked { background: var(--chip-block-bg); color: var(--chip-block-ink); }
.st-done { background: var(--chip-done-bg); color: var(--chip-done-ink); }

.item-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.item-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

.item-meta {
  font: 400 11.5px/1.4 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-who {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.avatar {
  flex: none;
  width: 25px;
  height: 25px;
  border-radius: 999px;
  background: var(--avatar-bg);
  color: var(--avatar-ink);
  display: inline-grid;
  place-items: center;
  font: 400 10px/1 'IBM Plex Mono', ui-monospace, monospace;
  letter-spacing: 0.03em;
}

.item-assignee {
  font-size: 13px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-due {
  justify-self: end;
  font: 400 12.5px/1.3 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Empty state ---------- */

.empty-state {
  max-width: 460px;
  margin: 0 auto;
  padding: 76px 24px 40px;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 650;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.btn-primary {
  margin-top: 20px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: 600 13.5px/1 'Work Sans', sans-serif;
  padding: 11px 18px;
  cursor: pointer;
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-primary:active { transform: translateY(1px); }

/* ---------- Detail panel ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--scrim);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.scrim.open { opacity: 1; visibility: visible; pointer-events: auto; }

.detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(520px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--hairline);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s 0.28s;
}

.detail.open {
  transform: none;
  visibility: visible;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.detail-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}

.btn-ghost {
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  background: none;
  color: var(--ink-soft);
  font: 500 12.5px/1 'Work Sans', sans-serif;
  padding: 8px 14px;
  cursor: pointer;
}

.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-ghost:active { transform: translateY(1px); }

.detail-body {
  padding: 24px 26px 48px;
}

.detail-title {
  margin: 0 0 20px;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.012em;
  line-height: 1.28;
}

.status-field { display: flex; flex-direction: column; gap: 7px; }

.status-field > label {
  font: 400 11px/1 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--muted);
}

.status-field select { max-width: 280px; }

.status-note {
  margin: 0;
  font: 400 11.5px/1.5 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--muted);
}

.status-note.ok { color: var(--ok); font-weight: 400; }

.detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  margin: 24px 0;
  padding: 18px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.detail-meta dt {
  font: 400 10.5px/1 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--muted);
  margin: 0 0 5px;
}

.detail-meta dd {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.detail-meta .tag-list { display: flex; flex-wrap: wrap; gap: 5px; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.detail-text p {
  margin: 0 0 14px;
  font-size: 14.5px;
  line-height: 1.68;
  color: var(--ink-soft);
  max-width: 62ch;
}

.callout {
  margin-top: 26px;
  padding: 15px 17px;
  border-radius: 10px;
  background: var(--accent-tint);
}

.callout-label {
  margin: 0 0 5px;
  font: 400 11.5px/1 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--accent-ink);
}

.callout p { margin: 0; }

#outcome-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 62ch;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 60;
  transform: translate(-50%, 8px);
  background: var(--toast-bg);
  color: var(--toast-ink);
  border-radius: 999px;
  padding: 10px 19px;
  font: 500 13px/1.3 'Work Sans', sans-serif;
  box-shadow: 0 8px 30px rgba(15, 20, 30, 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s 0.18s;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* ---------- Error state ---------- */

.error-state { padding: 80px 24px; text-align: center; }
.error-state h2 { margin: 0 0 8px; font-size: 17px; font-weight: 650; }
.error-state p { margin: 0; color: var(--muted); font-size: 13.5px; }
.error-state .btn-primary { margin: 14px 0 0; }

/* ---------- Responsive ---------- */

@media (max-width: 959px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-brand { display: flex; }
  .topbar-inner { padding-top: 12px; }
}

@media (max-width: 719px) {
  .topbar-inner {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 14px;
    padding: 12px 20px 16px;
  }
  .search-field { flex-basis: 100%; max-width: none; }
  .project-clear { margin-left: 0; }

  .content { padding: 0 20px 70px; }
  .masthead { padding-top: 24px; }

  .task-btn {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'chip due'
      'title title'
      'who who';
    gap: 7px;
    padding: 15px 4px;
  }
  .task-btn .chip { grid-area: chip; }
  .item-main { grid-area: title; }
  .item-who { grid-area: who; }
  .item-due { grid-area: due; justify-self: end; }

  .detail-body { padding: 20px 20px 42px; }
  .detail-title { font-size: 19px; }
  .detail-meta { grid-template-columns: 1fr; gap: 14px; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
  .detail { transform: none; }
}
