/* Load order matters: tokens first, responsive and motion overrides last. */
/* ============================================================
   QUIRE — DESIGN TOKENS
   Light palette on bare :root; dark redefined (not inverted).
   ============================================================ */
:root {
  /* surfaces */
  --bg: #fbfaf8;
  --bg-side: #f4f3f0;
  --surface: #ffffff;
  --surface-2: #f6f5f2;
  --surface-3: #eeede9;
  --sunken: #f7f6f3;
  --overlay: rgba(24, 22, 19, 0.28);
  /* lines */
  --border: #e9e7e2;
  --border-strong: #dad7d0;
  --divider: #f0eeea;
  /* text */
  --text: #1d1c1a;
  --text-2: #57544e;
  --text-3: #6b6760;
  --text-4: #8c8880;
  --text-inv: #ffffff;
  /* accent (swappable) */
  --acc-l: #f73859;
  --acc-d: #f73859;
  --on-acc-d: #ffffff;
  --accent: var(--acc-l);
  --on-accent: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 38%, transparent);
  /* semantic */
  --green: #25754b;
  --amber: #8f5e0e;
  --red: #b23c30;
  --blue: #3570c4;
  --violet: #7652c2;
  --teal: #1e8580;
  --rose: #bc4270;
  --orange: #c0612b;
  --gray: #8a867e;
  --green-soft: color-mix(in srgb, var(--green) 11%, transparent);
  --amber-soft: color-mix(in srgb, var(--amber) 12%, transparent);
  --red-soft: color-mix(in srgb, var(--red) 10%, transparent);
  /* status */
  --st-backlog: #a29e96;
  --st-todo: #7c7870;
  --st-progress: #c88a14;
  --st-review: #7652c2;
  --st-done: #2e8456;
  /* elevation */
  --shadow-sm: 0 1px 2px rgba(28, 25, 20, 0.05);
  --shadow-card: 0 1px 2px rgba(28, 25, 20, 0.04), 0 0 0 1px var(--border);
  --shadow-pop: 0 12px 32px -8px rgba(28, 25, 20, 0.16), 0 2px 6px -2px rgba(28, 25, 20, 0.06), 0 0 0 1px var(--border);
  --shadow-drag: 0 16px 36px -10px rgba(28, 25, 20, 0.28), 0 0 0 1px var(--border-strong);
  /* radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 10px;
  --r-full: 999px;
  /* spacing (4pt scale) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  /* type */
  --font: 'Geist', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 12.5px;
  --fs: 13.5px;
  --fs-md: 14.5px;
  --fs-lg: 16px;
  --fs-xl: 19px;
  --fs-2xl: 23px;
  /* component sizes */
  --h-xs: 22px;
  --h-sm: 26px;
  --h-md: 30px;
  --h-lg: 36px;
  --side-w: 252px;
  --side-row: 30px;
  --row-h: 40px;
  --card-pad: 10px;
  --topbar-h: 46px;
  /* one horizontal content edge shared by breadcrumb, page headers, toolbars, lists, tables and boards */
  --gutter: 24px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur: 140ms;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #1a1a19;
    --bg-side: #151514;
    --surface: #1d1d1c;
    --surface-2: #252524;
    --surface-3: #2d2d2b;
    --sunken: #181817;
    --overlay: rgba(0, 0, 0, 0.55);
    --border: #2c2b29;
    --border-strong: #3a3936;
    --divider: #252523;
    --text: #eceae5;
    --text-2: #b5b2ab;
    --text-3: #9a968f;
    --text-4: #6f6c66;
    --text-inv: #151514;
    --accent: var(--acc-d);
    --on-accent: var(--on-acc-d);
    --green: #5cba86;
    --amber: #d8a443;
    --red: #e57d70;
    --blue: #72a5ea;
    --violet: #a98deb;
    --teal: #58c0b6;
    --rose: #e68aab;
    --orange: #e3925f;
    --gray: #8f8b84;
    --pc-mix: 72%;
    --st-backlog: #6f6c66;
    --st-todo: #a6a39c;
    --st-progress: #d8a443;
    --st-review: #a98deb;
    --st-done: #5cba86;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 0 0 1px var(--border);
    --shadow-pop: 0 16px 40px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-strong);
    --shadow-drag: 0 18px 40px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border-strong);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #1a1a19;
  --bg-side: #151514;
  --surface: #1d1d1c;
  --surface-2: #252524;
  --surface-3: #2d2d2b;
  --sunken: #181817;
  --overlay: rgba(0, 0, 0, 0.55);
  --border: #2c2b29;
  --border-strong: #3a3936;
  --divider: #252523;
  --text: #eceae5;
  --text-2: #b5b2ab;
  --text-3: #9a968f;
  --text-4: #6f6c66;
  --text-inv: #151514;
  --accent: var(--acc-d);
  --on-accent: var(--on-acc-d);
  --green: #5cba86;
  --amber: #d8a443;
  --red: #e57d70;
  --blue: #72a5ea;
  --violet: #a98deb;
  --teal: #58c0b6;
  --rose: #e68aab;
  --orange: #e3925f;
  --gray: #8f8b84;
  --pc-mix: 72%;
  --st-backlog: #6f6c66;
  --st-todo: #a6a39c;
  --st-progress: #d8a443;
  --st-review: #a98deb;
  --st-done: #5cba86;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 0 0 1px var(--border);
  --shadow-pop: 0 16px 40px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-strong);
  --shadow-drag: 0 18px 40px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border-strong);
  color-scheme: dark;
}
/* accent variants */
:root[data-accent='blue'] {
  --acc-l: #2f6cd4;
  --acc-d: #74a7f0;
  --on-acc-d: #12131c;
}
:root[data-accent='violet'] {
  --acc-l: #7348cc;
  --acc-d: #ae93f0;
  --on-acc-d: #12131c;
}
:root[data-accent='teal'] {
  --acc-l: #1a7f7a;
  --acc-d: #5cc4ba;
  --on-acc-d: #12131c;
}
:root[data-accent='rose'] {
  --acc-l: #b93d68;
  --acc-d: #ec8dae;
  --on-acc-d: #12131c;
}
:root[data-accent='graphite'] {
  --acc-l: #34332f;
  --acc-d: #d9d6cf;
  --on-acc-d: #12131c;
}
:root[data-side='compact'] {
  --side-row: 26px;
}
:root[data-density='compact'] {
  --row-h: 34px;
  --card-pad: 8px;
}

/* ============================================================
   BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  height: 100dvh;
}
/* Phones: no gray flash on tap, no font inflation in landscape, no pull-to-refresh over the app. */
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}
/* Controls answer the tap at once and a long press doesn't select their label. */
button,
a,
[role='button'],
[data-a] {
  touch-action: manipulation;
}
button,
[role='button'] {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  font-feature-settings: 'ss01', 'cv11';
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
svg.i {
  flex-shrink: 0;
  display: block;
}
::selection {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}
input,
textarea,
[contenteditable] {
  caret-color: var(--accent);
}
.skip {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 300;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--text);
  color: var(--text-inv);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: top 0.15s var(--ease);
}
.skip:focus {
  top: calc(8px + env(safe-area-inset-top, 0px));
}
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: var(--r-xs);
}
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
  letter-spacing: -0.01em;
}
.num {
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--text-2);
}
.faint {
  color: var(--text-3);
}
.trunc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.col {
  display: flex;
  flex-direction: column;
}
.grow {
  flex: 1;
  min-width: 0;
}
.sp {
  flex: 1;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
kbd,
.kbd {
  font-family: var(--mono);
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  border-bottom-width: 1.5px;
  background: var(--surface);
  color: var(--text-2);
  line-height: 1;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
@media (hover: hover) and (pointer: fine) {
  ::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-4);
  }
}
::-webkit-scrollbar-track {
  background: transparent;
}
.only-m {
  display: none;
}
@media (max-width: 640px) {
  .only-m {
    display: block;
  }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  --h: var(--h-md);
  height: var(--h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition:
    background var(--dur),
    border-color var(--dur),
    color var(--dur),
    box-shadow var(--dur);
  border: 1px solid transparent;
  user-select: none;
  position: relative;
}
.btn .i {
  opacity: 0.9;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn {
  transition-property: background, border-color, color, box-shadow, transform;
}
.btn-sm {
  --h: var(--h-sm);
  padding: 0 8px;
  font-size: var(--fs-xs);
}
.btn-lg {
  --h: var(--h-lg);
  padding: 0 14px;
  font-size: var(--fs);
}
.btn-block {
  width: 100%;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background: color-mix(in srgb, var(--accent) 88%, var(--text));
  }
}
.btn-primary:active {
  background: color-mix(in srgb, var(--accent) 78%, var(--text));
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
@media (hover: hover) and (pointer: fine) {
  .btn-secondary:hover {
    background: var(--surface-2);
  }
}
.btn-secondary:active {
  background: var(--surface-3);
}
.btn-ghost {
  color: var(--text-2);
}
@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
  }
}
.btn-ghost:active,
.btn-ghost.on {
  background: var(--surface-3);
  color: var(--text);
}
.btn-danger {
  background: var(--red);
  color: #fff;
}
@media (hover: hover) and (pointer: fine) {
  .btn-danger:hover {
    background: color-mix(in srgb, var(--red) 88%, #000);
  }
}
.btn-danger-ghost {
  color: var(--red);
}
@media (hover: hover) and (pointer: fine) {
  .btn-danger-ghost:hover {
    background: var(--red-soft);
  }
}
.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.45;
  pointer-events: none;
  box-shadow: none;
}
.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
}
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-color: var(--on-accent) transparent var(--on-accent) var(--on-accent);
  animation: spin 0.7s linear infinite;
}
.btn-secondary.is-loading::after,
.btn-ghost.is-loading::after {
  border-color: var(--text-2) transparent var(--text-2) var(--text-2);
}
.ibtn {
  width: var(--h-md);
  height: var(--h-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-2);
  transition:
    background var(--dur),
    color var(--dur);
  position: relative;
  flex-shrink: 0;
}
@media (hover: hover) and (pointer: fine) {
  .ibtn:hover {
    background: var(--surface-2);
    color: var(--text);
  }
}
.ibtn.on,
.ibtn:active {
  background: var(--surface-3);
  color: var(--text);
}
.ibtn-sm {
  width: var(--h-sm);
  height: var(--h-sm);
}
.ibtn-xs {
  width: 22px;
  height: 22px;
  border-radius: var(--r-xs);
}
.ibtn:disabled {
  opacity: 0.4;
  pointer-events: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* tooltip */
[data-tip] {
  position: relative;
}
[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  background: var(--text);
  color: var(--text-inv);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  padding: 5px 7px;
  border-radius: 5px;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
  animation: tipIn 0.12s 0.35s both;
}
@media (hover: hover) and (pointer: fine) {
  [data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    top: calc(100% + 6px);
    transform: translateX(-50%);
    background: var(--text);
    color: var(--text-inv);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    padding: 5px 7px;
    border-radius: 5px;
    white-space: nowrap;
    z-index: 200;
    pointer-events: none;
    animation: tipIn 0.12s 0.35s both;
  }
}
[data-tip-pos='right']:focus-visible::after {
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
}
@media (hover: hover) and (pointer: fine) {
  [data-tip-pos='right']:hover::after {
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
  }
}
@media (hover: hover) and (pointer: fine) {
  [data-tip-pos='top']:hover::after {
    top: auto;
    bottom: calc(100% + 6px);
  }
}
@keyframes tipIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ============================================================
   INPUTS
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
}
.hint {
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.err {
  font-size: var(--fs-xs);
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 4px;
}
.input,
.select,
.textarea {
  width: 100%;
  height: var(--h-md);
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: var(--fs);
  transition:
    border-color var(--dur),
    box-shadow var(--dur);
}
.input-lg {
  height: var(--h-lg);
}
.textarea {
  height: auto;
  min-height: 72px;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.5;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}
@media (hover: hover) and (pointer: fine) {
  .input:hover,
  .select:hover,
  .textarea:hover {
    border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-3));
  }
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.input.is-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}
.input:disabled {
  background: var(--surface-2);
  color: var(--text-3);
  cursor: not-allowed;
}
.select {
  appearance: none;
  padding-right: 28px;
  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='%239C988F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}
.inwrap {
  position: relative;
  display: flex;
  align-items: center;
}
.inwrap > .i {
  position: absolute;
  left: 9px;
  color: var(--text-4);
  pointer-events: none;
}
.inwrap > .input {
  padding-left: 30px;
}
.inwrap > .kbd {
  position: absolute;
  right: 7px;
}
.search-sm {
  height: var(--h-sm);
  font-size: var(--fs-sm);
  width: 200px;
}
.check {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background var(--dur),
    border-color var(--dur);
  margin: 0;
}
@media (hover: hover) and (pointer: fine) {
  .check:hover {
    border-color: var(--text-4);
  }
}
.check:checked,
.check:indeterminate {
  background: var(--accent);
  border-color: var(--accent);
}
.check:checked::after {
  content: '';
  width: 8px;
  height: 5px;
  border-left: 1.8px solid var(--on-accent);
  border-bottom: 1.8px solid var(--on-accent);
  transform: rotate(-45deg) translate(1px, -1px);
}
.check:indeterminate::after {
  content: '';
  width: 7px;
  height: 1.8px;
  background: var(--on-accent);
}
.check.round {
  border-radius: 50%;
  width: 16px;
  height: 16px;
}
.toggle {
  appearance: none;
  width: 30px;
  height: 18px;
  border-radius: 9px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background var(--dur);
  flex-shrink: 0;
  margin: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform var(--dur) var(--ease);
}
.toggle:checked {
  background: var(--accent);
}
.toggle:checked::after {
  transform: translateX(12px);
}
.radio {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  margin: 0;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  flex-shrink: 0;
}
.radio:checked {
  border-color: var(--accent);
}
.radio:checked::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* segmented */
.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  gap: 2px;
}
.seg button {
  height: calc(var(--h-sm) - 2px);
  padding: 0 9px;
  border-radius: 5px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition:
    background var(--dur),
    color var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .seg button:hover {
    color: var(--text);
  }
}
.seg button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 0 0 1px var(--border);
}

/* tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  /* Sideways only: the active tab's underline must not make the strip scroll up and down on touch. */
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-2);
  position: relative;
  white-space: nowrap;
  transition: color var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .tab:hover {
    color: var(--text);
  }
}
.tab.on {
  color: var(--text);
}
.tab.on::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}
.fx-tabs .tab.on::after {
  animation: tabIn 0.26s var(--ease);
}
.tab .cnt {
  font-size: var(--fs-2xs);
  color: var(--text-3);
  font-weight: 500;
}
@keyframes tabIn {
  from {
    transform: scaleX(0.4);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* badges / pills / chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge.green {
  color: var(--green);
  background: var(--green-soft);
  border-color: transparent;
}
.badge.amber {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: transparent;
}
.badge.red {
  color: var(--red);
  background: var(--red-soft);
  border-color: transparent;
}
.badge.accent {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}
.badge.violet {
  color: var(--violet);
  background: color-mix(in srgb, var(--violet) 11%, transparent);
  border-color: transparent;
}
.badge.gray {
  color: var(--text-2);
}
.lbl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px 0 6px;
  border-radius: 5px;
  font-size: var(--fs-xs);
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}
.lbl i {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--c);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--h-sm);
  padding: 0 4px 0 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid var(--accent-line);
}
.chip b {
  font-weight: 500;
  color: var(--text-2);
}
.chip .ibtn {
  width: 18px;
  height: 18px;
  color: var(--text-2);
}
.pillbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--h-sm);
  padding: 0 7px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--text);
  transition: background var(--dur);
  white-space: nowrap;
  max-width: 100%;
}
@media (hover: hover) and (pointer: fine) {
  .pillbtn:hover {
    background: var(--surface-2);
  }
}
.pillbtn.empty {
  color: var(--text-3);
}
.pillbtn.bordered {
  border: 1px solid var(--border);
}
.pillbtn.over {
  color: var(--red);
}

/* avatar */
.av {
  --sz: 22px;
  width: var(--sz);
  height: var(--sz);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: calc(var(--sz) * 0.4);
  font-weight: 600;
  letter-spacing: 0.01em;
  background: color-mix(in srgb, var(--c) 17%, var(--surface));
  color: color-mix(in srgb, var(--c) 55%, var(--text));
  flex-shrink: 0;
  box-shadow: 0 0 0 1.5px var(--surface);
  line-height: 1;
  user-select: none;
}
.av.sm {
  --sz: 20px;
}
.av.md {
  --sz: 26px;
}
.av.lg {
  --sz: 36px;
}
.av.xl {
  --sz: 64px;
}
.av.empty {
  background: transparent;
  border: 1.3px dashed var(--border-strong);
  color: var(--text-4);
  box-shadow: none;
}
.avs {
  display: inline-flex;
}
.avs .av + .av {
  margin-left: -5px;
}
.avs .more {
  --c: var(--gray);
}
.presence {
  position: relative;
}
.presence::after {
  content: '';
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px var(--surface);
}

/* progress */
.prog {
  height: 4px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
  flex: 1;
  min-width: 40px;
}
.prog > i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 4px;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  transition: transform 0.3s var(--ease);
}
.prog.green > i {
  background: var(--green);
}
.prog.amber > i {
  background: var(--amber);
}
.prog.red > i {
  background: var(--red);
}
.stackbar {
  display: flex;
  height: 6px;
  border-radius: 6px;
  overflow: hidden;
  gap: 2px;
  background: var(--surface-3);
}
.stackbar i {
  display: block;
  height: 100%;
}
/* design-system select (see js/ui/select.js) */
.select-native {
  position: absolute !important;
  /* Pinned to the left edge: at its static spot inside a wide table it would widen the page and let it scroll sideways. */
  left: 0;
  width: 1px !important;
  height: 1px !important;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.select-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  min-width: 0;
  color: var(--text);
}
.select-btn[aria-expanded='true'] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.select-menu {
  max-width: 360px;
}
.select-btn .i,
.select-menu .mi .i.mk {
  flex-shrink: 0;
  color: var(--text);
}
.select-menu .mi[aria-selected='true'] {
  font-weight: 500;
}

/* ============================================================
   SHELL: SIDEBAR / TOPBAR
   ============================================================ */
#app {
  height: 100%;
}
.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: 100%;
}
.shell.collapsed {
  grid-template-columns: 52px minmax(0, 1fr);
}
.side-scrim {
  display: none;
}
.side {
  background: var(--bg-side);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  user-select: none;
}
.side-top {
  padding: 8px 8px 4px;
}
.ws {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 6px;
  border-radius: var(--r-sm);
  text-align: left;
  transition: background var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .ws:hover {
    background: var(--surface-3);
  }
}
.ws-logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--c, #3a3934);
  flex-shrink: 0;
}
.ws-logo.brand {
  background: transparent;
  overflow: hidden;
  border-radius: 28%;
}
.ws-logo.brand svg {
  display: block;
  width: 100%;
  height: 100%;
}
.brand .logo,
.auth-card .logo {
  color: var(--text);
}
svg.logo {
  display: block;
  flex-shrink: 0;
}
.ws-name {
  font-weight: 600;
  font-size: var(--fs);
}
/* Scrolls without a visible bar: a scrollbar would eat width and push the nav off the logo's centre line when collapsed. */
.side-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 8px 12px;
  scrollbar-width: none;
}
.side-scroll::-webkit-scrollbar {
  display: none;
}
.sgroup {
  margin-top: 14px;
}
.sgroup-h {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.sgroup-h .ibtn {
  opacity: 0;
  transition: opacity var(--dur);
}
.sgroup-h .ibtn:focus-visible {
  opacity: 1;
}
@media (hover: hover) and (pointer: fine) {
  .sgroup:hover .sgroup-h .ibtn {
    opacity: 1;
  }
}
.sitem {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: var(--side-row);
  padding: 0 8px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs);
  font-weight: 450;
  text-align: left;
  transition:
    background var(--dur),
    color var(--dur);
  position: relative;
  white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
  .sitem:hover {
    background: var(--surface-3);
    color: var(--text);
  }
}
.sitem.on {
  background: var(--surface);
  color: var(--text);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.05),
    0 0 0 1px var(--border);
  font-weight: 500;
}
:root[data-theme='dark'] .sitem.on {
  background: var(--surface-3);
  box-shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .sitem.on {
    background: var(--surface-3);
    box-shadow: none;
  }
}
.sitem .i {
  color: var(--text-4);
}
.sitem.on .i {
  color: var(--text-2);
}
@media (hover: hover) and (pointer: fine) {
  .sitem:hover .i {
    color: var(--text-2);
  }
}
.sitem .ct {
  margin-left: auto;
  font-size: var(--fs-2xs);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.sitem .ct.dotc {
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  padding: 0 4px;
  font-weight: 600;
}
.sitem .pico {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--c) 16%, transparent);
  color: var(--pc, var(--c));
  flex-shrink: 0;
}
.sitem .pico .i {
  color: var(--pc, var(--c)) !important;
}
.sitem .pico,
.picon {
  --pc: color-mix(in srgb, var(--c) var(--pc-mix, 100%), var(--text));
}
.sitem .sdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
}
.sitem .fav {
  color: var(--amber);
  margin-left: 4px;
}
.sitem .hov {
  margin-left: auto;
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .sitem:hover .hov {
    display: flex;
  }
}
@media (hover: hover) and (pointer: fine) {
  .sitem:hover .sdot {
    display: none;
  }
}
.sitem.drop-before::before {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  top: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.sitem.dragging {
  opacity: 0.4;
}
.sub {
  padding-left: 14px;
  margin-left: 8px;
  border-left: 1px solid var(--border);
  display: none;
}
.sub.open {
  display: block;
}
.sitem .chev {
  transition: transform var(--dur);
  color: var(--text-4);
}
.sitem .chev.open {
  transform: rotate(90deg);
}
.side-bot {
  padding: 6px 8px 8px;
  border-top: 1px solid var(--border);
}
.shell.collapsed .side .sitem {
  justify-content: center;
  padding: 0;
}
.shell.collapsed .side .sitem > span:not(.pico):not(.av),
.shell.collapsed .side .sitem .ct,
.shell.collapsed .side .sgroup-h,
.shell.collapsed .side .ws-name,
.shell.collapsed .side .ws .chev-d,
.shell.collapsed .side .sitem .sdot,
.shell.collapsed .side .sitem .fav,
.shell.collapsed .side .sitem .hov,
.shell.collapsed .side .sub,
.shell.collapsed .side .side-search,
.shell.collapsed .side .sitem .chev {
  display: none !important;
}
.shell.collapsed .side .sgroup {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.shell.collapsed .side .ws {
  justify-content: center;
  padding: 5px 0;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}
.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 0 var(--gutter);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  z-index: 5;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
/* No padding or hover fill: the first crumb starts exactly on the content gutter; hover is shown with colour only. */
.crumbs button {
  padding: 3px 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .crumbs button:hover {
    color: var(--text);
  }
}
.crumbs .cur {
  color: var(--text);
  font-weight: 500;
}
.crumbs .sep {
  color: var(--text-4);
  font-size: 12px;
}
.topsearch {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--h-sm);
  padding: 0 6px 0 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: var(--fs-sm);
  width: 220px;
  background: var(--sunken);
  transition: border-color var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .topsearch:hover {
    border-color: var(--border-strong);
    color: var(--text-2);
  }
}
.topsearch .kbd {
  margin-left: auto;
  flex-shrink: 0;
}
.topsearch .lbltxt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.content {
  flex: 1;
  overflow: auto;
  min-height: 0;
  position: relative;
}
.content:focus {
  outline: none;
}
.drawer:focus {
  outline: none;
}
/* Content pages with a max width sit centred in the main area; full-bleed views use .page.flush. */
.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px var(--gutter) 72px;
}
.page.flush > .ph {
  padding: 24px var(--gutter) 12px;
  margin: 0;
}
.page.wide {
  max-width: none;
}
.page.flush {
  padding: 0;
  max-width: none;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.ph {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.ph h1 {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.022em;
  margin: 0;
  line-height: 1.2;
  text-wrap: balance;
}
.ph p {
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: var(--fs);
}
.ph .acts {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
h2.sec {
  font-size: var(--fs-md);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
h3.sub {
  font-size: var(--fs);
  font-weight: 600;
  margin: 0;
}
.eyebrow {
  font-size: var(--fs-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
}
.bottomnav {
  display: none;
}
.offline-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--amber-soft);
  color: var(--text);
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--border);
}
.offline-bar .i {
  color: var(--amber);
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.panel-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
}
.panel-h h2 {
  font-size: var(--fs);
  font-weight: 600;
  margin: 0;
}
.panel-h .acts {
  margin-left: auto;
  display: flex;
  gap: 4px;
  align-items: center;
}
.panel-b {
  padding: 0 14px 14px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.stat {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  transition: background var(--dur);
}
.stat + .stat {
  border-left: 1px solid var(--border);
}
@media (hover: hover) and (pointer: fine) {
  .stat:hover {
    background: var(--surface-2);
  }
}
.stat .k {
  font-size: var(--fs-sm);
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat .v {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat .d {
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.stat .d.up {
  color: var(--green);
}
.stat .d.bad {
  color: var(--red);
}
.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
/* rows inside a bordered panel draw separators between themselves only, never against the panel edge */
.panel > .mini:first-child {
  border-top: 0;
}
.nrow {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
}
.nrow + .nrow {
  border-top: 1px solid var(--divider);
}
.nrow.unread {
  background: color-mix(in srgb, var(--accent) 3.5%, transparent);
}
@media (hover: hover) and (pointer: fine) {
  .nrow:hover {
    background: var(--surface-2);
  }
}
/* Inbox list works as a secondary sidebar: no visible scrollbar (it narrowed the rows), and the
   tab labels start on the gutter with tighter spacing so all five categories fit without clipping. */
.inbox-list {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: none;
}
.inbox-list::-webkit-scrollbar {
  display: none;
}
.inbox-tabs {
  margin-top: 8px;
  padding: 0 var(--gutter);
  gap: 16px;
}
.inbox-tabs .tab {
  padding: 0;
}
.inbox-tabs .tab.on::after {
  left: 0;
  right: 0;
}

/* ============================================================
   TASK ROWS (list)
   ============================================================ */
/* no top border: the toolbar above already draws that line (it doubled up before) */
.tlist {
  border-top: 0;
}
.thead,
.trow {
  display: grid;
  grid-template-columns: var(--cols);
  align-items: center;
  min-height: var(--row-h);
  gap: 0;
}
.thead {
  min-height: 32px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.thead > div {
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.trow {
  border-bottom: 1px solid var(--divider);
  position: relative;
  transition: background var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .trow:hover {
    background: var(--surface-2);
  }
}
.trow.sel {
  background: var(--accent-soft);
}
.trow.drop-before {
  box-shadow: inset 0 2px 0 var(--accent);
}
.trow.drop-after {
  box-shadow: inset 0 -2px 0 var(--accent);
}
.trow.dragging {
  opacity: 0.4;
}
.trow > div {
  padding: 0 8px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.trow .handle {
  opacity: 0;
  cursor: grab;
  color: var(--text-4);
  width: 16px;
  justify-content: center;
  padding: 0;
}
@media (hover: hover) and (pointer: fine) {
  .trow:hover .handle {
    opacity: 1;
  }
}
.trow .ttl {
  font-size: var(--fs);
  cursor: pointer;
  gap: 8px;
}
.trow .ttl .tt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
  .trow .ttl:hover .tt {
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-underline-offset: 3px;
  }
}
.trow.done .tt {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: var(--text-3);
}
.trow .key {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
}
.trow .meta-mini {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-3);
  font-size: var(--fs-2xs);
}
.grp {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 22px;
  margin-top: 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.grp .cnt {
  color: var(--text-3);
  font-weight: 500;
}
.grp .ibtn {
  opacity: 0.6;
}
@media (hover: hover) and (pointer: fine) {
  .grp:hover .ibtn {
    opacity: 1;
  }
}
.subrows {
  background: var(--sunken);
}
.subrow {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding-left: 64px;
  border-bottom: 1px solid var(--divider);
  font-size: var(--fs-sm);
}
.subrow.done span {
  color: var(--text-3);
  text-decoration: line-through;
}
.addrow {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 26px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  width: 100%;
  text-align: left;
  border-bottom: 1px solid var(--divider);
}
@media (hover: hover) and (pointer: fine) {
  .addrow:hover {
    color: var(--text);
    background: var(--surface-2);
  }
}
.inline-in {
  border: 0;
  background: transparent;
  height: 100%;
  width: 100%;
  font-size: var(--fs);
  padding: 0;
  outline: none;
}
.bulkbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 6px 14px;
  border-radius: var(--r-lg);
  background: var(--text);
  color: var(--text-inv);
  box-shadow: var(--shadow-pop);
  z-index: 40;
  font-size: var(--fs-sm);
}
.bulkbar.enter {
  animation: popUp 0.28s var(--spring);
}
.bulkbar .btn {
  color: var(--text-inv);
  opacity: 0.85;
}
@media (hover: hover) and (pointer: fine) {
  .bulkbar .btn:hover {
    background: color-mix(in srgb, var(--text-inv) 14%, transparent);
    opacity: 1;
  }
}
.bulkbar .sep {
  width: 1px;
  height: 18px;
  background: color-mix(in srgb, var(--text-inv) 20%, transparent);
  margin: 0 4px;
}
@keyframes popUp {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* compact task row (dashboard) */
.mini {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 14px;
  border-top: 1px solid var(--divider);
  cursor: pointer;
  transition: background var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .mini:hover {
    background: var(--surface-2);
  }
}
.mini > span:not(.tt) {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.mini .tt {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini.done .tt {
  text-decoration: line-through;
  color: var(--text-3);
}
.mini .pj {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-xs);
  color: var(--text-2);
  max-width: 140px;
}
.pdot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--c);
  flex-shrink: 0;
}
.due {
  font-size: var(--fs-xs);
  color: var(--text-2);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.due.over {
  color: var(--red);
}
.due.soon {
  color: var(--amber);
}
/* List rows start with an 18px drag handle + 30px checkbox column; pulling the wrapper left by
   the handle+cell inset puts the checkbox (and group chevrons) exactly on the shared gutter. */
.list-wrap {
  padding: 0 var(--gutter) 90px calc(var(--gutter) - 26px);
}

/* A row of what the agent did: the channel's mark, when, and the agent's own mark. */
.act-meta {
  font-size: 11.5px;
  white-space: nowrap;
  gap: 6px;
}
.chan {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: var(--c);
  color: #fff;
}
.chan.round {
  border-radius: 50%;
}
/* A strip that scrolls sideways when it can't fit, such as a long row of filters on a phone. */
.hscroll {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar {
  display: none;
}
.hscroll > * {
  flex-shrink: 0;
}

/* ============================================================
   KANBAN
   ============================================================ */
.board {
  display: flex;
  gap: 12px;
  padding: 14px var(--gutter) 24px;
  overflow-x: auto;
  flex: 1;
  min-height: 0;
  align-items: flex-start;
}
.board::after {
  content: '';
  flex: 0 0 8px;
}
.bcol {
  width: 284px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  border-radius: var(--r-lg);
  background: var(--sunken);
  border: 1px solid var(--divider);
}
.bcol.collapsed {
  width: 44px;
  align-items: center;
  padding-top: 8px;
  cursor: pointer;
}
.bcol.collapsed .vname {
  writing-mode: vertical-rl;
  font-size: var(--fs-sm);
  font-weight: 500;
  margin-top: 8px;
  color: var(--text-2);
  display: flex;
  gap: 8px;
  align-items: center;
}
.bcol-h {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 8px 6px 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.bcol-h .cnt {
  color: var(--text-3);
  font-weight: 500;
}
.bcol-h .acts {
  margin-left: auto;
  display: flex;
  gap: 0;
  opacity: 0.55;
  transition: opacity var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .bcol:hover .bcol-h .acts {
    opacity: 1;
  }
}
.bcol-b {
  padding: 4px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 60px;
  flex: 1;
}
.bcol.over {
  background: color-mix(in srgb, var(--accent) 6%, var(--sunken));
  border-color: var(--accent-line);
}
.kcard {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow-card);
  padding: var(--card-pad) calc(var(--card-pad) + 2px);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition:
    box-shadow var(--dur),
    transform var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .kcard:hover {
    box-shadow:
      0 2px 6px -2px rgba(0, 0, 0, 0.08),
      0 0 0 1px var(--border-strong);
  }
}
.kcard.dragging {
  opacity: 0.35;
}
.kcard.ghost {
  box-shadow: var(--shadow-drag);
  transform: rotate(1.5deg);
}
.kcard .top {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
.kcard .title {
  font-size: var(--fs);
  line-height: 1.4;
  font-weight: 450;
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
}
.kcard.done .title {
  color: var(--text-3);
  text-decoration: line-through;
}
.kcard .hacts {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  gap: 1px;
  background: var(--surface);
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 1px var(--border);
  padding: 1px;
}
@media (hover: hover) and (pointer: fine) {
  .kcard:hover .hacts {
    display: flex;
  }
}
.kcard .labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.kcard .meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.kcard .meta .m {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.kcard .meta .av {
  margin-left: auto;
}
.kcard .subp {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-2xs);
  color: var(--text-3);
}
.kcard .key {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}
.drop-line {
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  margin: -4px 2px;
  flex-shrink: 0;
}
.addcard {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
  width: 100%;
  text-align: left;
  flex-shrink: 0;
}
@media (hover: hover) and (pointer: fine) {
  .addcard:hover {
    background: var(--surface-3);
    color: var(--text);
  }
}
.composer {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow:
    0 0 0 1px var(--accent-line),
    0 0 0 3px var(--accent-soft);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.composer textarea {
  border: 0;
  resize: none;
  background: transparent;
  outline: none;
  font-size: var(--fs);
  min-height: 38px;
  padding: 0;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px var(--gutter);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  min-height: 44px;
}
.toolbar .btn-ghost {
  height: var(--h-sm);
  font-size: var(--fs-xs);
  padding: 0 8px;
}
.chipsbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px var(--gutter);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
/* columns scroll on wheel/touch without a visible bar, so every column keeps the same inner width */
.bcol-b {
  scrollbar-width: none;
}
.bcol-b::-webkit-scrollbar {
  display: none;
}
/* The last column on a project's board opens its status editor. */
.bcol.bcol-edit {
  width: auto;
  align-self: flex-start;
  padding: 6px;
  background: transparent;
  border-style: dashed;
}

/* ============================================================
   TABLE
   ============================================================ */
.tbl-wrap {
  overflow: auto;
  flex: 1;
  min-height: 0;
}
table.tbl {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: var(--fs-sm);
  min-width: 100%;
}
.tbl th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
  height: 34px;
  text-align: left;
  font-weight: 500;
  color: var(--text-2);
  font-size: var(--fs-xs);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--divider);
  padding: 0 10px;
  white-space: nowrap;
  user-select: none;
}
.tbl th .thi {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  overflow: hidden;
}
@media (hover: hover) and (pointer: fine) {
  .tbl th .thi:hover {
    color: var(--text);
  }
}
.tbl th .rsz {
  position: absolute;
  right: -3px;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 4;
}
.tbl th .rsz.on {
  background: var(--accent-line);
}
@media (hover: hover) and (pointer: fine) {
  .tbl th .rsz:hover {
    background: var(--accent-line);
  }
}
.tbl td {
  height: 36px;
  border-bottom: 1px solid var(--divider);
  border-right: 1px solid var(--divider);
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--surface);
}
@media (hover: hover) and (pointer: fine) {
  .tbl tr:hover td {
    background: var(--surface-2);
  }
}
.tbl td.editing {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: var(--surface) !important;
}
.tbl td.editing input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  height: 100%;
  font-size: var(--fs-sm);
}
.tbl .sticky {
  position: sticky;
  left: 0;
  z-index: 2;
}
.tbl th.sticky {
  z-index: 5;
}
.tbl td.cellbtn {
  cursor: pointer;
}
.tbl .grow-row td {
  background: var(--sunken);
  font-weight: 600;
  font-size: var(--fs-xs);
  color: var(--text-2);
  height: 32px;
}
.tbl .depchip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-2);
  margin-right: 4px;
}
/* the sticky first column starts on the shared gutter, like the breadcrumb and toolbar above it */
.tbl th:first-child,
.tbl td:first-child {
  padding-left: var(--gutter);
}

/* ============================================================
   CALENDAR
   ============================================================ */
.cal {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.cal-h {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}
.cal-h div {
  padding: 8px 10px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-weight: 500;
}
.cal-g {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(112px, 1fr);
  flex: 1;
}
.cday {
  border-right: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  transition: background var(--dur);
  position: relative;
}
.cday:nth-child(7n) {
  border-right: 0;
}
.cday.out {
  background: var(--sunken);
}
.cday.out .dn {
  color: var(--text-3);
}
.cday.over {
  background: var(--accent-soft);
}
.cday .dn {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-2);
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
}
.cday.today .dn {
  background: var(--accent);
  color: var(--on-accent);
}
.cday .add {
  position: absolute;
  top: 5px;
  right: 5px;
  opacity: 0;
}
@media (hover: hover) and (pointer: fine) {
  .cday:hover .add {
    opacity: 1;
  }
}
.cev {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: var(--fs-xs);
  background: color-mix(in srgb, var(--c) 11%, var(--surface));
  color: var(--text);
  cursor: pointer;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
  text-align: left;
  width: 100%;
}
@media (hover: hover) and (pointer: fine) {
  .cev:hover {
    background: color-mix(in srgb, var(--c) 18%, var(--surface));
  }
}
.cev .trunc {
  flex: 1;
}
.cev.done {
  opacity: 0.55;
}
.cev.done .trunc {
  text-decoration: line-through;
}
.cev.event {
  background: transparent;
  border-style: dashed;
  border-color: color-mix(in srgb, var(--c) 45%, transparent);
}
.cev .av {
  --sz: 16px;
  font-size: 7.5px;
}
.cmore {
  font-size: var(--fs-2xs);
  color: var(--text-2);
  padding: 0 6px;
  text-align: left;
}
@media (hover: hover) and (pointer: fine) {
  .cmore:hover {
    color: var(--text);
  }
}
.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  flex: 1;
  min-height: 0;
}
.wcol {
  border-right: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wcol:last-child {
  border-right: 0;
}
.wcol-h {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.wcol-h .n {
  font-size: var(--fs-xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.wcol-h.today .n {
  color: var(--accent);
}
.wcol-b {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}
.wcol-b.over {
  background: var(--accent-soft);
}
.wcard {
  border-radius: var(--r-sm);
  padding: 7px 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
}
@media (hover: hover) and (pointer: fine) {
  .wcard:hover {
    border-color: var(--border-strong);
  }
}
.wcard .t {
  display: flex;
  gap: 7px;
  align-items: baseline;
}
.wcard .t .pdot {
  transform: translateY(-1px);
}
.wcard.event {
  background: color-mix(in srgb, var(--c) 8%, var(--surface));
}
.wcard .t {
  font-weight: 500;
  line-height: 1.3;
}
.wcard .m {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-2xs);
  color: var(--text-3);
}

/* ============================================================
   TIMELINE
   ============================================================ */
.tl {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.tl-left {
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tl-right {
  overflow: auto;
  position: relative;
}
.tl-head {
  height: 52px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 4;
}
.tl-left .tl-head {
  display: flex;
  align-items: flex-end;
  padding: 0 12px 8px var(--gutter);
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-weight: 500;
}
.tl-rows {
  overflow: hidden;
}
.tl-row {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 var(--gutter);
  border-bottom: 1px solid var(--divider);
  font-size: var(--fs-sm);
  cursor: pointer;
  white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
  .tl-row:hover {
    background: var(--surface-2);
  }
}
.tl-row.g {
  font-weight: 600;
  font-size: var(--fs-xs);
  color: var(--text-2);
  background: var(--sunken);
  cursor: default;
}
.tl-row.sub {
  padding-left: 34px;
  color: var(--text-2);
  font-size: var(--fs-xs);
}
.tl-months,
.tl-days {
  display: flex;
  height: 26px;
  position: absolute;
  left: 0;
}
.tl-months {
  top: 0;
}
.tl-days {
  top: 26px;
  border-top: 1px solid var(--divider);
}
.tl-months div {
  border-left: 1px solid var(--border);
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 5px 0;
  color: var(--text);
  white-space: nowrap;
}
/* month name sticks to the left edge while its month is scrolled partly out of view */
.tl-months span {
  position: sticky;
  left: 8px;
  padding: 0 8px;
}
.tl-days div {
  border-left: 1px solid var(--divider);
  font-size: 11px;
  color: var(--text-3);
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.tl-days div.today {
  color: var(--accent);
  font-weight: 600;
}
.tl-grid {
  position: relative;
}
.tl-gl {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--divider);
}
.tl-we {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--sunken);
}
.tl-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0.7;
  z-index: 2;
}
.tl-rowbg {
  position: absolute;
  left: 0;
  right: 0;
  height: 36px;
  border-bottom: 1px solid var(--divider);
}
.tl-rowbg.g {
  background: color-mix(in srgb, var(--sunken) 70%, transparent);
}
.bar {
  position: absolute;
  height: 24px;
  font-size: var(--fs-sm) !important;
  border-radius: 6px;
  background: color-mix(in srgb, var(--c) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  font-size: var(--fs-xs);
  color: var(--text);
  cursor: grab;
  overflow: hidden;
  white-space: nowrap;
  z-index: 3;
  user-select: none;
}
@media (hover: hover) and (pointer: fine) {
  .bar:hover {
    border-color: var(--c);
  }
}
.bar .pf {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--c) 26%, transparent);
  z-index: -1;
}
.bar.done {
  opacity: 0.6;
}
.bar.dragging {
  cursor: grabbing;
  box-shadow: var(--shadow-drag);
}
.bar-lbl {
  position: absolute;
  font-size: var(--fs-xs);
  color: var(--text-2);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 3;
}
.ms-w {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 18px;
  z-index: 3;
  cursor: default;
}
@media (hover: hover) and (pointer: fine) {
  .ms-w:hover {
    z-index: 6;
  }
}
.ms {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transform: rotate(45deg);
  background: var(--text);
  border-radius: 2px;
}
.ms-l {
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
@media (hover: hover) and (pointer: fine) {
  .ms-w[data-tip]:hover::after {
    left: 0;
    transform: none;
  }
}
.tl-deps {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

/* ============================================================
   PROJECT CARDS / MISC
   ============================================================ */
.pgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}
.pcard {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  background: var(--surface);
  transition:
    border-color var(--dur),
    box-shadow var(--dur);
  text-align: left;
  position: relative;
}
@media (hover: hover) and (pointer: fine) {
  .pcard:hover {
    border-color: var(--border-strong);
    box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.1);
  }
}
.pcard .desc {
  font-size: var(--fs-sm);
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
  line-height: 1.45;
}
.pcard .foot {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  padding-top: 10px;
  border-top: 1px solid var(--divider);
}
.picon {
  --sz: 28px;
  width: var(--sz);
  height: var(--sz);
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: var(--pc, var(--c));
  flex-shrink: 0;
}
.picon.lg {
  --sz: 36px;
  border-radius: 9px;
}
.pcard .more {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0;
}
@media (hover: hover) and (pointer: fine) {
  .pcard:hover .more {
    opacity: 1;
  }
}
.pstatus {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-xs);
  font-weight: 500;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pstatus i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c);
}
.proj-h {
  padding: 20px var(--gutter) 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.proj-h .t {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.proj-h h1 {
  font-size: var(--fs-xl);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.018em;
}
/* tabs bleed to the edges; the first label still starts on the gutter (tab has 10px side padding) */
.proj-h .tabs {
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 calc(var(--gutter) - 10px);
}
.feed {
  display: flex;
  flex-direction: column;
}
.fitem {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  font-size: var(--fs-sm);
  line-height: 1.45;
  position: relative;
}
.fitem .av {
  margin-top: 1px;
}
.fitem b {
  font-weight: 500;
}
.fitem .obj {
  font-weight: 500;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .fitem .obj:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}
.fitem time {
  color: var(--text-3);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.feed.lined .fitem:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 32px;
  bottom: -4px;
  width: 1px;
  background: var(--border);
}
.day-h {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-3);
  padding: 14px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kv {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  row-gap: 2px;
  align-items: center;
  font-size: var(--fs-sm);
}
.kv > dt {
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  margin: 0;
}
.kv > dd {
  margin: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-height: 30px;
}
.kv > dt .i {
  color: var(--text-4);
}

/* files */
.fgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.fcard {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
  transition: border-color var(--dur);
  text-align: left;
  position: relative;
}
@media (hover: hover) and (pointer: fine) {
  .fcard:hover {
    border-color: var(--border-strong);
  }
}
.fprev {
  aspect-ratio: 16/10;
  display: grid;
  place-items: center;
  background: var(--sunken);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  max-width: 100%;
}
.fprev .art {
  position: absolute;
  inset: 14px 18px;
  border-radius: 4px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.fprev .art i {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}
.fprev .art i.h {
  height: 7px;
  width: 55%;
  background: var(--border-strong);
}
.fprev .ext {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--c);
  color: #fff;
  text-transform: uppercase;
}
.fcard .fi {
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fcard .fn {
  font-size: var(--fs-sm);
  font-weight: 500;
}
.fcard .fm {
  font-size: var(--fs-2xs);
  color: var(--text-3);
}
.fcard .more {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
@media (hover: hover) and (pointer: fine) {
  .fcard:hover .more {
    opacity: 1;
  }
}
.ftype {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--c) 13%, transparent);
  color: var(--c);
  flex-shrink: 0;
}
.upl {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: var(--fs-sm);
}
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  transition:
    background var(--dur),
    border-color var(--dur);
  cursor: pointer;
}
.dropzone.over {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--text);
}
@media (hover: hover) and (pointer: fine) {
  .dropzone:hover {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--text);
  }
}

/* ============================================================
   TABLES (the user's own CRM): a table page reuses .tbl and .board;
   these are its toolbar, settings panel, row page and value bits.
   ============================================================ */
.crm-body > .crm-panel {
  margin: 14px var(--gutter) 0;
}
.crm-bar {
  padding: 10px var(--gutter);
  border-bottom: 1px solid var(--divider);
  min-height: 46px;
}
.crm-bar .inwrap {
  width: 200px;
}
.crm-cond .select,
.crm-cond .input {
  height: 26px;
  font-size: var(--fs-xs);
}
.crm-cond .input {
  width: 120px;
}
.crm-tbl {
  flex: 1;
  min-height: 0;
}
.crm-tbl td.editing input,
.crm-tbl td.editing textarea {
  padding: 0;
}
.crm-tbl td.editing .select {
  height: 100%;
  border: 0;
  background: transparent;
}
@media (hover: hover) and (pointer: fine) {
  .crm-tbl tr:hover .crm-open {
    opacity: 1;
  }
}
.crm-open {
  display: inline-flex;
  opacity: 0;
  transition: opacity var(--dur);
}
/* Ticking rows: one change, copy or delete for all of them. */
.crm-tick {
  display: inline-flex;
  flex: none;
  margin: -6px 0 -6px -6px;
  padding: 6px;
  color: var(--text-3);
  cursor: pointer;
}
.crm-tick.on {
  color: var(--accent);
}
.crm-tbl tr.sel td {
  background: var(--accent-soft);
}
.crm-selbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
@media (hover: hover) and (pointer: fine) {
  .crm-tick:hover {
    color: var(--text);
  }
}
.crm-board {
  padding-top: 14px;
}
.crm-board .bcol-h {
  gap: 6px;
}
.crm-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}
.crm-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  font-size: var(--fs-xs);
  color: var(--text-2);
  min-width: 0;
}
.crm-meta > .row {
  min-width: 0;
}
.crm-ref {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 180px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-2);
}
@media (hover: hover) and (pointer: fine) {
  .crm-ref:hover {
    color: var(--text);
    border-color: var(--border-strong);
  }
}
.crm-check {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
.crm-long {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* settings panel and import mapping */
.crm-fields {
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.crm-frow {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 10px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.crm-frow + .crm-frow {
  border-top: 1px solid var(--divider);
}
.crm-frow b {
  font-weight: 500;
  color: var(--text);
  max-width: 200px;
}
.crm-frow .input {
  width: 200px;
}
.crm-choices {
  flex-wrap: wrap;
  min-width: 0;
}

/* a row's page */
.crumb-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: var(--fs-sm);
  color: var(--text-3);
}
@media (hover: hover) and (pointer: fine) {
  .crumb-link:hover {
    color: var(--text);
  }
}
.crumb-link .picon {
  width: 20px;
  height: 20px;
}
.crm-rowpage .ph h1 {
  max-width: 100%;
}
.crm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.crm-kvs {
  padding: 0 6px 8px;
}
.crm-kv {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 36px;
}
.crm-kv .k {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 8px;
  font-size: var(--fs-sm);
  color: var(--text-3);
  min-width: 0;
}
.crm-kv .v {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  min-width: 0;
}
.crm-kv .v.cellbtn {
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .crm-kv .v.cellbtn:hover {
    background: var(--surface-2);
  }
}
.crm-kv .v.editing {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.crm-kv .v.editing > input,
.crm-kv .v.editing > textarea {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  resize: vertical;
}
.crm-kv .v.editing > .select {
  width: 100%;
}
.crm-noteform .textarea {
  min-height: 60px;
}
.crm-note {
  display: flex;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}
.crm-note-i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-3);
}
@media (max-width: 860px) {
  .crm-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .crm-kv {
    grid-template-columns: 120px minmax(0, 1fr);
  }
  .crm-bar .inwrap {
    width: 100%;
  }
}

/* The board's last column: edits the options it is grouped by (statuses, stages…). */
.crm-editcol {
  width: auto;
  align-self: flex-start;
  padding: 6px;
  background: transparent;
  border-style: dashed;
}
.crm-thedit {
  margin-left: auto;
  opacity: 0;
}
@media (hover: hover) and (pointer: fine) {
  .tbl th:hover .crm-thedit {
    opacity: 1;
  }
}
@media (pointer: coarse) {
  .crm-thedit {
    opacity: 1;
  }
}
.crm-thedit:focus-visible {
  opacity: 1;
}

/* Payments: a request or quote per row, title over who and when. */
.pay-row {
  min-height: 52px;
  padding-block: 8px;
}
.pay-row .tt {
  white-space: normal;
}

/* ============================================================
   OVERLAYS: MODAL / DRAWER / POPOVER / MENU / PALETTE / TOAST
   ============================================================ */
.scrim {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 60;
}
.scrim.enter {
  animation: fade 0.18s ease both;
}
.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 61;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
.modal.enter {
  animation: modalIn 0.26s var(--ease) both;
}
.modal.sm {
  max-width: 420px;
}
.modal.lg {
  max-width: 720px;
}
.modal-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 0;
}
.modal-h h2 {
  font-size: var(--fs-md);
  font-weight: 600;
  margin: 0;
}
.modal-h .ibtn {
  margin-left: auto;
}
.modal-b {
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-f {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.modal-f .sp {
  flex: 1;
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(620px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 40px -24px rgba(0, 0, 0, 0.25);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.drawer.enter {
  animation: drawerIn 0.34s var(--ease-drawer) both;
}
.drawer.enter .drawer-b > * {
  animation: riseIn 0.38s var(--ease) both;
}
.drawer.enter .drawer-b > *:nth-child(2) {
  animation-delay: 0.04s;
}
.drawer.enter .drawer-b > *:nth-child(3) {
  animation-delay: 0.07s;
}
.drawer.enter .drawer-b > *:nth-child(n + 4) {
  animation-delay: 0.1s;
}
.drawer.full {
  width: min(980px, calc(100vw - 48px));
  right: 50%;
  transform: translateX(50%);
  top: 24px;
  bottom: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.drawer.full.enter {
  animation: modalIn 0.26s var(--ease) both;
}
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: transparent;
}
.drawer-scrim.full {
  background: var(--overlay);
}
.drawer-scrim.full.enter {
  animation: fade 0.18s both;
}
@keyframes drawerIn {
  from {
    transform: translateX(48px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.drawer-h {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 46px;
  padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-b {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 32px;
}
.drawer.full .drawer-b {
  padding: 28px 48px 40px;
}
.ttl-edit {
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.3;
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: var(--r-sm);
  overflow: hidden;
  outline: none;
}
@media (hover: hover) and (pointer: fine) {
  .ttl-edit:hover {
    background: var(--surface-2);
  }
}
.ttl-edit:focus {
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--border-strong);
}
.dsec {
  margin-top: 26px;
}
.dsec-h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.dsec-h h3 {
  font-size: var(--fs);
  font-weight: 600;
  margin: 0;
}
.dsec-h .cnt {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.dsec-h .acts {
  margin-left: auto;
  display: flex;
  gap: 2px;
}
.rte {
  border: 1px solid transparent;
  border-radius: var(--r);
  transition: border-color var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .rte:hover {
    border-color: var(--border);
  }
}
.rte:focus-within {
  border-color: var(--border-strong);
}
.rte-tb {
  display: flex;
  gap: 1px;
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--dur);
}
.dsec:focus-within .rte-tb {
  opacity: 1;
}
@media (hover: hover) and (pointer: fine) {
  .dsec:hover .rte-tb {
    opacity: 1;
  }
}
.rte-body {
  padding: 8px 10px;
  min-height: 64px;
  outline: none;
  font-size: var(--fs);
  line-height: 1.6;
}
.rte-body:empty::before {
  content: attr(data-ph);
  color: var(--text-3);
}
.rte-body p {
  margin: 0 0 6px;
}
.rte-body ul,
.rte-body ol {
  margin: 4px 0;
  padding-left: 20px;
}
.rte-body h4 {
  font-size: var(--fs-md);
  margin: 10px 0 4px;
}
.subt {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  font-size: var(--fs);
}
@media (hover: hover) and (pointer: fine) {
  .subt:hover {
    background: var(--surface-2);
  }
}
.subt.done .s {
  color: var(--text-3);
  text-decoration: line-through;
}
.subt .x {
  opacity: 0;
  margin-left: auto;
}
@media (hover: hover) and (pointer: fine) {
  .subt:hover .x {
    opacity: 1;
  }
}
.subt .s {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 0;
  border-radius: 4px;
}
@media (hover: hover) and (pointer: fine) {
  .subt .s:hover {
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-underline-offset: 3px;
  }
}
.subt .due {
  flex-shrink: 0;
}
.att {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.attc {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  font-size: var(--fs-xs);
  background: var(--surface);
  position: relative;
}
.attc .fprev {
  aspect-ratio: 16/9;
}
.attc .fprev .art {
  inset: 10px 14px;
  padding: 7px;
  gap: 4px;
}
.attc .fi {
  padding: 7px 9px;
}
.attc .x {
  position: absolute;
  top: 5px;
  right: 5px;
  opacity: 0;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
@media (hover: hover) and (pointer: fine) {
  .attc:hover .x {
    opacity: 1;
  }
}
.cmt {
  display: flex;
  gap: 10px;
  padding: 10px 0;
}
.cmt .body {
  flex: 1;
  min-width: 0;
}
.cmt .who {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: var(--fs-sm);
}
.cmt .who b {
  font-weight: 600;
}
.cmt .who time {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.cmt .txt {
  font-size: var(--fs);
  margin-top: 3px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.mention {
  color: var(--accent);
  font-weight: 500;
  background: var(--accent-soft);
  padding: 0 3px;
  border-radius: 4px;
}
.reacts {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.react {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  background: var(--surface);
  transition:
    background var(--dur),
    border-color var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .react:hover {
    background: var(--surface-2);
  }
}
.react.mine {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.cbox {
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition:
    border-color var(--dur),
    box-shadow var(--dur);
  background: var(--surface);
}
.cbox:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.cbox textarea {
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: var(--fs);
  min-height: 40px;
  padding: 0;
  line-height: 1.5;
}
.act-line {
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: var(--fs-sm);
  color: var(--text-2);
  padding: 5px 0;
}
.act-line b {
  color: var(--text);
  font-weight: 500;
}
.act-line .ico {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--text-4);
}

.pop {
  position: fixed;
  z-index: 80;
  min-width: 200px;
  max-width: 320px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  padding: 4px;
  transform-origin: top left;
  max-height: min(420px, 70vh);
  overflow-y: auto;
  font-size: var(--fs);
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.pop.enter {
  animation: popIn 0.16s var(--ease) both;
}
.pop .pin {
  padding: 4px 4px 6px;
  border-bottom: 1px solid var(--divider);
  margin: -4px -4px 4px;
  padding: 8px;
}
.pop .pin input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: var(--fs);
  padding: 0 4px;
}
.mi {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 30px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  text-align: left;
  color: var(--text);
  font-size: var(--fs);
  white-space: nowrap;
}
.mi.hl,
.mi:focus-visible {
  background: var(--surface-2);
  outline: none;
}
@media (hover: hover) and (pointer: fine) {
  .mi:hover {
    background: var(--surface-2);
    outline: none;
  }
}
.mi .i {
  color: var(--text-2);
}
.mi .r {
  margin-left: auto;
  color: var(--text-3);
  font-size: var(--fs-xs);
  display: flex;
  gap: 4px;
  align-items: center;
}
.mi .ck {
  margin-left: auto;
  color: var(--accent);
}
.mi.danger {
  color: var(--red);
}
.mi.danger .i {
  color: var(--red);
}
.mi:disabled {
  opacity: 0.45;
  pointer-events: none;
}
.msep {
  height: 1px;
  background: var(--divider);
  margin: 4px -4px;
}
.mh {
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-3);
  padding: 8px 8px 4px;
}
/* Filter builder uses the same insets as every other menu: 4px popover padding + 8px item padding. */
.fbuild {
  min-width: 440px;
}
.fb-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.fb-h .btn {
  text-transform: none;
  letter-spacing: 0;
  margin-right: -4px;
}
.fb-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 8px 6px;
}
.fb-empty {
  margin: 0;
  padding: 2px 8px 8px;
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.fb-add {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 8px 6px;
  font-size: var(--fs-xs);
}
.fb-add .faint {
  margin-right: 4px;
}
.frow {
  display: grid;
  grid-template-columns: 44px 120px 84px minmax(0, 1fr) 26px;
  gap: 6px;
  align-items: center;
}
.frow .conj {
  font-size: var(--fs-xs);
  color: var(--text-3);
  text-align: right;
  padding-right: 4px;
}
.frow .select,
.frow .input {
  height: var(--h-sm);
  font-size: var(--fs-sm);
}
.valbtn {
  height: var(--h-sm);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 0 8px;
  font-size: var(--fs-sm);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
}
@media (hover: hover) and (pointer: fine) {
  .valbtn:hover {
    background: var(--surface-2);
  }
}

.palette {
  position: fixed;
  top: 12vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px));
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  z-index: 90;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 70vh;
}
.pal-in {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 50px;
  border-bottom: 1px solid var(--border);
}
.pal-in input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: var(--fs-md);
  height: 100%;
}
.pal-scope {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--divider);
  flex-wrap: wrap;
}
.pal-scope button {
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  font-size: var(--fs-xs);
  color: var(--text-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pal-scope button.on {
  background: var(--text);
  color: var(--text-inv);
  border-color: var(--text);
}
.pal-list {
  overflow-y: auto;
  padding: 6px;
  flex: 1;
}
.pal-sec {
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-3);
  padding: 10px 10px 4px;
}
.pal-sec + .pi {
  margin-top: 0;
}
.pal-group {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 2px;
}
.pal-group:last-child {
  border-bottom: 0;
}
.pi {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  width: 100%;
  text-align: left;
  font-size: var(--fs);
  cursor: pointer;
}
.pi.hl {
  background: var(--surface-2);
}
.pi .i {
  color: var(--text-2);
}
.pi .sub {
  color: var(--text-3);
  font-size: var(--fs-xs);
  margin-left: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pi .r {
  margin-left: auto;
  display: flex;
  gap: 4px;
  align-items: center;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.pi mark {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}
.pal-f {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-3);
  background: var(--sunken);
}
.pal-f span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

#toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  animation-timing-function: var(--spring) !important;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 8px 8px 12px;
  border-radius: var(--r);
  background: var(--text);
  color: var(--text-inv);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-pop);
  animation: toastIn 0.2s var(--ease) both;
  max-width: 400px;
}
.toast.out {
  animation: toastOut 0.16s ease both;
}
.toast .i.ok {
  color: var(--green);
}
.toast .i.bad {
  color: var(--red);
}
.toast .ta {
  color: var(--text-inv);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  opacity: 0.9;
}
@media (hover: hover) and (pointer: fine) {
  .toast .ta:hover {
    background: color-mix(in srgb, var(--text-inv) 14%, transparent);
  }
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* ============================================================
   STATES: EMPTY / SKELETON / ERROR
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 56px 24px;
  gap: 6px;
}
.empty-state .glyph {
  display: grid;
  place-items: center;
  color: var(--text-4);
  margin-bottom: 4px;
}
.empty-state .glyph svg {
  width: 22px;
  height: 22px;
}
.empty-state .es-h {
  font-size: var(--fs-md);
  font-weight: 600;
  margin: 0;
}
.empty-state p {
  color: var(--text-2);
  font-size: var(--fs-sm);
  margin: 0 0 10px;
  max-width: 340px;
}
.empty-state.sm {
  padding: 28px 16px;
}
.empty-state.err .glyph {
  color: var(--red);
}
.sk {
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 45%, var(--surface-3) 90%);
  background-size: 220% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: 5px;
  display: block;
}
@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -100% 0;
  }
}
.alert {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  font-size: var(--fs-sm);
  align-items: flex-start;
  background: var(--surface);
}
.alert .i {
  margin-top: 1px;
}
.alert.warn {
  background: var(--amber-soft);
  border-color: transparent;
}
.alert.warn .i {
  color: var(--amber);
}
.alert.danger {
  background: var(--red-soft);
  border-color: transparent;
}
.alert.danger .i {
  color: var(--red);
}
.alert.info {
  background: var(--accent-soft);
  border-color: transparent;
}
.alert.info .i {
  color: var(--accent);
}
.alert.ok {
  background: var(--green-soft);
  border-color: transparent;
}
.alert.ok .i {
  color: var(--green);
}
.alert b {
  font-weight: 600;
}
.fullstate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.fullstate .box {
  max-width: 420px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.fullstate .code {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--text-3);
  letter-spacing: 0.08em;
}
.fullstate h1 {
  font-size: var(--fs-xl);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.fullstate p {
  color: var(--text-2);
  margin: 0 0 12px;
}

/* ============================================================
   SETTINGS
   ============================================================ */
.set {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  height: 100%;
}
.set-nav {
  border-right: 1px solid var(--border);
  padding: 20px 10px;
  overflow-y: auto;
  background: var(--surface);
}
.set-nav .gh {
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 14px 8px 4px;
}
.set-nav .gh:first-child {
  padding-top: 0;
}
.set-body {
  overflow-y: auto;
}
.set-in {
  max-width: 720px;
  padding: 32px 40px 80px;
}
.set-in h1 {
  font-size: var(--fs-xl);
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.015em;
}
.set-in > p.lead {
  color: var(--text-2);
  margin: 0 0 24px;
}
.srow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--divider);
}
.srow .t {
  font-weight: 500;
  font-size: var(--fs);
}
.srow .d {
  color: var(--text-2);
  font-size: var(--fs-sm);
  margin-top: 2px;
}
.sblock {
  margin-top: 28px;
}
.sblock > h2 {
  font-size: var(--fs);
  font-weight: 600;
  margin: 0 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.themecards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.tcard {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 8px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition:
    border-color var(--dur),
    box-shadow var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .tcard:hover {
    border-color: var(--border-strong);
  }
}
.tcard.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.tprev {
  height: 84px;
  border-radius: 6px;
  display: grid;
  grid-template-columns: 30% 1fr;
  overflow: hidden;
  border: 1px solid rgba(128, 128, 128, 0.2);
}
.tprev .s {
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tprev .m {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tprev i {
  display: block;
  height: 5px;
  border-radius: 3px;
}
.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sw {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .sw:hover {
    transform: scale(1.08);
  }
}
.sw.on {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px var(--c);
}
.perm-t {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.perm-t th,
.perm-t td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--divider);
  text-align: center;
}
.perm-t th:first-child,
.perm-t td:first-child {
  text-align: left;
}
.perm-t th {
  font-weight: 500;
  color: var(--text-2);
  font-size: var(--fs-xs);
}
.plan {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan.cur {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.plan .pr {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.plan ul {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.plan li {
  display: flex;
  gap: 7px;
  align-items: center;
}
.plan li .i {
  color: var(--green);
}
.meter {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* ============================================================
   TOOLS & MCP (src/lvlz/integrations.ts)
   ============================================================ */
.int-logo {
  --c: var(--text);
  width: var(--s, 36px);
  height: var(--s, 36px);
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--c);
  font-size: calc(var(--s, 36px) * 0.42);
}
/* Dark brand marks (GitHub, Notion) would vanish on a dark surface. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .int-logo {
    color: color-mix(in srgb, var(--c) 70%, white);
  }
}
:root[data-theme='dark'] .int-logo {
  color: color-mix(in srgb, var(--c) 70%, white);
}
.int-row {
  padding: 14px;
  border-bottom: 1px solid var(--divider);
}
.int-row:last-child {
  border-bottom: 0;
}
.int-row.off > .row:first-child {
  opacity: 0.55;
}
.int-actions {
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 0 48px;
}
[dir='rtl'] .int-actions {
  margin: 10px 48px 0 0;
}
.int-end {
  gap: 4px;
  margin-inline-start: auto;
}
.int-key {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}
.int-tools {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 12.5px;
}
.int-tools li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}
.int-tools code {
  flex: none;
  font-size: 12px;
}
.int-tools .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.int-search {
  position: relative;
  display: flex;
  align-items: center;
}
.int-search > svg {
  position: absolute;
  inset-inline-start: 10px;
  color: var(--text-3);
  pointer-events: none;
}
.int-search .input {
  width: 100%;
  padding-inline-start: 32px;
}
.int-cats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.int-cats::-webkit-scrollbar {
  display: none;
}
.int-cats button {
  flex: none;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.int-cats button.on {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.int-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 10px;
}
.int-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md, 10px);
  background: var(--surface);
  transition: border-color 0.15s ease;
}
.int-card.wide {
  grid-column: 1 / -1;
}
.int-card p {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
}
@media (hover: hover) and (pointer: fine) {
  .int-card:hover {
    border-color: color-mix(in srgb, var(--text) 25%, var(--border));
  }
  .int-cats button:not(.on):hover {
    color: var(--text);
  }
}
@media (max-width: 640px) {
  .int-actions,
  [dir='rtl'] .int-actions {
    margin-inline: 0;
  }
  .int-cats button {
    height: 36px;
  }
}

/* ============================================================
   MOVE FROM ANOTHER APP (src/lvlz/migrate.ts)
   ============================================================ */
.mig-plan {
  overflow: hidden;
}
.mig-parts {
  max-height: min(60vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mig-group {
  padding: 10px 14px 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.mig-part {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 14px;
  border-top: 1px solid var(--divider);
}
.mig-part:first-child {
  border-top: 0;
}
.mig-part > .grow {
  display: flex;
  flex-direction: column;
}
.mig-part.off > .grow {
  opacity: 0.5;
}
.mig-part .seg {
  flex: none;
}
.mig-spin {
  display: inline-flex;
  color: var(--text-3);
  animation: mig-spin 1s linear infinite;
}
@keyframes mig-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .mig-spin {
    animation: none;
  }
}
@media (max-width: 640px) {
  .mig-part {
    flex-wrap: wrap;
  }
  .mig-part .seg {
    margin-inline-start: 28px;
  }
}

/* Bookings: appointments by day, the time picker, and the booking page's settings. */
.bk-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 14px;
  border-top: 1px solid var(--divider);
}
.bk-row:first-of-type {
  border-top: 0;
}
.bk-row.off {
  opacity: 0.62;
}
.bk-time {
  display: flex;
  flex-direction: column;
  width: 64px;
  flex: none;
  font-size: var(--fs-sm);
}
.bk-time span {
  font-size: 11.5px;
}
.bk-meta {
  font-size: 12.5px;
  margin-top: 2px;
}
.bk-meta a {
  color: inherit;
}
.bk-acts {
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.bk-times {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bk-chip {
  font-variant-numeric: tabular-nums;
}
.bk-chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.bk-chip.on .faint {
  color: inherit;
  opacity: 0.8;
}
.bk-link {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  flex-wrap: wrap;
}
.bk-svc {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--divider);
}
.bk-add {
  border-top: 1px solid var(--divider);
}
.bk-hours {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px 12px;
}
@media (max-width: 640px) {
  .bk-row {
    flex-wrap: wrap;
  }
  .bk-acts {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ============================================================
   AUTH / ONBOARDING
   ============================================================ */
.auth {
  min-height: 100%;
  height: 100%;
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
}
.auth-c {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 40px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-card h1 {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.022em;
  margin: 0;
  text-align: center;
}
.auth-card .sub {
  text-align: center;
  color: var(--text-2);
  margin: -8px 0 4px;
}
.or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.or::before,
.or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.social {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.social .btn {
  justify-content: center;
  gap: 10px;
}
.glyph-g,
.glyph-m,
.glyph-a {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.link {
  color: var(--accent);
  font-weight: 500;
}
@media (hover: hover) and (pointer: fine) {
  .link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}
.auth-foot {
  text-align: center;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.strength {
  display: flex;
  gap: 4px;
}
.strength i {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-3);
}
.strength i.on {
  background: var(--c);
}
.onb {
  max-width: 560px;
}
.steps {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
}
.steps i {
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background: var(--border-strong);
  transition: background 0.2s;
}
.steps i.on {
  background: var(--accent);
}
.opts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.opt {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: var(--surface);
  transition:
    border-color var(--dur),
    box-shadow var(--dur),
    background var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .opt:hover {
    border-color: var(--border-strong);
  }
}
.opt.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.opt .i {
  color: var(--text-2);
}
.opt.on .i {
  color: var(--accent);
}
.opt b {
  font-weight: 500;
  font-size: var(--fs);
}
.opt span {
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.tmpls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.iconpick {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}
.iconpick button {
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--text-2);
  border: 1px solid transparent;
}
@media (hover: hover) and (pointer: fine) {
  .iconpick button:hover {
    background: var(--surface-2);
  }
}
.iconpick button.on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* design system page */
.ds-sec {
  margin-top: 36px;
}
.ds-sec > h2 {
  font-size: var(--fs-md);
  font-weight: 600;
  margin: 0 0 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.ds-sec > h2 span {
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-weight: 400;
}
.ds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.ds-tok {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  font-size: var(--fs-xs);
}
.ds-tok .c {
  height: 44px;
  background: var(--c);
  border-bottom: 1px solid var(--border);
}
.ds-tok .n {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
}
.ds-tok .n code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}
.ds-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 8px;
}
.ds-row .lab {
  width: 90px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  flex-shrink: 0;
}
.state-hover {
  background: var(--surface-2) !important;
}
.btn-primary.state-hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--text)) !important;
}
.btn-primary.state-active {
  background: color-mix(in srgb, var(--accent) 78%, var(--text)) !important;
}
.state-focus {
  outline: 2px solid var(--accent) !important;
  outline-offset: 1px;
}
.states-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.states-grid .panel {
  overflow: hidden;
}
.states-grid .cap {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-2);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--sunken);
}

/* ---------- phone field: country picker + number (src/ui/phone.ts) ---------- */
.phin-wrap {
  position: relative;
}
.phin {
  display: flex;
  align-items: center;
  height: var(--h-lg);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  transition:
    border-color var(--dur),
    box-shadow var(--dur);
}
.phin:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.phin.is-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}
.phin-cc {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 0 8px 0 12px;
  border-right: 1px solid var(--divider);
  color: var(--text-3);
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}
.phin-cc:hover {
  background: var(--surface-2);
}
.phin-flag {
  font-size: 20px;
  line-height: 1;
}
.phin-dial {
  padding-left: 10px;
  color: var(--text-2);
}
.phin input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0 10px 0 6px;
  font-size: var(--fs);
}
.phin-scrim {
  position: fixed;
  inset: 0;
  z-index: 79;
  cursor: default;
}
.phin-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: popIn 0.16s var(--ease) both;
}
.phin-q {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 44px;
  border-bottom: 1px solid var(--divider);
  color: var(--text-3);
}
.phin-q input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: var(--fs);
}
.phin-list {
  max-height: min(300px, 45vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
}
.phin-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  text-align: start;
}
.phin-opt:hover,
.phin-opt:focus-visible,
.phin-opt.on {
  background: var(--surface-2);
}
.phin-none {
  padding: 12px;
}
@media (pointer: coarse) {
  .phin-dial {
    font-size: 16px;
  }
}

/* AI app consent (oauth.lvlz.ai): the app's logo and LVLZ's, joined, as on Supabase's and Vercel's screens. */
.oa-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 4px;
}
.oa-logo {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  overflow: hidden;
}
.oa-logo img {
  border-radius: 6px;
  object-fit: contain;
}
.oa-link {
  display: flex;
  gap: 5px;
}
.oa-link i {
  width: 5px;
  height: 5px;
  border-radius: var(--r-full);
  background: var(--border-strong);
}
.oa-link i:nth-child(2) {
  background: var(--accent);
}
.oa-box {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 14px 16px;
}
.oa-box p {
  margin: 0 0 10px;
  font-weight: 500;
}
.oa-box ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.oa-box li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.oa-box li .i {
  flex: none;
  margin-top: 2px;
  color: var(--text-3);
}
.oa-meta {
  margin: 0;
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.oa-meta b {
  color: var(--text);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.oa-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.oa-actions .btn {
  justify-content: center;
}

/* A document the agent made: its versions, one at a time, and its page in a frame. */
.doc-page .ph {
  align-items: center;
}
.doc-back {
  margin-left: -6px;
}
.doc-h {
  min-width: 0;
}
.doc-ver {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}
.doc-ver .ibtn:disabled {
  opacity: 0.35;
  cursor: default;
}
.doc-ver-t {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  line-height: 1.35;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.doc-ver-t .faint {
  font-size: var(--fs-xs);
}
.doc-edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.doc-text {
  width: 100%;
  height: calc(100dvh - var(--topbar-h) - 240px);
  min-height: 360px;
  padding: 14px;
  font: var(--fs-sm) / 1.55 var(--mono);
  resize: vertical;
  /* Each line reads in its own direction, so Hebrew and English lines both sit right. */
  unicode-bidi: plaintext;
}
.doc-edit-f {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--fs-xs);
}
.doc-frame {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: #fff;
}
.doc-frame iframe {
  display: block;
  width: 100%;
  height: calc(100dvh - var(--topbar-h) - 230px);
  min-height: 480px;
  border: 0;
}
@media (max-width: 900px) {
  /* The page edge to edge on a phone, the way the document prints. */
  .doc-use {
    flex-basis: 100%;
    justify-content: center;
  }
  .doc-page .ph .acts .btn-primary {
    flex: 1;
    justify-content: center;
  }
  /* Room for the save button above the bottom bar and the keyboard. */
  .doc-text {
    height: 48dvh;
    min-height: 240px;
  }
  .doc-edit-f .faint {
    flex-basis: 100%;
  }
  .doc-edit-f .btn {
    flex: 1;
    justify-content: center;
  }
  .doc-frame {
    margin: 0 calc(-1 * var(--gutter));
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .doc-frame iframe {
    height: calc(100dvh - var(--topbar-h) - 200px - env(safe-area-inset-bottom, 0px));
    min-height: 420px;
  }
}

/* A file the agent made: the version on screen, ready to download. */
.file-ver {
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
.file-ver-art {
  width: 220px;
  flex: none;
  border-right: 1px solid var(--border);
}
.file-ver-art .fprev {
  height: 100%;
  border-bottom: 0;
}
.file-ver-i {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 18px 20px;
  font-size: var(--fs-sm);
}
.file-ver-i b {
  max-width: 100%;
  font-size: var(--fs-md, 15px);
}
.file-ver-i .btn {
  margin-top: 8px;
}
@media (max-width: 640px) {
  .file-ver {
    flex-direction: column;
  }
  .file-ver-art {
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .file-ver-art .fprev {
    height: 132px;
    aspect-ratio: auto;
  }
  .file-ver-i .btn {
    align-self: stretch;
    justify-content: center;
    min-height: 44px;
  }
}

/* ============================================================
   HOME: one question, the ask box, then the overview.
   Plain black or white behind it, by theme.
   ============================================================ */
:root {
  --home-bg: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --home-bg: #000000;
  }
}
:root[data-theme='dark'] {
  --home-bg: #000000;
}

.main:has(> .content > .home),
.main:has(> .content > .home) > .topbar {
  background: var(--home-bg);
}
.home {
  --home-w: 960px;
  padding-bottom: 72px;
  background: var(--home-bg);
  min-height: 100%;
}

/* ---------- the question ---------- */
.home-hero {
  padding-top: 64px;
}
.home-q {
  position: relative;
  text-align: center;
  padding: 0 var(--gutter) 18px;
}
.home-q h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-wrap: balance;
}
.home-greet {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-3);
}

/* ---------- the ask box ---------- */
.home-box {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.25);
  transition:
    border-color var(--dur),
    box-shadow var(--dur);
}
.home-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent),
    0 10px 30px -12px rgba(0, 0, 0, 0.25);
}
.home-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 6px 0;
}
.home-tabs [role='tab'] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition:
    background var(--dur),
    color var(--dur);
}
.home-tabs [role='tab'].on {
  background: var(--surface-2);
  color: var(--text);
}
.home-tabs [role='tab']:active {
  background: var(--surface-3);
}
.home-box textarea {
  display: block;
  width: 100%;
  min-height: 64px;
  max-height: 200px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 10px 16px 4px;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}
.home-box textarea::placeholder {
  color: var(--text-3);
}
.home-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 8px 16px;
}
.home-hint {
  font-size: 12px;
}
.home-send {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  touch-action: manipulation;
  transition:
    transform 120ms var(--ease),
    opacity var(--dur),
    background var(--dur);
}
.home-send:disabled {
  background: var(--surface-3);
  color: var(--text-3);
  cursor: default;
}
.home-send:not(:disabled):active {
  transform: scale(0.94);
}
.home-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 640px;
  margin: 12px auto 0;
  padding: 0 var(--gutter);
}
.home-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-2);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition:
    background var(--dur),
    color var(--dur),
    transform 120ms var(--ease);
}
.home-chip:active {
  transform: scale(0.97);
}
@media (hover: hover) and (pointer: fine) {
  .home-tabs [role='tab']:not(.on):hover {
    color: var(--text);
  }
  .home-chip:hover {
    background: var(--surface-2);
    color: var(--text);
  }
}

/* ---------- the overview ---------- */
.home-body {
  max-width: var(--home-w);
  margin: 40px auto 0;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.home-body .stats {
  background: var(--surface);
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.home .panel-h h2 {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.home .panel-h h2 > .i {
  color: var(--text-3);
}
.home-proj {
  gap: 10px;
}
.home-proj .prog {
  width: 72px;
  flex: none;
}
.home-pct {
  width: 30px;
  font-size: 11.5px;
  text-align: right;
}
.home-due {
  width: 48px;
  font-size: 12px;
  text-align: right;
}
.home-chart-n {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
}
.home-chart-n b {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.home-bars {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 4px;
  height: 96px;
  margin-top: 10px;
}
.home-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}
.home-bar i {
  display: block;
  height: calc(var(--h) * 72px);
  min-height: 2px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 55%, var(--surface-3));
  transform-origin: bottom;
}
.home-bar.today i {
  background: var(--accent);
}
.home-bar span {
  font-size: 10.5px;
  text-align: center;
  color: var(--text-3);
}

@media (max-width: 900px) {
  .home-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 640px) {
  .home-hero {
    padding-top: 36px;
  }
  .home-q {
    padding: 0 16px 14px;
  }
  .home-q h1 {
    font-size: 22px;
  }
  .home-box {
    margin: 0 16px;
  }
  .home-chips {
    padding: 0 16px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .home-chips::-webkit-scrollbar {
    display: none;
  }
  .home-chip {
    flex: none;
  }
  .home-hint {
    display: none;
  }
  .home-body {
    margin-top: 28px;
    padding: 0 16px;
  }
}

/* ============================================================
   AGENT CHAT: the shell's third column
   Patterns from aicss (shimmer, folding reasoning, caret, approval
   card, framed composer), drawn with gr8r's tokens.
   ============================================================ */
.shell.chat-open {
  --chat-w: 400px;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--chat-w);
}
.shell.collapsed.chat-open {
  grid-template-columns: 52px minmax(0, 1fr) var(--chat-w);
}
.chat-toggle.on {
  color: var(--accent);
  background: var(--accent-soft);
}
.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
}
.chat-h {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-name {
  font-weight: 560;
  font-size: var(--fs);
  line-height: 1.2;
}
.chat-sub {
  color: var(--text-3);
  font-size: var(--fs-2xs);
}
.chat-orb {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: #f73859;
  color: #fff;
}

/* ---------- conversation ---------- */
.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.chat-turn {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.chat-bubble {
  max-width: 85%;
  padding: 7px 11px;
  border-radius: var(--r-lg);
  background: var(--surface-3);
  color: var(--text);
  font-size: var(--fs);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.chat-files {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}
.chat-file {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-2xs);
  color: var(--text-3);
}
.chat-agent {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.chat-agent:empty {
  display: none;
}

/* streamed answer */
.chat-prose {
  font-size: var(--fs);
  line-height: 1.6;
  color: var(--text);
  overflow-wrap: anywhere;
}
.chat-prose p,
.chat-prose ul,
.chat-prose ol {
  margin: 0 0 8px;
}
.chat-prose > :last-child {
  margin-bottom: 0;
}
.chat-prose ul,
.chat-prose ol {
  padding-left: 18px;
}
.chat-prose li + li {
  margin-top: 2px;
}
.chat-prose code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 1px 4px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
}
.chat-prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chat-prose.is-streaming > :last-child {
  display: inline;
}
.chat-caret {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--text);
  border-radius: 1px;
  animation: chat-blink 1s steps(1) infinite;
}
@keyframes chat-blink {
  50% {
    opacity: 0;
  }
}

/* thinking */
.chat-think {
  font-size: var(--fs-sm);
}
.chat-shimmer {
  background: linear-gradient(90deg, var(--text-4) 0%, var(--text-4) 35%, var(--text) 50%, var(--text-4) 65%, var(--text-4) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: chat-shimmer 1.8s linear infinite;
}
@keyframes chat-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -150% 0;
  }
}
.chat-reason-h {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  transition: color var(--dur);
}
.chat-reason-h b {
  font-weight: 520;
}
@media (hover: hover) and (pointer: fine) {
  .chat-reason-h:hover {
    color: var(--text);
  }
}
.chat-reason-h svg {
  transition: transform 0.2s var(--ease);
}
.chat-reason.open .chat-reason-h svg {
  transform: rotate(180deg);
}
.chat-reason-b {
  margin-top: 6px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
  color: var(--text-3);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

/* tool calls */
.chat-tool {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--sunken);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.chat-tool > svg {
  flex-shrink: 0;
}
.chat-tool.is-done > svg {
  color: var(--green);
}
.chat-tool.is-error > svg {
  color: var(--red);
}
.chat-tool-d {
  color: var(--text-4);
  margin-left: auto;
  max-width: 50%;
}
.chat-spin {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--text-2);
  animation: chat-spin 0.7s linear infinite;
}
@keyframes chat-spin {
  to {
    transform: rotate(360deg);
  }
}

/* questions and approvals */
.chat-ask {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.chat-ask-h {
  display: flex;
  gap: 9px;
  padding: 10px 12px;
}
.chat-ask-i {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
}
.chat-ask-t {
  font-weight: 540;
  font-size: var(--fs);
  line-height: 1.4;
}
.chat-ask-s {
  margin-top: 2px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.chat-ask-o {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--divider);
  padding: 4px;
}
.chat-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs);
  text-align: left;
  transition: background var(--dur);
}
.chat-opt:focus-visible {
  background: var(--surface-2);
}
@media (hover: hover) and (pointer: fine) {
  .chat-opt:hover {
    background: var(--surface-2);
  }
}
.chat-opt kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: var(--fs-2xs);
}
.chat-opt.is-primary {
  color: var(--accent);
  font-weight: 540;
}
.chat-opt.is-danger {
  color: var(--red);
}
.chat-ask-out {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--divider);
  padding: 8px 12px;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.chat-ask.is-done {
  box-shadow: none;
  border-color: var(--border);
}
.chat-err,
.chat-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
}
.chat-err {
  color: var(--red);
}
.chat-note {
  color: var(--text-4);
}

/* empty state */
.chat-empty {
  margin: auto 0;
  padding: 24px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}
.chat-empty h2 {
  margin: 6px 0 0;
  font-size: var(--fs-lg);
  font-weight: 600;
}
.chat-empty p {
  margin: 0;
  color: var(--text-3);
  font-size: var(--fs-sm);
  line-height: 1.5;
  max-width: 300px;
}
.chat-sugg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin-top: 12px;
}
.chat-chip {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  color: var(--text-2);
  text-align: left;
  transition:
    background var(--dur),
    border-color var(--dur);
}
@media (hover: hover) and (pointer: fine) {
  .chat-chip:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
  }
}

/* ---------- history ---------- */
.chat-search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px 0 10px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  color: var(--text-3);
  flex-shrink: 0;
  transition:
    border-color var(--dur),
    box-shadow var(--dur);
}
.chat-search:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chat-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--text);
}
.chat-scroll:has(.chat-search) {
  gap: 2px;
}
.chat-search + * {
  margin-top: 8px;
}
.chat-hist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  text-align: left;
  min-width: 0;
}
button.chat-hist {
  transition: background var(--dur);
}
button.chat-hist:focus-visible {
  background: var(--surface-2);
}
@media (hover: hover) and (pointer: fine) {
  button.chat-hist:hover {
    background: var(--surface-2);
  }
}
.chat-hist-t {
  font-size: var(--fs);
  font-weight: 520;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-hist-t b {
  color: var(--accent);
  font-weight: 520;
}
.chat-hist-s {
  font-size: var(--fs-sm);
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-elsewhere {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--sunken);
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.chat-h .ibtn.on {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- composer ---------- */
.chat-in {
  padding: 8px 12px 12px;
  flex-shrink: 0;
}
.chat-frame {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition:
    border-color var(--dur),
    box-shadow var(--dur);
}
.chat-frame:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chat-field {
  display: block;
  width: 100%;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 10px 12px 2px;
  font: inherit;
  font-size: var(--fs);
  line-height: 1.5;
  color: var(--text);
}
.chat-field::placeholder {
  color: var(--text-4);
}
.chat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 6px 12px;
}
.chat-hint {
  color: var(--text-4);
  font-size: var(--fs-2xs);
}
.chat-send {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  background: var(--text);
  color: var(--surface);
  transition:
    opacity var(--dur),
    transform 0.12s var(--ease);
}
.chat-send:active:not(:disabled) {
  transform: scale(0.94);
}
.chat-send:disabled {
  opacity: 0.25;
  cursor: default;
}
.chat-send.is-stop svg {
  fill: currentColor;
}

/* Toasts stay clear of the composer while the column is open. */
@media (min-width: 1101px) {
  body:has(.shell.chat-open) #toasts {
    right: calc(400px + 20px);
  }
}

/* ---------- small screens: the chat covers the page ---------- */
@media (max-width: 1100px) {
  .shell.chat-open,
  .shell.collapsed.chat-open {
    grid-template-columns: var(--side-w) minmax(0, 1fr);
  }
  .shell.collapsed.chat-open {
    grid-template-columns: 52px minmax(0, 1fr);
  }
  /* Pinned to the visible area, so the open keyboard never covers the composer (see core/viewport.ts). */
  .chat {
    position: fixed;
    top: var(--vv-top, 0px);
    right: 0;
    height: var(--vv-h, 100%);
    width: min(420px, 100vw);
    z-index: 60;
    box-shadow: var(--shadow-pop);
  }
  .chat.fx-in {
    animation: chat-in 0.24s var(--ease-drawer);
  }
}
@media (max-width: 900px) {
  .shell.chat-open,
  .shell.collapsed.chat-open {
    grid-template-columns: minmax(0, 1fr);
  }
  .chat {
    width: 100vw;
    border-left: 0;
    z-index: 80;
  }
  .chat-hint {
    display: none;
  }
}
@keyframes chat-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .chat-caret,
  .chat-shimmer,
  .chat-spin,
  .chat {
    animation: none;
  }
  .chat-shimmer {
    color: var(--text-3);
  }
}

/* photos and files waiting to go with the next message */
.chat-pending:empty {
  display: none;
}
.chat-pending .chat-files {
  justify-content: flex-start;
  padding: 8px 10px 0;
}
.chat-pending .chat-file {
  max-width: 220px;
  padding: 3px 4px 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
}
.chat-pending .chat-file.is-failed {
  color: var(--red);
  border-color: currentColor;
}
.chat-pct {
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}
.chat-file-x {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: var(--r-xs);
  background: none;
  color: var(--text-3);
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .chat-file-x:hover {
    background: var(--surface-3);
    color: var(--text);
  }
}
.chat-attach {
  margin-left: -6px;
  cursor: pointer;
}

/* voice notes: tap the mic to talk, tap stop to send */
.chat-rec.is-on {
  background: color-mix(in srgb, var(--red) 14%, transparent);
  color: var(--red);
  animation: chat-rec 1.4s ease-in-out infinite;
}
@keyframes chat-rec {
  50% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 18%, transparent);
  }
}
@media (prefers-reduced-motion: reduce) {
  .chat-rec.is-on {
    animation: none;
  }
}

/* the document a message is about, from its page in the app */
.chat-ctx {
  padding: 8px 10px 0;
}
.chat-about {
  max-width: 100%;
  padding: 3px 4px 3px 8px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--text-2);
}
.chat-user .chat-about {
  padding-right: 8px;
}
@media (pointer: coarse) {
  .chat-ctx .chat-file-x {
    width: 28px;
    height: 28px;
  }
}

/* ============================================================
   WORKFLOWS: the page of workflow cards, and the editor panel
   (palette · canvas · inspector) that opens over the page from
   the right, the way the chat does.
   ============================================================ */

/* ---------- page ---------- */
.wf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.wf-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  text-align: start;
  transition: box-shadow var(--dur) var(--ease);
  -webkit-user-select: none;
  user-select: none;
}
.wf-card:active {
  box-shadow: var(--shadow-card), 0 0 0 1px var(--border-strong);
}
@media (hover: hover) and (pointer: fine) {
  .wf-card:hover {
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--border-strong);
  }
}
.wf-card-h {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wf-card-h h3 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 560;
}
.wf-card-h p {
  margin: 1px 0 0;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.wf-desc {
  margin: -4px 0 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wf-card-f {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  margin-top: auto;
}
.wf-ico {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--r);
  background: var(--accent-soft);
  color: var(--accent);
}
.wf-chain {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}
.wf-chip {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
}
.wf-arrow {
  display: inline-flex;
  color: var(--text-4);
}
.wf-more {
  font-size: var(--fs-xs);
  color: var(--text-3);
  padding: 0 4px;
}
.wf-outs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.wf-thumb {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--border);
  flex-shrink: 0;
}
.wf-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.wf-doc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 200px;
  height: 28px;
  padding: 0 9px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.wf-thumb:active,
.wf-doc:active {
  transform: scale(0.97);
}
.wf-err {
  display: flex;
  gap: 6px;
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--red);
  line-height: 1.45;
}
.wf-err .i {
  flex-shrink: 0;
  margin-top: 1px;
}
.wf-h2 {
  font-size: var(--fs-md);
  font-weight: 560;
  margin: 28px 0 10px;
}
.wf-empty {
  padding: 28px;
  text-align: center;
}
.wf-empty h2 {
  font-size: var(--fs-lg);
  margin: 12px 0 6px;
}
.wf-empty p {
  color: var(--text-2);
  max-width: 520px;
  margin: 0 auto 20px;
  line-height: 1.55;
}
.wf-empty-ico {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent);
}
.wf-starters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  text-align: start;
}
.wf-starter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r-lg);
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  color: var(--text-3);
  text-align: start;
}
.wf-starter b {
  display: block;
  color: var(--text);
  font-weight: 540;
  font-size: var(--fs);
}
.wf-starter small {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.4;
}
.wf-starter:active {
  background: var(--surface-2);
}
@media (hover: hover) and (pointer: fine) {
  .wf-starter:hover {
    border-color: var(--accent-line);
    background: var(--surface-2);
  }
}

/* ---------- panel ---------- */
/* The editor covers only the page column: the sidebar and the chat stay bright and usable beside it. */
.wf-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--side-w);
  z-index: 55;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  container: wf / inline-size;
}
.shell.collapsed .wf-panel {
  left: 52px;
}
.wf-panel.fx-in {
  animation: chat-in 0.26s var(--ease-drawer);
}
@media (min-width: 1101px) {
  .shell.chat-open .wf-panel {
    right: var(--chat-w, 400px);
    border-right: 1px solid var(--border);
  }
}
.wf-h {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--topbar-h);
  padding: 0 10px 0 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wf-h .wf-ico {
  width: 26px;
  height: 26px;
}
.wf-name {
  min-width: 0;
  flex: 0 1 320px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: var(--fs-md);
  font-weight: 560;
  color: var(--text);
}
.wf-name:focus {
  border-color: var(--border-strong);
  background: var(--surface);
  outline: none;
}
@media (hover: hover) and (pointer: fine) {
  .wf-name:hover {
    background: var(--surface-2);
  }
}
.wf-state {
  font-size: var(--fs-xs);
  color: var(--text-3);
  white-space: nowrap;
}
.wf-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 12px;
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  flex-shrink: 0;
}
.wf-banner.red {
  background: var(--red-soft);
}
.wf-banner .wf-thumb {
  width: 32px;
  height: 32px;
}
.wf-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 320px;
}

/* ---------- palette ---------- */
.wf-pal {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-side);
}
.wf-pal-h {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.wf-pal-h .inwrap {
  flex: 1;
  min-width: 0;
}
.wf-pal-x {
  display: none;
}
.wf-pal-note {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 2px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--accent);
}
.wf-pal-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 6px 16px;
}
.wf-pal-g {
  padding: 12px 8px 4px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.wf-pal-i {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border-radius: var(--r);
  text-align: start;
  color: var(--text);
  cursor: grab;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.wf-pal-i b {
  display: block;
  font-weight: 500;
  font-size: var(--fs-sm);
}
.wf-pal-i small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--fs-2xs);
  color: var(--text-3);
  line-height: 1.35;
}
.wf-pal-i:active {
  background: var(--surface-3);
}
@media (hover: hover) and (pointer: fine) {
  .wf-pal-i:hover {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }
}
.wf-pad {
  padding: 12px 8px;
  margin: 0;
  font-size: var(--fs-sm);
}
.wf-nico {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  color: var(--c);
  background: color-mix(in srgb, var(--c) 13%, transparent);
}
.wf-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 200;
  pointer-events: none;
  padding: 7px 12px;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-drag);
  font-size: var(--fs-sm);
  font-weight: 500;
}

/* ---------- canvas ---------- */
.wf-stage {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--border-strong) 1px, transparent 1.2px);
  touch-action: none;
  overscroll-behavior: contain;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.wf-stage:active {
  cursor: grabbing;
}
.wf-world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}
.wf-edges {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
}
.wf-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
  cursor: pointer;
}
.wf-edge-line,
.wf-edge-temp {
  fill: none;
  stroke: var(--text-4);
  stroke-width: 2;
  pointer-events: none;
  transition: stroke var(--dur);
}
.wf-edge-temp {
  stroke: var(--accent);
  stroke-dasharray: 6 5;
}
.wf-edge.no .wf-edge-line {
  stroke-dasharray: 5 5;
}
.wf-edge.ran .wf-edge-line {
  stroke: var(--green);
}
.wf-edge.on .wf-edge-line {
  stroke: var(--accent);
  stroke-width: 2.5;
}
@media (hover: hover) and (pointer: fine) {
  .wf-edge:hover .wf-edge-line {
    stroke: var(--text-2);
  }
}
.wf-edge-x {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--red);
  box-shadow: var(--shadow-pop);
}
.wf-node {
  position: absolute;
  width: 240px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 12px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: box-shadow var(--dur) var(--ease);
}
.wf-node.k-trigger {
  border-radius: 22px var(--r-lg) var(--r-lg) 22px;
}
.wf-node.on {
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-sm);
}
.wf-node.dragging {
  box-shadow: var(--shadow-drag);
  z-index: 2;
  cursor: grabbing;
}
.wf-node.drop {
  box-shadow: 0 0 0 2px var(--accent-line), var(--shadow-sm);
}
.wf-node.st-failed {
  box-shadow: 0 0 0 1.5px var(--red), var(--shadow-sm);
}
.wf-node.st-skipped {
  opacity: 0.6;
}
.wf-node:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) {
  .wf-node:hover {
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--border-strong);
  }
  .wf-node.on:hover {
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-sm);
  }
}
.wf-ntext {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.wf-ntitle {
  font-size: var(--fs-sm);
  font-weight: 560;
}
.wf-nsub {
  font-size: var(--fs-2xs);
  color: var(--text-3);
  margin-top: 2px;
}
.wf-st {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  color: #fff;
  background: var(--gray);
}
.wf-st.done {
  background: var(--green);
}
.wf-st.failed {
  background: var(--red);
}
/* Ports: a visible dot, with a larger invisible area for fingers. */
.wf-port {
  position: absolute;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--text-4);
  z-index: 1;
  transition:
    border-color var(--dur),
    transform var(--dur) var(--ease);
}
.wf-port::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
}
.wf-port.in {
  left: -6px;
  top: 50%;
  pointer-events: none;
}
.wf-port.out {
  right: -6px;
  top: 50%;
  cursor: crosshair;
}
.wf-port.t {
  top: 21px;
  border-color: var(--green);
}
.wf-port.f {
  top: 43px;
  border-color: var(--red);
}
.wf-port i {
  position: absolute;
  left: 14px;
  top: -4px;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  pointer-events: none;
}
.wf-port.out:active {
  transform: scale(1.3);
}
@media (hover: hover) and (pointer: fine) {
  .wf-port.out:hover {
    border-color: var(--accent);
    transform: scale(1.25);
  }
}
.wf-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -10%);
  width: min(360px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
  border-radius: var(--r-lg);
  border: 1px dashed var(--border-strong);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  font-size: var(--fs-sm);
  color: var(--text-3);
  line-height: 1.5;
}
.wf-hint b {
  color: var(--text);
  font-size: var(--fs);
}
.wf-zoom {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.wf-zl {
  min-width: 42px;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--text-2);
}
.wf-add-m {
  display: none;
}

/* ---------- inspector ---------- */
.wf-insp {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
}
.wf-insp-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border-bottom: 1px solid var(--border);
}
.wf-insp-h b {
  display: block;
  font-weight: 560;
}
.wf-insp-h small {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.wf-insp-b {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wf-op-d {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.5;
}
.wf-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -6px 0 0;
  font-size: var(--fs-xs);
  color: var(--amber);
}
.wf-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.wf-refs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}
.wf-refs-l {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.wf-ref {
  padding: 0 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.wf-ref:active {
  transform: scale(0.97);
}
.wf-sec {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}
.wf-sec-h {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
}
.wf-out {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--sunken);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.wf-runrow {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px;
  margin: 0 -6px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  text-align: start;
}
.wf-runrow:active {
  background: var(--surface-2);
}
@media (hover: hover) and (pointer: fine) {
  .wf-runrow:hover {
    background: var(--surface-2);
  }
}
.wf-del {
  align-self: flex-start;
}


/* ---------- narrower screens: the inspector floats, then everything becomes sheets ---------- */
/* Narrow editor (small window, or the chat open beside it): the inspector floats over the canvas. */
@container wf (max-width: 1100px) {
  .wf-body {
    grid-template-columns: 232px minmax(0, 1fr);
    position: relative;
  }
  .wf-insp {
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: 10px;
    width: min(340px, calc(100% - 20px));
    border: 0;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-pop);
    display: none;
    overflow: hidden;
    z-index: 3;
  }
  .wf-body.insp-open .wf-insp {
    display: flex;
    animation: chat-in 0.22s var(--ease-drawer);
  }
}
@media (max-width: 900px) {
  .wf-panel,
  .shell.collapsed .wf-panel {
    left: 0;
    top: var(--vv-top, 0px);
    height: var(--vv-h, 100dvh);
    width: 100vw;
    border-left: 0;
    z-index: 70;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .wf-h {
    padding-top: env(safe-area-inset-top);
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
  }
  .wf-hide-s,
  .wf-state {
    display: none;
  }
  .wf-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .wf-pal {
    position: absolute;
    inset: auto 0 0 0;
    height: min(70%, 560px);
    border: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-pop);
    display: none;
    z-index: 4;
  }
  .wf-body.pal-open .wf-pal {
    display: flex;
    animation: wf-up 0.26s var(--ease-drawer);
  }
  .wf-pal-x {
    display: inline-grid;
  }
  .wf-pal-i {
    padding: 10px 8px;
  }
  .wf-insp {
    inset: auto 0 0 0;
    top: auto;
    width: 100%;
    height: min(72%, 620px);
    border-radius: 16px 16px 0 0;
  }
  .wf-body.insp-open .wf-insp {
    animation: wf-up 0.26s var(--ease-drawer);
  }
  .wf-add-m {
    display: inline-flex;
    position: absolute;
    right: 14px;
    bottom: 14px;
    box-shadow: var(--shadow-pop);
  }
  .wf-body.insp-open .wf-add-m,
  .wf-body.pal-open .wf-add-m {
    display: none;
  }
  .wf-hint {
    transform: translate(-50%, -60%);
  }
}
@keyframes wf-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wf-panel.fx-in,
  .wf-body.insp-open .wf-insp,
  .wf-body.pal-open .wf-pal {
    animation: none;
  }
}

/* ============================================================
   MOTION: one-shot flow animations (gated to the render they belong to)
   ============================================================ */
@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes slideInR {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes growX {
  from {
    transform: scaleX(0);
  }
}
@keyframes popCheck {
  0% {
    transform: scale(0.55);
  }
  55% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes strike {
  to {
    background-size: 100% 1.5px;
  }
}
@keyframes doneWash {
  from {
    background: var(--green-soft);
  }
  to {
    background: transparent;
  }
}
@keyframes doneRing {
  from {
    box-shadow:
      0 0 0 2px var(--green),
      var(--shadow-card);
  }
  to {
    box-shadow: var(--shadow-card);
  }
}
@keyframes land {
  0% {
    transform: scale(1.04) rotate(-1.2deg);
    box-shadow: var(--shadow-drag);
  }
  100% {
    transform: none;
    box-shadow: var(--shadow-card);
  }
}
@keyframes addWash {
  from {
    background: var(--accent-soft);
  }
  to {
    background: transparent;
  }
}
@keyframes addRing {
  from {
    box-shadow:
      0 0 0 2px var(--accent-line),
      var(--shadow-card);
  }
  to {
    box-shadow: var(--shadow-card);
  }
}
/* route change: content rises in, lightly staggered */
.fx-route > .page > *,
.fx-route > .fullstate {
  animation: riseIn 0.36s var(--ease) both;
}
.fx-route > .page > *:nth-child(2) {
  animation-delay: 0.035s;
}
.fx-route > .page > *:nth-child(3) {
  animation-delay: 0.07s;
}
.fx-route > .page > *:nth-child(n + 4) {
  animation-delay: 0.1s;
}
.fx-route .grid2 > * > *:nth-child(2),
.fx-route .grid2 > *:nth-child(2) > *:first-child {
  animation: riseIn 0.4s 0.09s var(--ease) both;
}
.fx-route .prog > i {
  animation: growX 0.8s 0.12s var(--ease) both;
}
.fx-route .stackbar i {
  transform-origin: left;
  animation: growX 0.8s 0.12s var(--ease) both;
}
.fx-route .bar {
  animation: riseIn 0.4s var(--ease) both;
}
.pbody {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pbody.fx-tab > * {
  animation: riseIn 0.26s var(--ease) both;
}
.pbody.fx-tab .kcard {
  animation: riseIn 0.32s var(--ease) both;
}
.pbody.fx-tab .bcol:nth-child(2) .kcard {
  animation-delay: 0.03s;
}
.pbody.fx-tab .bcol:nth-child(3) .kcard {
  animation-delay: 0.06s;
}
.pbody.fx-tab .bcol:nth-child(n + 4) .kcard {
  animation-delay: 0.09s;
}
/* task completed */
.trow.fx-done,
.mini.fx-done {
  animation: doneWash 1s var(--ease) both;
}
.kcard.fx-done {
  animation: doneRing 1s var(--ease) both;
}
.fx-done .check,
.fx-done .done-ic {
  animation: popCheck 0.42s var(--spring) both;
}
.fx-done .tt,
.fx-done .title {
  text-decoration: none !important;
  background: linear-gradient(currentColor, currentColor) 0 58%/0 1.5px no-repeat;
  animation: strike 0.38s 0.1s var(--ease) forwards;
}
/* dropped, created */
.kcard.fx-moved {
  animation: land 0.5s var(--spring) both;
}
.cev.fx-moved,
.wcard.fx-moved {
  animation: popCheck 0.4s var(--spring) both;
}
.trow.fx-added,
.mini.fx-added {
  animation:
    riseIn 0.3s var(--ease) both,
    addWash 1.4s var(--ease) both;
}
.kcard.fx-added {
  animation:
    riseIn 0.3s var(--ease) both,
    addRing 1.4s var(--ease) both;
}
.subt.fx-added {
  animation: riseIn 0.28s var(--ease) both;
}
/* auth + onboarding */
.auth-card.fx-auth > * {
  animation: riseIn 0.42s var(--ease) both;
}
.auth-card.fx-auth > *:nth-child(2) {
  animation-delay: 0.04s;
}
.auth-card.fx-auth > *:nth-child(3) {
  animation-delay: 0.08s;
}
.auth-card.fx-auth > *:nth-child(n + 4) {
  animation-delay: 0.12s;
}
.onb.fx-step > *:not(.steps) {
  animation: slideInR 0.36s var(--ease) both;
}
.onb.fx-step > *:nth-child(n + 4) {
  animation-delay: 0.05s;
}
.steps i {
  transform-origin: left;
  transition: background 0.3s;
}
.onb.fx-step .steps i.cur {
  animation: growX 0.45s var(--ease) both;
}
.onb.fx-step .ready-row {
  animation: riseIn 0.4s var(--ease) both;
}
.onb.fx-step .ready-row:nth-child(2) {
  animation-delay: 0.12s;
}
.onb.fx-step .ready-row:nth-child(3) {
  animation-delay: 0.24s;
}
.onb.fx-step .ready-row .ok {
  animation: popCheck 0.42s var(--spring) both;
}
.onb.fx-step .ready-row:nth-child(1) .ok {
  animation-delay: 0.18s;
}
.onb.fx-step .ready-row:nth-child(2) .ok {
  animation-delay: 0.3s;
}
.onb.fx-step .ready-row:nth-child(3) .ok {
  animation-delay: 0.42s;
}
.onb.fx-step .ready-badge {
  animation: popCheck 0.5s 0.05s var(--spring) both;
}
/* tactile micro-feedback */
.check:active {
  transform: scale(0.88);
}
.check {
  transition:
    background var(--dur),
    border-color var(--dur),
    transform 0.12s var(--ease);
}
.toggle::after {
  transition: transform 0.28s var(--spring);
}
.pcard {
  transition:
    border-color var(--dur),
    box-shadow 0.2s var(--ease),
    transform 0.2s var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .pcard:hover {
    transform: translateY(-2px);
  }
}
.kcard {
  transition:
    box-shadow var(--dur),
    transform 0.18s var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .kcard:hover {
    transform: translateY(-1px);
  }
}
.stat .v {
  font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) {
  .fx-route > .page > *,
  .fx-route > .fullstate,
  .fx-route .grid2 > * > *,
  .fx-route .bar,
  .pbody.fx-tab > *,
  .pbody.fx-tab .kcard,
  .auth-card.fx-auth > *,
  .onb.fx-step > *,
  .drawer.enter .drawer-b > *,
  .kcard.fx-moved,
  .cev.fx-moved,
  .wcard.fx-moved,
  .fx-done .check,
  .onb.fx-step .ready-row,
  .onb.fx-step .ready-row .ok,
  .onb.fx-step .ready-badge {
    animation: fadeOnly 0.12s both !important;
  }
  .fx-route .prog > i,
  .fx-route .stackbar i,
  .onb.fx-step .steps i.cur {
    animation: none !important;
  }
  .fx-done .tt,
  .fx-done .title {
    animation: none;
    background: none;
    text-decoration: line-through !important;
  }
  .check:active {
    transform: none;
  }
  @media (hover: hover) and (pointer: fine) {
    .pcard:hover,
    .kcard:hover {
      transform: none;
    }
  }
}
:root[data-motion='reduce'] .fx-route > .page > *,
:root[data-motion='reduce'] .pbody.fx-tab > *,
:root[data-motion='reduce'] .auth-card.fx-auth > *,
:root[data-motion='reduce'] .onb.fx-step > *,
:root[data-motion='reduce'] .drawer.enter .drawer-b > *,
:root[data-motion='reduce'] .kcard.fx-moved {
  animation: fadeOnly 0.12s both !important;
}
:root[data-motion='reduce'] .fx-route .prog > i,
:root[data-motion='reduce'] .fx-route .stackbar i {
  animation: none !important;
}
@media (hover: hover) and (pointer: fine) {
  :root[data-motion='reduce'] .pcard:hover,
  :root[data-motion='reduce'] .kcard:hover {
    transform: none;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* iOS zooms into any field under 16px when it is focused, so on touch screens every field is 16px,
   whatever more specific rule (chat composer, search, inline editors) sets it smaller. */
@media (pointer: coarse) {
  input,
  select,
  textarea,
  [contenteditable],
  [contenteditable] * {
    font-size: 16px !important;
  }
  /* Controls that a mouse reveals on hover stay visible on touch, where there is no hover. */
  .cday .add,
  .bcol-h .acts,
  .crm-tbl .crm-open,
  .grp .ibtn,
  .pcard .more,
  .fcard .more,
  .sgroup-h .ibtn,
  .dsec .rte-tb,
  .subt .x,
  .attc .x {
    opacity: 1;
  }
}
/* Edge to edge under the notch and home indicator, with content padded clear of them. */
.topbar {
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}
.chat,
.drawer,
.side {
  padding-top: env(safe-area-inset-top, 0px);
}
.chat-in {
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.drawer {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
#toasts {
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 1100px) {
  .grid2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .topsearch {
    width: auto;
  }
  .topsearch .lbltxt,
  .topsearch .kbd {
    display: none;
  }
}
@media (max-width: 900px) {
  .shell,
  .shell.collapsed {
    grid-template-columns: minmax(0, 1fr);
  }
  .side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
    box-shadow: var(--shadow-pop);
  }
  .shell.mnav .side {
    transform: none;
  }
  .shell.collapsed .side .sitem {
    justify-content: flex-start;
    padding: 0 8px;
  }
  .side-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 69;
    animation: fade 0.14s both;
  }
  :root {
    --gutter: 16px;
  }
  .page {
    padding: 20px var(--gutter) 96px;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat:nth-child(3) {
    border-left: 0;
  }
  .stat:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
  .set {
    grid-template-columns: minmax(0, 1fr);
  }
  .set-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .set-nav .gh {
    display: none;
  }
  .set-nav .sitem {
    width: auto;
    flex-shrink: 0;
  }
  .set {
    grid-template-rows: auto minmax(0, 1fr);
  }
  .set-in {
    padding: 20px 16px 96px;
  }
  .tl {
    grid-template-columns: 170px minmax(0, 1fr);
  }
  .board {
    padding-bottom: 90px;
  }
  .proj-h {
    padding-top: 16px;
  }
}
@media (max-width: 640px) {
  :root {
    --topbar-h: 50px;
  }
  .bottomnav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .bottomnav button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 5px 0;
    min-height: 48px;
    font-size: 11px;
    color: var(--text-3);
    border-radius: var(--r-sm);
    position: relative;
  }
  .bottomnav button.on {
    color: var(--text);
  }
  .bottomnav .bdot {
    position: absolute;
    top: 3px;
    left: calc(50% + 6px);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
  }
  .hide-m {
    display: none !important;
  }
  .ph h1 {
    font-size: var(--fs-xl);
  }
  .ph .acts {
    margin-left: 0;
    width: 100%;
  }
  /* list & table become stacked cards */
  .list-wrap {
    padding-left: var(--gutter);
  }
  .tlist .thead {
    display: none;
  }
  .tlist .trow {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    padding: 10px 6px;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin: 6px 0;
  }
  .tlist .trow > div {
    padding: 0;
  }
  .tlist .trow .handle {
    display: none;
  }
  .tlist .trow .ttl {
    flex: 1 1 calc(100% - 30px);
    order: 1;
  }
  .tlist .trow .c-check {
    order: 0;
  }
  .tlist .trow .c-meta {
    order: 2;
  }
  .tlist .trow > div.c-lbl:empty {
    display: none;
  }
  .drawer,
  .drawer.full {
    width: 100vw;
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
    transform: none;
    border-radius: 0;
    border: 0;
  }
  .drawer-b,
  .drawer.full .drawer-b {
    padding: 16px 16px 40px;
  }
  .modal-wrap {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
  }
  .opts,
  .tmpls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .themecards {
    grid-template-columns: minmax(0, 1fr);
  }
  .fbuild {
    min-width: 0;
  }
  .frow {
    grid-template-columns: 1fr 1fr;
  }
  .frow .conj {
    display: none;
  }
  .cal-g {
    grid-auto-rows: minmax(72px, 1fr);
  }
  .cev .trunc,
  .cev .av {
    display: none;
  }
  .cev {
    height: 8px;
    padding: 0;
    border-radius: 3px;
    background: var(--c);
  }
  .week {
    grid-template-columns: minmax(0, 1fr);
    overflow-y: auto;
  }
  .wcol {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .tl-left {
    display: none;
  }
  .tl {
    grid-template-columns: minmax(0, 1fr);
  }
  #toasts {
    left: 16px;
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    align-items: stretch;
  }
  .kv {
    grid-template-columns: 96px minmax(0, 1fr);
  }
  .srow {
    grid-template-columns: minmax(0, 1fr);
  }
  .topsearch {
    border: 0;
    background: transparent;
    padding: 0;
    width: var(--h-md);
    justify-content: center;
  }
  .crumbs button:not(.cur),
  .crumbs .sep {
    display: none;
  }
  .crumbs .cur {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .crumbs .cur > span {
    display: none !important;
  }
  .panel-h {
    flex-wrap: wrap;
  }
  .panel-h h2 {
    white-space: nowrap;
  }
  .topbar .ibtn,
  .topbar .btn,
  .topsearch {
    min-width: 40px;
    min-height: 40px;
  }
  .palette {
    top: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion='full']) {
    --reduce: 1;
  }
}
:root[data-motion='reduce'] {
  --reduce: 1;
}
@keyframes fadeOnly {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .modal,
  .drawer,
  .pop,
  .toast,
  .bulkbar,
  .tab.on::after {
    animation-name: fadeOnly !important;
    animation-duration: 0.12s !important;
  }
  .btn:active:not(:disabled) {
    transform: none;
  }
  .prog > i,
  .toggle::after,
  .sitem .chev,
  .skip {
    transition: none;
  }
  .sk {
    animation: none;
    opacity: 0.85;
  }
}
:root[data-motion='reduce'] .modal,
:root[data-motion='reduce'] .drawer,
:root[data-motion='reduce'] .pop,
:root[data-motion='reduce'] .toast,
:root[data-motion='reduce'] .bulkbar,
:root[data-motion='reduce'] .tab.on::after {
  animation-name: fadeOnly !important;
  animation-duration: 0.12s !important;
}
:root[data-motion='reduce'] .btn:active:not(:disabled) {
  transform: none;
}
:root[data-motion='reduce'] .prog > i,
:root[data-motion='reduce'] .toggle::after {
  transition: none;
}
:root[data-motion='reduce'] .sk {
  animation: none;
  opacity: 0.85;
}
