/* Aino shared team workspace — dependency-free stylesheet.
   The shell and the design tokens are the accepted task-ui prototype
   stylesheet (docs/agent-work/task-ui/DESIGN.md); the prototype-only Aino and
   proposal rules are removed and the teamspace rules are appended at the end. */

/* ---------- tokens ---------- */
:root {
  --bg: #F7F8FA;
  --panel: #FFFFFF;
  --panel-alt: #FBFCFD;
  --text: #17212F;
  --muted: #586579;
  --muted-soft: #7B8798;
  --border: #E2E7EF;
  --border-strong: #D3DAE5;
  --accent: #6554C0;
  --accent-strong: #574AB0;
  --accent-soft: #F1EFFB;
  --accent-ink: #4A3D9A;
  --open-ink: #46536A;
  --open-bg: #EEF1F6;
  --open-dot: #96A2B4;
  --progress-ink: #24509F;
  --progress-bg: #E9F0FD;
  --progress-dot: #2F6BDA;
  --done-ink: #166A48;
  --done-bg: #E7F4EE;
  --done-dot: #1E8A5A;
  --cancel-ink: #6B7280;
  --cancel-bg: #F2F3F5;
  --cancel-dot: #A6ADBB;
  --danger: #B4232B;
  --danger-bg: #FDECEC;
  --danger-border: #F3C9C9;
  --warn-ink: #8A5A00;
  --warn-bg: #FFF6E5;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --space: 8px;
  --shadow-sm: 0 1px 1px rgba(23, 33, 47, .04), 0 1px 3px rgba(23, 33, 47, .05);
  --shadow-md: 0 6px 20px rgba(23, 33, 47, .10), 0 1px 2px rgba(23, 33, 47, .06);
  --sidebar-w: 224px;
  --panel-w: 440px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.icon-sm { width: 14px; height: 14px; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--panel); color: var(--accent-ink); padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  text-decoration: none; box-shadow: var(--shadow-md);
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- app shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.app[data-panel="detail"] { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--panel-w); }

/* ---------- sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--panel); border-right: 1px solid var(--border);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text); text-align: left; width: 100%;
  min-height: 38px;
}
.nav-item:hover { background: var(--bg); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-item[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 1px 7px; }
.nav-item[aria-current="page"] .nav-count { background: #fff; color: var(--accent-ink); }
.badge {
  min-width: 20px; padding: 1px 6px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--accent); color: #fff; text-align: center;
}
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.sidebar-note { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.sidebar-note strong { color: var(--text); font-size: 12px; }
.sidebar-note .muted { font-size: 11px; color: var(--muted-soft); }
.sidebar-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(23, 33, 47, .34); border: 0; }

/* ---------- main column ---------- */
.main-col {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  min-width: 0; overflow: hidden;
}
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.nav-toggle { display: none; }
.topbar-titles { min-width: 0; flex: 1; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.crumb-sep { color: var(--border-strong); }
.topbar h1 { font-size: 20px; font-weight: 650; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.search-field {
  position: relative; display: flex; align-items: center;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0 8px 0 30px; min-width: 232px; height: 34px;
}
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-icon { position: absolute; left: 9px; color: var(--muted-soft); }
.search-field input {
  border: 0; background: transparent; outline: none; width: 100%; height: 100%;
}
.search-clear { border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; padding: 4px; border-radius: 999px; }
.search-clear:hover { background: #EDF0F5; color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 12px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
  font-size: 13.5px; font-weight: 550; white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.subtle { background: var(--accent-soft); border-color: #DDD6F4; color: var(--accent-ink); }
.btn.subtle:hover { background: #E8E4F8; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--bg); color: var(--text); }
.btn.danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.btn.danger:hover { background: #FBE0E0; }
.btn.small { min-height: 28px; padding: 3px 9px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* ---------- viewbar ---------- */
.viewbar {
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px 20px 12px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.tabs { display: inline-flex; gap: 2px; background: var(--bg); padding: 3px; border-radius: 10px; align-self: flex-start; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 12px; border-radius: var(--radius); font-size: 13.5px; font-weight: 550;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 11.5px; color: var(--muted); }
select, input[type="text"], input[type="date"], input[type="search"], textarea {
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--panel); padding: 6px 8px; min-height: 34px; max-width: 100%;
}
select { padding-right: 24px; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select:hover, input:hover, textarea:hover { border-color: #C3CCDA; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filters select { min-width: 132px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.quick-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  border-radius: 999px; padding: 5px 11px; font-size: 12.5px;
}
.quick-chip:hover { border-color: var(--border-strong); color: var(--text); }
.quick-chip .quick-count { font-variant-numeric: tabular-nums; color: var(--muted-soft); font-size: 11.5px; }
.quick-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: #D9D2F3; color: var(--accent-ink); font-weight: 600; }
.quick-chip[aria-pressed="true"] .quick-count { color: var(--accent-ink); }

/* ---------- surface ---------- */
.surface {
  position: relative; overflow: auto; padding: 16px 20px 28px; min-width: 0;
  scroll-padding-top: 12px;
}
.surface:focus { outline: none; }
.surface-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.surface-title { font-size: 13px; color: var(--muted); }
.boot-placeholder { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 28px 4px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- chips, avatars, meta ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 550;
  background: var(--open-bg); color: var(--open-ink); white-space: nowrap;
  max-width: 100%;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip-open { background: var(--open-bg); color: var(--open-ink); }
.chip-in_progress { background: var(--progress-bg); color: var(--progress-ink); }
.chip-done { background: var(--done-bg); color: var(--done-ink); }
.chip-cancelled { background: var(--cancel-bg); color: var(--cancel-ink); }
.chip-area { background: var(--panel-alt); color: var(--muted); border: 1px solid var(--border); font-weight: 500; }
.chip-due { background: var(--panel-alt); color: var(--muted); border: 1px solid var(--border); font-weight: 500; }
.chip-overdue { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); font-weight: 600; }
.chip-muted { background: var(--cancel-bg); color: var(--muted); font-weight: 500; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 650; color: #fff;
}
.avatar.tone-1 { background: #4C6EA8; }
.avatar.tone-2 { background: #7A5AA8; }
.avatar.tone-3 { background: #2F7D6B; }
.avatar.tone-4 { background: #A8683B; }
.avatar.tone-5 { background: #46608A; }
.avatar.none { background: var(--open-bg); color: var(--muted); border: 1px dashed var(--border-strong); }
.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.c-due .chip { white-space: normal; }
.c-due .chip .due { flex-wrap: wrap; row-gap: 2px; text-align: left; }
.due.overdue { color: var(--danger); font-weight: 600; }
.due.nodate { color: var(--muted-soft); }
.task-ref { font-size: 11.5px; color: var(--muted-soft); font-variant-numeric: tabular-nums; }
.empty-state {
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--panel); padding: 24px; text-align: center; max-width: 520px; margin: 8px auto;
}
.empty-title { font-weight: 600; margin-bottom: 4px; }
.empty-text { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.empty-state .action-row { justify-content: center; }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hint { font-size: 12px; color: var(--muted); }
.inline-note {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius);
  padding: 8px 10px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px;
}
.inline-note .btn { margin-left: auto; }

/* ---------- list view ---------- */
.list { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.list-head, .list-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(140px, 1fr) 176px 128px 164px;
  align-items: center; gap: 12px; padding: 0 16px;
}
.list-head { min-height: 38px; background: var(--panel-alt); border-bottom: 1px solid var(--border); }
.list-head [role="columnheader"] { min-width: 0; }
.th {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: transparent; color: var(--muted);
  font-size: 11.5px; font-weight: 600; padding: 4px 0;
}
.th:hover { color: var(--text); }
.th .icon { width: 12px; height: 12px; opacity: 0; }
.th[data-active="true"] { color: var(--text); }
.th[data-active="true"] .icon { opacity: 1; }
.th[data-dir="desc"] .icon { transform: rotate(180deg); }
.group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; background: var(--panel); border-top: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600;
}
.list > .group:first-child .group-head { border-top: 0; }
.group-head .group-count { color: var(--muted); font-weight: 500; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--open-dot); }
.status-dot.s-open { background: var(--open-dot); }
.status-dot.s-in_progress { background: var(--progress-dot); }
.status-dot.s-done { background: var(--done-dot); }
.status-dot.s-cancelled { background: var(--cancel-dot); }
.list-row { min-height: 48px; border-top: 1px solid var(--border); }
.list-row:hover { background: var(--panel-alt); }
.list-row.is-selected { background: var(--accent-soft); }
.list-row.is-cancelled .task-link { text-decoration: line-through; color: var(--muted); }
.c-task { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 0; flex-wrap: wrap; }
.task-link {
  border: 0; background: transparent; padding: 0; text-align: left;
  font-size: 14px; font-weight: 550; color: var(--text); min-width: 0;
  overflow-wrap: anywhere;
}
.task-link:hover { color: var(--accent-ink); text-decoration: underline; }
.c-assignee, .c-due, .c-status, .c-actions { min-width: 0; }
.c-status { justify-self: start; }
.c-actions { display: flex; justify-content: flex-end; }
.group-empty { padding: 10px 16px 14px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--border); }

/* ---------- kanban ---------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(230px, 1fr)); gap: 14px; align-items: start; }
.board-col { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-width: 0; }
.board-col-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13.5px;
}
.board-col-head .count-pill {
  margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--bg); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums;
}
.board-col-body { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.board-col-empty { color: var(--muted-soft); font-size: 12.5px; padding: 8px 4px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm);
}
.card:hover { border-color: var(--border-strong); }
.card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.card-title {
  border: 0; background: transparent; padding: 0; text-align: left;
  font-size: 14px; font-weight: 600; color: var(--text); overflow-wrap: anywhere;
}
.card-title:hover { color: var(--accent-ink); text-decoration: underline; }
.card.is-cancelled .card-title { text-decoration: line-through; color: var(--muted); }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.card-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-top: 2px; }
.card-foot .push { margin-left: auto; }

/* ---------- calendar ---------- */
.cal-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-title { font-size: 15px; font-weight: 620; min-width: 190px; }
.cal-mode { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 2px; gap: 2px; }
.cal-mode button {
  border: 0; background: transparent; color: var(--muted); border-radius: 999px;
  padding: 4px 12px; font-size: 12.5px; font-weight: 550;
}
.cal-mode button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.cal-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-row:last-child .day { border-bottom: 0; }
.cal-weekdays { background: var(--panel-alt); border-bottom: 1px solid var(--border); }
.cal-weekdays span { padding: 8px 10px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.cal-weekdays span.is-weekend { color: var(--muted-soft); font-weight: 500; }
.day { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); min-height: 104px; padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-row > .day:nth-child(7n) { border-right: 0; }
.day.is-outside { background: var(--panel-alt); }
.day.is-outside .day-num { color: var(--muted-soft); font-weight: 500; }
.day.is-today { background: #FAF9FE; box-shadow: inset 0 0 0 1px #CFC7EE; }
.day.is-weekend { background: #FCFDFE; }
.day.is-weekend.is-outside { background: var(--panel-alt); }
.day-head { display: flex; align-items: center; gap: 6px; }
.day-num {
  border: 0; background: transparent; padding: 1px 4px; border-radius: 6px;
  font-size: 12.5px; font-weight: 620; font-variant-numeric: tabular-nums; color: var(--text);
}
.day-num:hover { background: var(--bg); color: var(--accent-ink); }
.day-today-tag { font-size: 11px; color: var(--accent-ink); font-weight: 600; }
.day-count { margin-left: auto; font-size: 11px; color: var(--muted-soft); font-variant-numeric: tabular-nums; }
.day-tasks { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-chip {
  display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 3px 6px; font-size: 12px; text-align: left; background: var(--open-bg); color: var(--open-ink);
}
.cal-chip .cal-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.cal-chip:hover { border-color: var(--border-strong); }
.cal-chip.s-in_progress { background: var(--progress-bg); color: var(--progress-ink); }
.cal-chip.s-done { background: var(--done-bg); color: var(--done-ink); }
.cal-chip.s-cancelled { background: var(--cancel-bg); color: var(--cancel-ink); text-decoration: line-through; }
.cal-chip.is-overdue { background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.cal-chip.is-selected { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-more {
  border: 0; background: transparent; color: var(--muted); font-size: 11.5px;
  text-align: left; padding: 2px 6px; border-radius: var(--radius-sm); font-weight: 600;
}
.cal-more:hover { background: var(--bg); color: var(--text); }
.agenda-note { display: none; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 10px; }
.week-col { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; min-width: 0; }
.week-col-head { display: flex; align-items: baseline; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--panel-alt); }
.week-col-head .cal-more { margin-left: auto; align-self: center; }
.week-col-head .wd { font-size: 12px; color: var(--muted); }
.week-col-head .dnum { font-size: 13.5px; font-weight: 620; font-variant-numeric: tabular-nums; }
.week-col.is-today .week-col-head { background: var(--accent-soft); }
.week-col.is-today .week-col-head .dnum { color: var(--accent-ink); }
.week-col.is-today { border-color: #CFC7EE; }
.week-col-body { display: flex; flex-direction: column; gap: 5px; padding: 8px; min-height: 120px; }
.week-col-empty { color: var(--muted-soft); font-size: 12px; }
.week-col.is-empty { opacity: .9; }
.undated { margin-top: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; }
.undated h3 { font-size: 13px; font-weight: 620; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.undated-list { display: flex; flex-wrap: wrap; gap: 6px; }
.undated-list .cal-chip { width: auto; max-width: 320px; }

/* ---------- panels ---------- */
.panel {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--panel); border-left: 1px solid var(--border); min-width: 0; overflow: hidden;
}
.panel-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.panel-head-text { min-width: 0; flex: 1; }
.panel-eyebrow { font-size: 11.5px; color: var(--muted); }
.panel-head h2 { font-size: 16px; font-weight: 650; margin-top: 2px; overflow-wrap: anywhere; }
.panel-body { overflow-y: auto; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.panel-foot { border-top: 1px solid var(--border); padding: 12px 16px; background: var(--panel-alt); }
.panel-foot-row { display: flex; gap: 8px; flex-wrap: wrap; }
.panel-foot .hint { margin-top: 6px; }
.panel-scrim { position: fixed; inset: 0; z-index: 30; background: rgba(23, 33, 47, .28); border: 0; }
.form-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-field label { font-size: 11.5px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-error { color: var(--danger); font-size: 12px; }
.static-value { min-height: 34px; display: flex; align-items: center; }
.detail-block h3 { font-size: 12.5px; font-weight: 620; color: var(--muted); margin-bottom: 8px; }
.detail-block { display: flex; flex-direction: column; gap: 2px; }
.banner {
  display: flex; align-items: flex-start; gap: 8px;
  border-radius: var(--radius); padding: 10px 12px; font-size: 13px;
  border: 1px solid var(--border); background: var(--panel-alt); color: var(--text);
}
.banner .icon { margin-top: 2px; }
.banner-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.banner.is-warn { background: var(--warn-bg); border-color: #F0DCAE; color: var(--warn-ink); }
.banner.is-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.banner.is-info { background: var(--accent-soft); border-color: #DDD6F4; color: var(--accent-ink); }
.banner.is-success { background: var(--done-bg); border-color: #C9E6D9; color: var(--done-ink); }
.history { display: flex; flex-direction: column; gap: 0; }
.history-item { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.history-item:last-child { border-bottom: 0; }
.history-item .icon { color: var(--muted-soft); margin-top: 2px; }
.history-text { min-width: 0; }
.history-text p { font-size: 13px; overflow-wrap: anywhere; }
.history-meta { font-size: 11.5px; color: var(--muted-soft); font-variant-numeric: tabular-nums; }
.link-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--border);
  font-size: 13px; color: var(--muted); min-width: 0;
}
.link-item:last-child { border-bottom: 0; }
.link-label { font-weight: 550; color: var(--text); }
.link-url { overflow-wrap: anywhere; font-size: 12px; color: var(--muted-soft); }
.link-item-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }

/* ---------- toast ---------- */
.toast-region {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 52px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: #1D2735; color: #fff; border-radius: var(--radius);
  padding: 9px 14px; font-size: 13px; box-shadow: var(--shadow-md); max-width: min(520px, 88vw);
}
.toast .icon { color: #8FE3BE; }

/* ---------- dialogs ---------- */
.dialog {
  border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--panel);
  box-shadow: var(--shadow-md); width: min(620px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  color: var(--text);
}
.dialog.dialog-narrow { width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(23, 33, 47, .38); }
.dialog-inner { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.dialog-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: 16px; font-weight: 650; flex: 1; }
.dialog-body { overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.dialog-foot { display: flex; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--border); background: var(--panel-alt); flex-wrap: wrap; }
.confirm-body { font-size: 13.5px; color: var(--muted); }
.day-list { display: flex; flex-direction: column; gap: 6px; }
.day-task {
  display: flex; align-items: center; gap: 10px; text-align: left;
  border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius);
  padding: 9px 10px; min-width: 0;
}
.day-task:hover { border-color: var(--border-strong); background: var(--panel-alt); }
.day-task .day-task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.day-task .day-task-title { font-weight: 550; overflow-wrap: anywhere; }
.day-task .day-task-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- statusbar ---------- */
.statusbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 7px 20px; background: var(--panel); border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--muted);
}
.status-item { display: inline-flex; align-items: center; gap: 6px; }
.status-item .icon { width: 13px; height: 13px; }
.statusbar .muted { margin-left: auto; color: var(--muted-soft); }

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: #C9D1DE transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #C9D1DE; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #AFB9C9; background-clip: content-box; }

/* ---------- responsive: 1280 ---------- */
@media (max-width: 1280px) {
  :root { --panel-w: 400px; }
  .list-head, .list-row { grid-template-columns: minmax(0, 1.7fr) minmax(112px, 1fr) 156px 116px 44px; }
  .btn-label { display: none; }
}

/* ---------- responsive: 1340 (the detail panel overlays before it squeezes
   the five-column task table; the table itself only gets 4 free columns) ---------- */
@media (max-width: 1340px) {
  .app[data-panel="detail"] { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .panel {
    position: fixed; top: 0; right: 0; height: 100dvh;
    width: min(var(--panel-w), 100vw); z-index: 40; box-shadow: var(--shadow-md);
  }
}

/* ---------- responsive: 1080 (sidebar rail, panel overlay) ---------- */
@media (max-width: 1080px) {
  :root { --sidebar-w: 68px; --panel-w: 440px; }
  .app[data-panel="detail"], .app[data-panel="aino"] { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .brand-text, .nav-label, .nav-count, .sidebar-note { display: none; }
  .nav { padding: 8px; gap: 4px; }
  .nav-item { justify-content: center; padding: 10px 0; position: relative; }
  .nav-item .badge { position: absolute; top: 4px; right: 6px; }
  .sidebar-foot { padding: 10px 8px; }
  .sidebar-foot .btn { padding: 6px; }
  .sidebar-foot .btn span { display: none; }
  .panel {
    position: fixed; top: 0; right: 0; height: 100dvh;
    width: min(var(--panel-w), 100vw); z-index: 40; box-shadow: var(--shadow-md);
  }
  .list-head, .list-row { grid-template-columns: minmax(0, 2fr) minmax(120px, 1fr) 118px 118px 40px; }
}

/* ---------- responsive: 900 (list stacks, kanban scrolls) ---------- */
@media (max-width: 900px) {
  .list-head { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 12px; }
  .list-head [role="columnheader"].col-actions { display: none; }
  .th { border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; background: var(--panel); }
  .list-row {
    grid-template-columns: minmax(0, 1fr) minmax(112px, auto) auto;
    grid-template-areas: "task task status" "assignee due actions";
    row-gap: 8px; padding: 12px;
  }
  .c-task { grid-area: task; padding: 0; }
  .c-assignee { grid-area: assignee; }
  .c-due { grid-area: due; }
  .c-status { grid-area: status; justify-self: end; }
  .c-actions { grid-area: actions; justify-self: end; }
  .board {
    display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px;
    scroll-snap-type: x proximity;
  }
  .board-col { flex: 0 0 min(84%, 320px); scroll-snap-align: start; }
  .cal-week { grid-template-columns: 1fr; }
  .day.is-empty { display: none; }
  .week-col.is-empty { display: none; }
  .cal-weekdays { display: none; }
  .cal-row { grid-template-columns: 1fr; }
  .day { border-right: 0; min-height: 0; padding: 10px 12px; }
  .day.is-outside { display: none; }
  .agenda-note { display: block; }
  .day::before {
    content: attr(data-label);
    font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px;
  }
}

/* ---------- responsive: 768 (sidebar drawer, fullscreen panel) ---------- */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .app, .app[data-panel="detail"], .app[data-panel="aino"] { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50; width: 264px; height: 100dvh;
    transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-md);
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .brand-text, .nav-label, .nav-count, .sidebar-note { display: block; }
  .nav-item { justify-content: flex-start; padding: 9px 10px; }
  .nav-item .badge { position: static; margin-left: auto; }
  .sidebar-foot .btn span, .sidebar-foot .btn .btn-label { display: inline; }
  .nav-toggle { display: inline-grid; }
  .topbar { padding: 12px 14px; flex-wrap: wrap; gap: 10px; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .search-field { flex: 1 1 180px; min-width: 0; }
  .viewbar { padding: 10px 14px 12px; }
  .surface { padding: 12px 14px 24px; }
  .statusbar { padding: 7px 14px; gap: 10px; }
  .statusbar .muted { margin-left: 0; }
  .panel { width: 100%; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .board-col { flex: 0 0 88%; }
  .toast-region { bottom: 72px; }
  .undated-list .cal-chip { max-width: 100%; }
}

/* ---------- responsive: 640 ---------- */
@media (max-width: 640px) {
  .topbar h1 { font-size: 18px; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; padding: 6px 8px; }
  /* give the due date its own line so a full date is never clipped */
  .list-row { grid-template-areas: "task task status" "assignee assignee actions" "due due due"; }
  .c-due { justify-self: start; }
  .filters { align-items: stretch; }
  .filters .field { flex: 1 1 44%; }
  .filters select { width: 100%; min-width: 0; }
  .quick { width: 100%; }
  .dialog { width: calc(100vw - 20px); }
  .day-task { padding: 10px; }
  .board-col { flex: 0 0 92%; }
}

/* ---------- responsive: 1341+ (panel beside a compact but readable table) ---------- */
@media (min-width: 1341px) {
  .app[data-panel="detail"] { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 400px; }
  .app[data-panel="detail"] .list-head,
  .app[data-panel="detail"] .list-row {
    grid-template-columns: minmax(0, 2fr) minmax(112px, 1fr) 148px 104px 44px;
  }
  .app[data-panel="detail"] .c-actions .btn-label { display: none; }
}

/* ---------- teamspace: shared workspace additions ---------- */

#loadNotice { padding: 10px 20px 0; }

.identity-block { padding: 10px 12px 8px; border-top: 1px solid var(--border); }
.identity-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.identity-meta { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.ws-switch { padding: 0 12px 8px; }
.ws-switch select { width: 100%; min-width: 0; }

.check-field { display: flex; flex-direction: row; align-items: center; gap: 6px; }
.check-field input { width: 15px; height: 15px; accent-color: var(--accent); }
.check-field label { font-size: 12.5px; color: var(--text); }

.who-inactive {
  font-size: 10.5px; font-weight: 600; color: var(--warn-ink);
  background: var(--warn-bg); border-radius: 4px; padding: 1px 5px; margin-left: 6px;
  white-space: nowrap;
}
.history-lines { display: flex; flex-direction: column; gap: 2px; }
.history-lines li { font-size: 13px; overflow-wrap: anywhere; }

.auth-shell {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  padding: 24px 16px; background: var(--bg);
}
.auth-panel { width: min(420px, 100%); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.auth-panel h1 { font-size: 20px; font-weight: 650; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.auth-form input { min-height: 34px; }
.ws-list { display: flex; flex-direction: column; gap: 8px; }
.ws-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel-alt); color: var(--text); text-decoration: none;
}
.ws-item:hover { border-color: var(--accent); }
.ws-item-name { font-weight: 600; }
.ws-item-meta { font-size: 12px; color: var(--muted); }

.members-app { height: 100dvh; }
.members-surface {
  padding: 18px 20px 32px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto;
}
.members-block { display: flex; flex-direction: column; gap: 10px; max-width: 1000px; }
.members-block h2 { font-size: 15px; font-weight: 650; }
.members-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.members-head, .members-row {
  display: grid; gap: 10px; padding: 10px 12px; align-items: center;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 0.8fr) minmax(0, 1.1fr);
}
.members-head {
  background: var(--panel-alt); font-size: 12px; font-weight: 620; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.members-row { border-bottom: 1px solid var(--border); font-size: 13px; }
.members-row:last-child { border-bottom: 0; }
.members-row.is-inactive { color: var(--muted); background: var(--panel-alt); }
.member-name, .member-username { overflow-wrap: anywhere; }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-form select { min-width: 0; }
.member-form { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }

@media (max-width: 900px) {
  .members-head { display: none; }
  .members-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .members-row > span::before {
    content: ''; display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px;
  }
}

@media (max-width: 640px) {
  #loadNotice { padding: 10px 14px 0; }
  .members-surface { padding: 14px 14px 28px; }
}
