/* Layout: app shell, header, sidebar, stats, composer, toolbar and page-level banners. */

/* ---- Shell ---- */
.app {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 20px;
}
.wrap { width: 100%; max-width: 1000px; min-width: 0; margin: 0 auto; padding: 0; }
/* Board and Insights use the whole column */
body.wide .wrap { max-width: none; }
/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.tb-inner {
  display: flex; align-items: center; gap: 22px;
  height: 100%; max-width: 1680px; margin: 0 auto; padding: 0 20px;
}
.tb-left { display: flex; align-items: center; gap: 10px; width: 250px; flex: none; }
.tb-brand { display: flex; align-items: center; gap: 10px; padding-left: 12px; font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 3.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); }
  50% { box-shadow: 0 0 0 8px transparent; }
}
.tb-center { flex: 1; min-width: 0; }
.top-tools { position: relative; display: flex; gap: 8px; align-items: center; flex: none; }
button.tb-new { gap: 6px; padding: 0 14px; }
button.tb-new svg { width: 16px; height: 16px; flex: none; }
.sidebar-btn { display: none; }

/* ---- Page heading ---- */
.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 20px 0 12px; }
h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.02em; }
.sub { flex: 1 1 200px; min-width: 0; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { color: var(--muted); font-size: 13px; white-space: nowrap; }
/* ---- Sidebar ---- */
.sidebar {
  position: sticky; top: var(--topbar-h); align-self: start; height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 4px 24px 0;
}
.side-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--faint); font-weight: 700;
  padding: 18px 12px 6px;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: var(--h-md);
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.nav-hit {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  min-height: var(--h-md);
  background: none; border: none; color: inherit; font: inherit; font-size: 14px;
  text-align: left; padding: 0; cursor: pointer;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.on {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.nav-item .ico { width: 18px; text-align: center; font-size: 14px; color: var(--faint); transition: color .15s; }
.nav-item:hover .ico { color: var(--muted); }
.nav-item.on .ico { color: var(--accent); }
.nav-item .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .cnt {
  font-size: 11.5px; font-weight: 600; color: var(--faint);
  padding: 0 4px;
  font-variant-numeric: tabular-nums;
  transition: opacity .15s;
}
.nav-item .cnt:empty { display: none; }
.nav-item.on .cnt { color: var(--accent); }
.nav-item .more, .nav-item .nav-del {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; padding: 0;
  display: grid; place-items: center;
  border: none; border-radius: var(--r-sm);
  background: var(--panel-3); color: var(--muted);
  font-size: 15px; line-height: 1; letter-spacing: 1px;
  cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity .15s, color .15s, background .15s;
}
.nav-item:hover .more, .nav-item:focus-within .more,
.nav-item:hover .nav-del, .nav-item:focus-within .nav-del { opacity: 1; pointer-events: auto; }
.nav-item:hover .cnt, .nav-item:focus-within .cnt { opacity: 0; }
.nav-item .more:hover { color: var(--text); background: var(--border); }
.nav-item .nav-del:hover { color: var(--high); background: color-mix(in srgb, var(--high) 16%, var(--panel-3)); }
.proj-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.add-proj { display: flex; gap: 6px; padding: 6px 4px 0; }
.add-proj input { flex: 1; width: auto; height: 34px; background: var(--panel); }
.add-proj button {
  display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--panel-3); color: var(--text);
  font-size: 18px; line-height: 1;
}
.add-proj button:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.side-collapse {
  display: flex; align-items: center; gap: 10px; margin-top: auto;
  min-height: var(--h-md); padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--r-md); background: none;
  color: var(--faint); font: inherit; font-size: 13px; cursor: pointer;
  transition: color .15s, background .15s;
}
.side-collapse svg { width: 16px; height: 16px; flex: none; transition: transform .2s var(--ease); }
.side-collapse:hover { color: var(--text); background: var(--panel-2); }
.sidebar-foot { margin-top: 8px; padding: 18px 12px 0; font-size: 12px; color: var(--faint); line-height: 1.6; }
.sidebar-foot b { color: var(--muted); }
.side-backdrop {
  position: fixed; inset: 0; background: rgba(4, 6, 12, .55); z-index: 55;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.side-backdrop.show { opacity: 1; pointer-events: auto; }

.history { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 2px; }
.history li button {
  width: 100%; display: flex; justify-content: space-between; gap: 8px; align-items: center;
  min-height: 30px;
  background: none; border: none; color: var(--muted); font: inherit; font-size: 12.5px;
  text-align: left; padding: 0 10px; border-radius: var(--r-sm); cursor: pointer;
}
.history li button:hover { background: var(--panel-2); color: var(--text); }
.history li button span { color: var(--faint); font-variant-numeric: tabular-nums; flex: none; }
.history-empty { color: var(--faint); font-size: 12.5px; padding: 4px 10px 8px; }

/* ---- Stats: compact filter pills + thin progress ---- */
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.stat {
  display: inline-flex; align-items: center; gap: 7px;
  height: var(--h-sm); padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--inset-top);
  transition: transform .18s var(--ease), border-color .18s, background .18s;
}
.stat:hover { transform: translateY(-1px); border-color: var(--border-2); }
.stat .n { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat.s-open .n { color: var(--accent); }
.stat.s-done .n { color: var(--low); }
.stat.s-high .n { color: var(--high); }
.stat[role="button"] { cursor: pointer; user-select: none; }
.stat.sel { border-color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.progress { height: 4px; border-radius: 999px; background: var(--panel-3); overflow: hidden; margin-bottom: 14px; }
.progress > i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--low));
  transition: width .6s var(--ease);
}
/* ---- Banners ---- */
.notice {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 12px; padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  color: var(--muted); font-size: 13px;
  box-shadow: var(--inset-top);
}
.notice span { flex: 1; min-width: 180px; }
.notice button { flex: none; }
.morning { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.morning button {
  display: inline-flex; align-items: center; gap: 8px;
  height: var(--h-sm); padding: 0 12px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; font: inherit; font-size: 13px; cursor: pointer;
}
.morning button:hover { border-color: var(--accent); }
.morning button b { font-variant-numeric: tabular-nums; }
.morning button.over b { color: var(--high); }
.morning button.today b { color: var(--medium); }
.morning button.doing b { color: var(--doing); }

/* ---- Composer ---- */
.composer {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px;
  margin-bottom: 14px;
  box-shadow: var(--inset-top), var(--shadow-sm);
  transition: border-color .18s;
  animation: riseIn .45s var(--ease) both;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.row { display: flex; gap: 10px; align-items: stretch; }
.row > * { flex: 1; min-width: 0; }
.row .field { margin: 0; }
.composer .row select { flex: 1 1 140px; }
.composer input, .composer textarea, .composer select { margin-bottom: 10px; }
.head-row { align-items: center; margin-bottom: 0; }
.head-row input, .head-row .btn { margin-bottom: 0; }
.composer .head-row #f-title { height: var(--h-lg); font-size: 14.5px; padding: 0 14px; border-radius: var(--r-md); }
#add { flex: 0 0 auto; height: var(--h-lg); padding: 0 22px; font-size: 14px; border-radius: var(--r-md); }
/* Options row appears once the composer is in use, keeping the idle state to one line */
.composer-foot { display: none; align-items: center; gap: 8px; margin-top: 10px; }
.composer:focus-within .composer-foot, .composer:has(#composer-more:not([hidden])) .composer-foot, .composer:has(.capture-preview:not([hidden])) .composer-foot { display: flex; }
#composer-more { margin-top: 10px; }
.composer-foot .more-opts { margin-right: auto; }
.more-opts { display: inline-flex; align-items: center; gap: 5px; }
.more-opts::after { content: "\25BE"; font-size: 9px; opacity: .75; transition: transform .2s; }
.more-opts[aria-expanded="true"]::after { transform: rotate(180deg); }
.capture-preview { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.capture-preview .cp-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin-right: 2px; }

/* #tag / @project autocomplete under the title field */
.ac-list {
  position: absolute; left: 12px; right: 12px; top: 60px; z-index: 45;
  padding: 5px; max-height: 232px; overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  box-shadow: var(--inset-top), var(--shadow-lg);
}
.ac-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 34px; padding: 0 10px;
  border: none; border-radius: var(--r-sm); background: none;
  color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.ac-item:hover, .ac-item.sel { background: var(--accent-soft); }
.ac-meta { font-size: 11px; color: var(--faint); }

/* ---- Toolbar: every control is --h-md tall, sticks under the top bar ---- */
.toolbar {
  position: sticky; top: var(--topbar-h); z-index: 30;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 8px; padding: 8px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.toolbar > button.ghost { background: var(--panel); border-radius: var(--r-md); }
.toolbar > button.ghost[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
#select-mode { margin-left: auto; }

/* search lives in the top bar */
.search-wrap { position: relative; width: 100%; max-width: 560px; margin: 0 auto; }
.search-wrap svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--faint); pointer-events: none;
}
.topbar input[type="search"] { padding: 0 66px 0 34px; }
.clear-search, .pin-search {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  width: var(--h-xs); height: var(--h-xs); padding: 0;
  border: none; border-radius: var(--r-xs); background: none;
  color: var(--faint); line-height: 1; cursor: pointer;
  transition: color .15s, background .15s;
}
.clear-search { right: 8px; font-size: 16px; }
.pin-search { right: 34px; font-size: 14px; }
.clear-search:hover, .pin-search:hover { color: var(--text); background: var(--panel-3); }
.pin-search.on { color: var(--star); }
.seg {
  display: inline-flex; align-items: center; gap: 2px;
  height: var(--h-md); padding: 3px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.seg button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 12px;
  border: none; background: none; color: var(--muted);
  font-size: 13px; font-weight: 500; border-radius: var(--r-sm);
  transition: background .18s, color .18s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel-3); color: var(--text); font-weight: 600; box-shadow: var(--inset-top); }
.seg button svg { width: 15px; height: 15px; }
.seg.full { display: flex; width: 100%; height: auto; padding: 3px; margin: 4px 0 2px; }
.seg.full button { flex: 1; }

/* ---- Tag bar and chips ---- */
.tagbar { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; align-items: center; scrollbar-width: none; }
.tagbar::-webkit-scrollbar { display: none; }
.tagbar > * { flex: none; }
.tagbar:empty { display: none; }
.tagbar-more { font-weight: 600; }
.chip {
  display: inline-flex; align-items: center;
  height: 26px; padding: 0 11px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer; user-select: none;
  transition: background .18s, color .18s, transform .16s, border-color .18s;
}
.chip:hover { transform: translateY(-1px); color: var(--text); }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.board-switch { display: none; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.board-switch button.on { background: var(--panel-3); color: var(--text); }

/* ---- Empty state ---- */
.empty {
  text-align: center; color: var(--muted);
  padding: 56px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--panel) 50%, transparent);
  font-size: 14px;
  animation: riseIn .4s ease both;
}
.empty .big { font-size: 34px; display: block; margin-bottom: 8px; }
.empty.welcome { padding: 40px 24px; border-style: solid; border-color: var(--border); background: var(--panel); box-shadow: var(--inset-top), var(--shadow-sm); }
.welcome-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.welcome-text { max-width: 460px; margin: 8px auto 18px; line-height: 1.55; }
.welcome-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.welcome-tips { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-top: 22px; font-size: 12.5px; color: var(--faint); }
.welcome-tips .kbd { margin-right: 3px; }

/* ---- "Now" spotlight and triage ---- */
.triage-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 22px;
  box-shadow: var(--inset-top), var(--shadow-sm);
}
.triage-kicker { color: var(--faint); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px; }
.triage-card h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.02em; }
.triage-keys { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.triage-keys button, .triage-hits button { font: inherit; cursor: pointer; }
.triage-keys .btn { height: var(--h-md); padding: 0 14px; font-size: 13px; border-radius: var(--r-sm); }
.triage-keys button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.triage-query { color: var(--muted); font-size: 13px; min-height: 1.4em; }
.triage-hits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.triage-hits button.chip { height: 26px; padding: 0 11px; font-size: 12px; border-radius: 999px; }
