/* colab — app styles. Light theme, warm greys, one accent. */

:root {
  --bg: #f4f3f0;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --sunken: #ebe9e4;
  --line: #e4e1db;
  --line-strong: #d3cfc7;
  --text: #1c1a17;
  --text-2: #55514a;
  --text-3: #8b867d;

  --accent: #3b52c4;
  --accent-hover: #3246ab;
  --accent-soft: #edf0fb;
  --accent-text: #2d3f99;
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px rgba(59, 82, 196, 0.55);

  --danger: #b9382c;
  --danger-hover: #a02f24;
  --danger-soft: #fbecea;
  --success: #2c7a4b;
  --success-soft: #e7f2eb;
  --done: #6f6a62;

  /* Must match the overlay's highlight colours (spec §8). */
  --hl: rgba(255, 212, 0, 0.35);
  --hl-active: rgba(255, 170, 0, 0.6);
  --hl-solid: #f5c400;

  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(28, 26, 23, 0.06);
  --shadow: 0 1px 2px rgba(28, 26, 23, 0.06), 0 4px 12px rgba(28, 26, 23, 0.06);
  --shadow-lg: 0 2px 6px rgba(28, 26, 23, 0.08), 0 12px 32px rgba(28, 26, 23, 0.14);

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --toolbar-h: 52px;
  --sidebar-w: 360px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 620; letter-spacing: -0.005em; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--text-3); }
.link { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.icon { flex: none; display: block; }

:focus-visible { outline: none; box-shadow: var(--focus); }

::selection { background: rgba(59, 82, 196, 0.18); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 520;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--surface-2); border-color: #c4bfb6; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: rgba(28, 26, 23, 0.05); border-color: transparent; color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }

.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.btn-icon:hover { background: rgba(28, 26, 23, 0.06); color: var(--text); text-decoration: none; }
.btn-icon[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.btn-icon:disabled { opacity: 0.35; cursor: not-allowed; background: transparent; }
.btn-icon-sm { width: 24px; height: 24px; }
.btn-icon-danger:hover { color: var(--danger); background: var(--danger-soft); }
.btn-icon-resolve:hover { color: var(--success); background: var(--success-soft); }

/* ---------- form controls ---------- */

.input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:hover { border-color: #c2bdb4; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 82, 196, 0.16); }
.input:disabled { background: var(--surface-2); color: var(--text-3); }
.input::placeholder { color: #aaa49a; }
textarea.input { height: auto; padding: 8px 10px; line-height: 1.45; resize: none; }
select.input {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2355514a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  text-overflow: ellipsis;
  cursor: pointer;
}
.input-sm { height: 32px; font-size: 13px; }
.input:user-invalid { border-color: var(--danger); }

.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label { font-size: 13px; font-weight: 560; color: var(--text-2); }
.field-hint { font-size: 12.5px; color: var(--text-3); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.fieldset { display: grid; gap: 14px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.fieldset legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.form-error { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.stack { display: grid; gap: 16px; }

.switch {
  appearance: none;
  position: relative;
  width: 28px;
  height: 16px;
  margin: 0;
  flex: none;
  border-radius: 99px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s var(--ease);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(12px); }
.switch-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; white-space: nowrap; }

.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: var(--radius);
  background: var(--sunken);
}
.segmented-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 520;
  cursor: pointer;
  white-space: nowrap;
}
.segmented-btn:hover { color: var(--text); }
.segmented-btn[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px rgba(28, 26, 23, 0.04); }

/* ---------- small atoms ---------- */

.avatar {
  --avatar-hue: 220;
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: hsl(var(--avatar-hue) 32% 88%);
  color: hsl(var(--avatar-hue) 35% 30%);
  font-weight: 640;
  letter-spacing: 0.01em;
  user-select: none;
}
.avatar-xs { width: 18px; height: 18px; font-size: 8.5px; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-md { width: 34px; height: 34px; font-size: 12.5px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--sunken);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 560;
  white-space: nowrap;
}
.tag-accent { background: var(--accent-soft); color: var(--accent-text); }
.tag-done { background: var(--success-soft); color: var(--success); }

.count-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 580;
  white-space: nowrap;
}
.count-pill-open { background: #fff4c7; color: #7a5a00; }
.count-pill-zero { background: var(--sunken); color: var(--text-2); }

.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-added { background: var(--success-soft); color: var(--success); }
.badge-changed { background: #fff4c7; color: #7a5a00; }
.badge-removed { background: var(--danger-soft); color: var(--danger); }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 64px 16px; color: var(--text-3); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { display: grid; justify-items: center; gap: 8px; padding: 64px 16px; text-align: center; }
.empty-title { font-size: 16px; font-weight: 620; }
.empty-text { max-width: 420px; color: var(--text-2); }
.empty .btn { margin-top: 10px; }

/* ---------- toasts ---------- */

.toast-region { position: fixed; left: 50%; bottom: 20px; z-index: 1000; display: grid; gap: 8px; justify-items: center; transform: translateX(-50%); pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #23211e;
  color: #f4f3f0;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.2s var(--ease);
}
.toast-error { background: var(--danger); color: #fff; }
.toast-success .icon { color: #8fd6a8; }
.toast-out { animation: toast-out 0.2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- dialogs ---------- */

.dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.dialog-wide { width: min(640px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(28, 26, 23, 0.32); }
.dialog[open] { animation: dialog-in 0.18s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(0.985); } }
.dialog-form { display: flex; flex-direction: column; max-height: inherit; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 0 20px; }
.dialog-head h2 { font-size: 16px; }
.dialog-body { display: grid; gap: 14px; padding: 16px 20px; overflow: auto; }
.dialog-text { color: var(--text-2); }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 48px 24px 56px;
  border: 0;
  background: rgba(20, 19, 17, 0.88);
  display: none;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 120px); border-radius: var(--radius); box-shadow: var(--shadow-lg); background: #fff; }
.lightbox-close { position: absolute; top: 12px; right: 12px; color: #e8e6e1; width: 36px; height: 36px; }
.lightbox-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.lightbox-open { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; color: #d9d6cf; font-size: 13px; }
.lightbox-open:hover { color: #fff; }

/* ---------- account menu ---------- */

.account { position: relative; }
.account-trigger { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.account-trigger:hover .avatar { filter: brightness(0.96); }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.menu-head { display: grid; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-head span { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font-size: 13.5px; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item .icon { color: var(--text-3); }

/* ---------- app shell (lists, settings) ---------- */

.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 680; font-size: 15px; letter-spacing: -0.01em; flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #243b8f;
  position: relative;
  flex: none;
}
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: #ffd400; }
/* speech bubble: body + tail */
.brand-mark::before { left: 5px; top: 6px; width: 12px; height: 8px; border-radius: 2px; }
.brand-mark::after { left: 6px; top: 13px; width: 4px; height: 4px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.brand-mark-lg { width: 36px; height: 36px; border-radius: 9px; }
.brand-mark-lg::before { left: 8px; top: 10px; width: 20px; height: 13px; border-radius: 3px; }
.brand-mark-lg::after { left: 10px; top: 22px; width: 6px; height: 6px; }

.app-header { position: sticky; top: 0; z-index: 40; background: rgba(244, 243, 240, 0.88); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.app-header-inner { display: flex; align-items: center; gap: 12px; max-width: 1160px; height: 56px; margin: 0 auto; padding: 0 24px; }
.app-header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-2); font-weight: 520; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { color: var(--line-strong); }

.page { max-width: 1160px; margin: 0 auto; padding: 32px 24px 80px; }
.page-narrow { max-width: 860px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-sub { margin-top: 4px; color: var(--text-3); font-size: 13.5px; }
.page-intro { margin: -8px 0 20px; color: var(--text-2); max-width: 620px; }

.tabs { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--sunken); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 6px; color: var(--text-2); font-size: 13px; font-weight: 540; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- login ---------- */

.view-login { min-height: 100dvh; display: grid; }
.login { display: grid; place-items: center; align-content: center; gap: 20px; padding: 32px 16px; background: radial-gradient(1200px 600px at 50% -10%, #fbfaf8, transparent), var(--bg); }
.login-card { width: min(380px, 100%); padding: 32px 28px 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.login-brand h1 { font-size: 24px; }
.login-lead { margin-bottom: 24px; color: var(--text-2); }
.login-form { display: grid; gap: 16px; }
.login-form .btn { height: 38px; margin-top: 4px; }
.login-foot { color: var(--text-3); font-size: 12.5px; text-align: center; }

/* ---------- projects ---------- */

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.project-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s; }
.project-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.project-card-link { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; row-gap: 12px; padding: 18px 18px 14px; color: inherit; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.project-card-link:hover { text-decoration: none; }
.project-card-link:hover .project-name { color: var(--accent-text); }
.project-thumb { grid-row: span 1; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(145deg, #f1efe9, #e3e0d8); color: var(--text-2); font-size: 17px; font-weight: 680; }
.project-card-body { display: grid; align-content: center; gap: 2px; min-width: 0; }
.project-name { font-size: 15.5px; font-weight: 640; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-meta { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-card-link .count-pill { grid-column: 1 / -1; justify-self: start; }
.project-card-actions { display: flex; align-items: center; gap: 2px; margin-top: auto; padding: 6px 8px; border-top: 1px solid var(--line); }
.project-date { margin-left: auto; padding-right: 8px; color: var(--text-3); font-size: 12px; }

/* ---------- users ---------- */

.user-list, .member-list, .version-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.user-row, .version-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.user-row + .user-row, .version-row + .version-row, .member-list li + li { border-top: 1px solid var(--line); }
.user-main { display: grid; min-width: 0; flex: 1; }
.user-name { font-weight: 580; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-email { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 2px; flex: none; }

/* ---------- to-dos ---------- */

.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 200px)); gap: 12px; margin-bottom: 24px; }
.todo-group { margin-bottom: 28px; }
.todo-group-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; font-size: 14.5px; }
.todo-group-path { color: var(--text-3); font-weight: 450; font-size: 12.5px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.todo-group-title .count-pill { margin-left: auto; height: 20px; }
.todo-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.todo { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 14px; padding: 14px 16px; }
.todo + .todo { border-top: 1px solid var(--line); }
.todo:hover { background: var(--surface-2); }
.todo-check {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.12s, border-color 0.12s;
}
.todo-check:hover { border-color: var(--success); }
.todo-check:checked { background: var(--success); border-color: var(--success); }
.todo-check:checked::after { content: ""; width: 8px; height: 4px; margin-top: -2px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg); }
.todo-main { display: grid; gap: 5px; min-width: 0; color: inherit; }
.todo-main:hover { text-decoration: none; }
.todo-main:hover .todo-body { color: var(--accent-text); }
.todo-quote { display: block; padding-left: 9px; border-left: 3px solid var(--hl-solid); color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-body { font-weight: 520; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.todo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text-3); font-size: 12.5px; }
.todo-vp, .todo-resolved { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; }
.todo-resolved { color: var(--success); }
.todo.is-done .todo-body { color: var(--text-3); text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, 0.25); }
.todo-shot { width: 96px; height: 64px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; cursor: zoom-in; flex: none; }
.todo-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }
.todo-shot-empty { display: grid; place-items: center; color: var(--line-strong); cursor: default; }
.quote-kind { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; padding: 0 5px; border-radius: 4px; background: var(--sunken); color: var(--text-2); font-size: 11px; font-weight: 600; vertical-align: 1px; }

/* ---------- settings ---------- */

.settings-section { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; padding: 28px 0; border-top: 1px solid var(--line); }
.settings-section:first-of-type { border-top: 0; padding-top: 4px; }
.settings-section > header { display: grid; align-content: start; gap: 6px; }
.settings-section > header p { color: var(--text-3); font-size: 13px; }
.section-body { display: grid; gap: 16px; min-width: 0; }
.settings-danger h2 { color: var(--danger); }
.danger-row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid #efcfca; border-radius: var(--radius-lg); background: var(--danger-soft); }
.danger-row p { flex: 1; color: var(--text-2); font-size: 13px; }

.dropzone {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 28px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone .icon { color: var(--text-3); margin-bottom: 4px; }
.dropzone strong { color: var(--text); font-weight: 600; }
.dropzone span { font-size: 13px; }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-over .icon { color: var(--accent); }

.progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.progress-track { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.2s; }
.progress.is-processing .progress-bar { width: 100% !important; background: linear-gradient(90deg, var(--accent) 0%, #8d9be0 50%, var(--accent) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.progress-text { color: var(--text-2); font-size: 13px; }

.source-import { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.source-import > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.source-import p { font-size: 12.5px; overflow-wrap: anywhere; }

.push-hint summary { cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 540; }
.push-hint summary:hover { color: var(--text); }
.push-hint[open] summary { margin-bottom: 8px; }
.push-hint > p { margin-bottom: 8px; font-size: 12.5px; }
.code { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-radius: var(--radius); background: #23211e; color: #ece9e2; }
.code code { flex: 1; font: 12.5px/1.5 var(--mono); overflow-x: auto; white-space: nowrap; }
.code .btn-icon { color: #bdb8ae; }
.code .btn-icon:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.version-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.version-label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.version-meta, .version-source { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; }
.member:hover { background: var(--surface-2); }
.member input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

/* ---------- full-height tool views (viewer, compare) ---------- */

.view-viewer, .view-compare { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  height: var(--toolbar-h);
  padding: 0 12px 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: relative;
  z-index: 30;
}
.toolbar .brand-name { display: none; }
.toolbar-project { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 620; letter-spacing: -0.005em; padding-right: 4px; }
.toolbar-group { display: flex; align-items: center; gap: 6px; min-width: 0; }
.toolbar-group > select { width: auto; max-width: 220px; }
.toolbar-group > .page-select { max-width: 300px; }
.toolbar-spacer { flex: 1; min-width: 4px; }
.toolbar-divider { width: 1px; height: 22px; background: var(--line); flex: none; }
.toolbar-nav { gap: 0; }
.toolbar .btn-sm { padding: 0 8px; }
.nav-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #ffe680; color: #6b4f00; font-size: 11px; font-weight: 680; }

@media (max-width: 1520px) {
  .toolbar-nav .label-wide { display: none; }
}
@media (max-width: 1280px) {
  .toolbar-nav .label { display: none; }
}
@media (max-width: 1180px) {
  .toolbar .segmented-btn span { display: none; }
  .toolbar .segmented-btn { padding: 0 7px; }
}
@media (max-width: 1100px) {
  .toolbar-project { max-width: 130px; }
  .toolbar-group > select { max-width: 150px; }
  .toolbar-group > .page-select { max-width: 190px; }
}

/* viewer */

.viewer-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--sidebar-w); position: relative; }
.viewer-body.sidebar-collapsed { grid-template-columns: minmax(0, 1fr) 0; }
.viewer-body.sidebar-collapsed .sidebar { visibility: hidden; }

.stage { position: relative; overflow: hidden; background: var(--sunken); background-image: radial-gradient(rgba(28, 26, 23, 0.07) 1px, transparent 1px); background-size: 16px 16px; }
.frame-wrap { position: absolute; overflow: hidden; background: #fff; border-radius: 6px; box-shadow: 0 0 0 1px rgba(28, 26, 23, 0.08), var(--shadow-lg); }
.stage[data-vp="mobile"] .frame-wrap, .stage[data-vp="tablet"] .frame-wrap { border-radius: 14px; box-shadow: 0 0 0 6px #2a2825, 0 0 0 7px #3b3935, var(--shadow-lg); }
.frame { display: block; border: 0; transform-origin: 0 0; background: #fff; }
.stage-progress { position: absolute; left: 0; right: 0; top: 0; height: 2px; z-index: 5; overflow: hidden; }
.stage-progress::after { content: ""; position: absolute; inset: 0; width: 30%; background: var(--accent); animation: indeterminate 1.1s var(--ease) infinite; }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.stage-notice { position: absolute; left: 50%; bottom: 20px; z-index: 6; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: min(560px, calc(100% - 32px)); padding: 10px 14px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); color: var(--text-2); font-size: 13px; }
.stage-notice .icon { color: #b07d00; }

.fab {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 99px;
  background: var(--text);
  color: #fff;
  font-size: 13px;
  font-weight: 560;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  animation: fab-in 0.14s var(--ease);
}
.fab:hover { background: #000; }
.fab .icon { color: var(--hl-solid); }
@keyframes fab-in { from { opacity: 0; scale: 0.9; } }

/* sidebar */

.sidebar { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--surface-2); overflow: hidden; }
.sidebar-head { display: flex; align-items: center; gap: 8px; flex: none; height: 44px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.sidebar-head h2 { font-size: 13.5px; }
.sidebar-count { color: #7a5a00; background: #fff4c7; border-radius: 99px; padding: 0 7px; font-size: 11.5px; font-weight: 620; line-height: 19px; }
.sidebar-count:empty { display: none; }
.spacer { flex: 1; }

.track { position: relative; flex: 1; min-height: 120px; overflow: hidden; }
.track-layer { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.track-hint { position: absolute; left: 16px; right: 16px; top: 16px; display: grid; gap: 4px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--text-3); font-size: 13px; }
.track-hint strong { color: var(--text-2); font-weight: 580; }

.card {
  --x: 0px;
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.card:hover { border-color: var(--line-strong); }
.track-layer > .card { position: absolute; left: 14px; right: 14px; top: 0; transform: translate3d(var(--x), var(--y, 0px), 0); transition: transform 0.22s var(--ease), box-shadow 0.15s, border-color 0.15s; }
.card.is-active { --x: -18px; cursor: default; border-color: transparent; box-shadow: var(--shadow-lg), 0 0 0 1px rgba(28, 26, 23, 0.05); z-index: 2; }
.card.is-active::before { content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--hl-solid); }
.card.is-done { background: #fbfaf8; }
.card.is-done .comment-body { color: var(--text-2); }
.card-actions { position: absolute; top: 7px; right: 7px; z-index: 1; display: flex; gap: 2px; }
.card-actions .btn-icon { width: 26px; height: 26px; }
.card-tags { display: flex; align-items: center; gap: 6px; padding-right: 30px; }
.vp-badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; font-weight: 560; cursor: pointer; }
.vp-badge:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.card-quote { margin: 0; padding: 2px 0 2px 9px; border-left: 3px solid var(--hl-solid); color: var(--text-2); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.comment { display: grid; gap: 4px; }
.comment-head { display: flex; align-items: center; gap: 8px; min-width: 0; padding-right: 30px; }
.comment-author { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-head time { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.role-dot { padding: 0 5px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-text); font-size: 10.5px; font-weight: 640; line-height: 16px; }
.comment-delete { margin-left: auto; opacity: 0; color: var(--text-3); }
.comment:hover .comment-delete, .comment-delete:focus-visible { opacity: 1; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; padding-left: 32px; }
.card:not(.is-active) .comment-body { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.comment .thumbs { padding-left: 32px; }
.replies { display: grid; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.replies .comment-head { padding-right: 0; }
.card-replies { display: flex; align-items: center; gap: 6px; padding-left: 32px; color: var(--accent-text); font-size: 12.5px; font-weight: 560; }
.card-resolved { display: flex; align-items: center; gap: 5px; color: var(--success); font-size: 12.5px; }

.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; padding: 0; list-style: none; }
.thumb { display: block; width: 64px; height: 48px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }
.thumbs li:has(> .thumb-shot) { flex: 1 1 100%; }
.thumb-shot { width: 100%; height: 96px; }
.thumb-shot img { object-fit: contain; object-position: left center; } /* whole capture: the highlight can sit anywhere in it */
.thumb:hover { border-color: var(--line-strong); }

.reply { display: grid; gap: 6px; }
.reply-input { min-height: 34px; font-size: 13.5px; }
.reply-actions { display: none; align-items: center; gap: 4px; }
.reply.has-content .reply-actions, .reply:focus-within .reply-actions { display: flex; }

.composer { cursor: default; }
.composer-input { min-height: 76px; font-size: 13.5px; }
.composer-actions { display: flex; align-items: center; gap: 4px; }
.composer-status { color: var(--text-3); font-size: 12px; }
.composer-hint { color: var(--text-3); font-size: 11.5px; }
.composer .comment-head { padding-right: 0; }

.attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.attach-item { position: relative; width: 56px; height: 44px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.attach-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-item.is-uploading img { opacity: 0.45; }
.attach-item.is-uploading::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border: 2px solid rgba(0, 0, 0, 0.15); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
.attach-remove { position: absolute; top: 2px; right: 2px; display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: rgba(28, 26, 23, 0.7); color: #fff; cursor: pointer; }

.lost { flex: none; max-height: 38%; overflow: auto; border-top: 1px solid var(--line); background: var(--surface); }
.lost summary { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; list-style: none; }
.lost summary::-webkit-details-marker { display: none; }
.lost summary .icon { color: #b07d00; }
.lost summary .count-pill { height: 18px; font-size: 11px; margin-left: auto; }
.lost-help { padding: 0 14px 8px; color: var(--text-3); font-size: 12px; }
.lost-list { display: grid; gap: 8px; padding: 0 14px 14px; }
.lost-list .card.is-active { --x: 0px; }

/* compare */

.compare-versions { gap: 8px; }
.ab-tag { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: var(--sunken); color: var(--text-2); font-size: 11px; font-weight: 700; flex: none; }
.ab-tag-b { background: var(--accent-soft); color: var(--accent-text); }

.compare-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr) auto; }
.compare-pages { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; padding: 0 14px; border-bottom: 1px solid var(--line); flex: none; }
.panel-head h2 { font-size: 13.5px; }
.page-list-summary { padding: 10px 14px 6px; color: var(--text-3); font-size: 12px; }
.page-list { flex: 1; overflow: auto; margin: 0; padding: 4px 8px 16px; list-style: none; }
.page-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: var(--radius-sm); background: transparent; text-align: left; cursor: pointer; }
.page-item:hover { background: var(--surface-2); }
.page-item[aria-current="page"] { background: var(--accent-soft); }
.page-item-title { font-size: 13px; font-weight: 540; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-item-path { grid-row: 2; color: var(--text-3); font: 11.5px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-item .badge { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.page-removed .page-item-title { color: var(--text-3); text-decoration: line-through; }

.compare-stage { position: relative; display: flex; gap: 12px; min-width: 0; min-height: 0; padding: 12px; background: var(--sunken); background-image: radial-gradient(rgba(28, 26, 23, 0.07) 1px, transparent 1px); background-size: 16px 16px; }
.compare-stage.is-dragging iframe { pointer-events: none; }
.compare-stage.is-dragging { cursor: ew-resize; user-select: none; }
.pane-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pane-label { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; font-weight: 580; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compare-pane { position: relative; flex: 1; min-height: 0; }
.compare-pane .frame-wrap { top: 0; }
.frame-missing { position: absolute; inset: 0 12px 12px; display: grid; place-content: center; justify-items: center; gap: 6px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); color: var(--text-3); text-align: center; padding: 16px; }
.frame-missing strong { color: var(--text-2); }

.slider-labels { display: flex; justify-content: space-between; }
.slider-stack { position: relative; flex: 1; min-height: 0; }
.slider-stack > .compare-pane { position: absolute; inset: 0; }
.slider-handle { position: absolute; top: 0; bottom: 12px; z-index: 4; width: 24px; margin-left: -12px; cursor: ew-resize; touch-action: none; display: grid; place-items: center; }
.slider-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 11px; width: 2px; background: var(--accent); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6); }
.slider-grip { position: relative; display: flex; align-items: center; height: 30px; padding: 0 2px; border-radius: 99px; background: var(--accent); color: #fff; box-shadow: var(--shadow-lg); }
.slider-handle:focus-visible { box-shadow: none; }
.slider-handle:focus-visible .slider-grip { box-shadow: var(--focus); }

.compare-removed { width: 300px; overflow: auto; padding: 14px; border-left: 1px solid var(--line); background: var(--surface); display: grid; align-content: start; gap: 12px; }
.compare-removed h2 { font-size: 13.5px; }
.compare-removed .muted { font-size: 12.5px; font-weight: 450; }
.diff-legend { display: grid; gap: 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); font-size: 12.5px; color: var(--text-2); }
.diff-legend p { display: flex; align-items: center; gap: 8px; }
.diff-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.diff-swatch-changed { background: rgba(46, 160, 90, 0.35); box-shadow: inset 0 0 0 1px rgba(46, 160, 90, 0.6); }
.diff-swatch-removed { background: rgba(200, 60, 50, 0.25); box-shadow: inset 0 0 0 1px rgba(200, 60, 50, 0.5); }
.removed-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.removed-list li { padding: 8px 10px; border-left: 3px solid rgba(200, 60, 50, 0.55); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--danger-soft); color: var(--text-2); font-size: 12.5px; text-decoration: line-through; text-decoration-color: rgba(185, 56, 44, 0.45); overflow-wrap: anywhere; }

/* ---------- responsive ---------- */

@media (max-width: 1023px) {
  .viewer-body { grid-template-columns: minmax(0, 1fr) 0; }
  .viewer-body .sidebar { position: absolute; top: 0; right: 0; bottom: 0; width: min(var(--sidebar-w), 92vw); z-index: 20; box-shadow: var(--shadow-lg); }
  .compare-body { grid-template-columns: 200px minmax(0, 1fr) auto; }
  .compare-removed { width: 240px; }
}

@media (max-width: 720px) {
  .app-header-inner { padding: 0 16px; gap: 8px; }
  .page { padding: 20px 16px 64px; }
  .page-head { align-items: flex-start; }
  .hide-sm { display: none !important; }
  .crumbs > :not(:nth-last-child(-n+2)) { display: none; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field:first-child { grid-column: 1 / -1; }
  .todo { grid-template-columns: auto minmax(0, 1fr); padding: 12px; }
  .todo-shot { grid-column: 2; width: 120px; height: 72px; }
  .settings-section { grid-template-columns: 1fr; gap: 14px; }
  .danger-row, .source-import { flex-direction: column; align-items: stretch; }
  .project-grid { grid-template-columns: 1fr; }
  .tabs { width: 100%; }
  .toolbar-group > select, .toolbar-project { display: none; }
}

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