/* 9AM foundation and tokens. */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --control-sm: 32px;
  --control-md: 36px;
  --control-lg: 40px;
  --touch-target: 44px;
  --icon-sm: 16px;
  --icon-md: 20px;
  --cell-fade-width: 16px;
  --radius-control: 6px;
  --radius-panel: 10px;
  --radius-dialog: 14px;
  --menu-width: 240px;
  --menu-padding: var(--space-1);
  --menu-row-h: var(--control-sm);
  --cell-row-h: 44px;
  --cell-head-h: 36px;
  --cell-pad-x: var(--space-3);
  --cell-identity-mobile: 160px;
  --cell-font: var(--text-sm);
  --page-inset: var(--space-6);
  --mask-solid: #000;
  --document-shadow: 0 12px 40px rgba(74, 74, 74, 0.18);
  --shadow-sticky: 6px 0 8px -6px rgba(0, 0, 0, 0.22);
  --document-paper: #fff;
  --document-ink: #4a4a4a;
  --document-tint: #f7f9f7;
  --document-line: #e0e0e0;
  --document-rule: #ececec;
  --document-muted: #767676;
  --shadow-pop: var(--shadow-lg);
  color-scheme: light;
  --boot-probe: ok;
  --primary: #e6b93e;
  --primary-hover: #d9aa2e;
  --primary-press: #c99a20;
  --primary-soft: #fcf4dc;
  --on-primary: #171717;
  --accent: #e6b93e;
  --accent-hover: #d9aa2e;
  --accent-press: #c99a20;
  --accent-soft: #fcf4dc;
  --accent-soft-hover: #f7ebc7;
  --accent-ink: #282114;
  --accent-ring: rgba(154, 112, 16, 0.55);
  --on-accent: #171717;
  --bg: #fdfcf8;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --surface-hover: rgba(0, 0, 0, 0.035);
  --ink: #171717;
  --ink-2: #525252;
  --muted: #626262;
  --faint: #737373;
  --line: rgba(0, 0, 0, 0.09);
  --line-strong: rgba(0, 0, 0, 0.16);
  --line-subtle: rgba(0, 0, 0, 0.055);
  --scrim: rgba(0, 0, 0, 0.32);
  --glass: var(--surface);
  --glass-2: var(--surface-2);
  --glass-border: var(--line);
  --highlight: transparent;
  --glow: transparent;
  --success: #12b76a;
  --success-soft: #daf6e6;
  --success-ink: #0c9b57;
  --warning: #ffd32c;
  --warning-soft: #fff0c0;
  --warning-ink: #9a6a00;
  --danger: #ef4452;
  --danger-soft: #fde4e7;
  --danger-ink: #d92d43;
  --info: #525252;
  --info-soft: #eeeeec;
  --info-ink: #282828;
  --neutral-soft: var(--surface-2);
  --neutral-ink: var(--ink-2);
  --st-complete-bg: #e3f3e7;
  --st-complete-bd: #b7dfc3;
  --st-complete-ink: #1b5530;
  --st-paused-bg: #fdebd6;
  --st-paused-bd: #f3cc9c;
  --st-paused-ink: #7a4210;
  --st-notstarted-bg: var(--surface-2);
  --st-notstarted-bd: var(--line);
  --st-notstarted-ink: var(--ink-2);
  --st-inprogress-bg: #e1ecfb;
  --st-inprogress-bd: #b9d1f4;
  --st-inprogress-ink: #1c4787;
  --st-billable-bg: #f8e8b5;
  --st-billable-bd: #ead79a;
  --st-billable-ink: #55400c;
  --st-billed-bg: #282828;
  --st-billed-bd: #282828;
  --st-billed-ink: #ffffff;
  --st-proposed-bg: #dff2f2;
  --st-proposed-bd: #afdcdc;
  --st-proposed-ink: #16585a;
  --st-nonbillable-bg: #e8ecf1;
  --st-nonbillable-bd: #c9d2dd;
  --st-nonbillable-ink: #39465a;
  --st-inreview-bg: #eee5fa;
  --st-inreview-bd: #d3c1f0;
  --st-inreview-ink: #57308f;
  --st-cancelled-bg: #f8e4e6;
  --st-cancelled-bd: #ecc3c8;
  --st-cancelled-ink: #8a2a36;
  --royal: #282114;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "system-ui",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: var(--font-sans);
  --font-mono: var(--font-sans);
  --radius-sm: var(--radius-control);
  --radius-md: var(--radius-panel);
  --radius-lg: var(--radius-dialog);
  --radius-xl: var(--radius-dialog);
  --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 22px rgba(0, 0, 0, 0.09);
  --shadow-lg: 0 14px 44px rgba(0, 0, 0, 0.16);
  --shadow-overlay: 0 18px 48px rgba(0, 0, 0, 0.18);
  --card-pad-x: var(--space-5);
  --tbl-font: var(--cell-font);
  --tbl-head-font: var(--text-xs);
  --tbl-row-h: var(--cell-row-h);
  --tbl-pad-x: var(--cell-pad-x);
  --tbl-line: var(--line);
  --text-h1: 26px;
  --text-h2: 20px;
  --text-h3: 16px;
  --text-h4: 14px;
  --text-h5: 12px;
  --text-p1: 16px;
  --text-p2: 15px;
  --text-p3: 13px;
  --text-body: 15px;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  --control-h: var(--control-md);
  --control-h-sm: 32px;
  --control-pad-x: 12px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 120ms;
  --t-base: 180ms;
  --table-line: var(--line);
  --table-ink: var(--ink);
  --table-muted: var(--muted);
  --field-bg: #eeeeec;
  --t-slow: 240ms;
  --doc-ink: #282828;
  --doc-surface: #f5f5f4;
  --doc-line: #e6e6e4;
  --doc-muted: #626262;
  --beautiful-field: var(--surface-2);
  --beautiful-grid: var(--line-subtle);
  --beautiful-card-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
  --beautiful-ease: cubic-bezier(.23,1,.32,1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141414;
  --surface: #1c1c1c;
  --surface-2: #252525;
  --surface-hover: rgba(255, 255, 255, 0.06);
  --ink: #fafafa;
  --ink-2: #c0c0c0;
  --muted: #aaaaaa;
  --faint: #939393;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.16);
  --line-subtle: rgba(255, 255, 255, 0.07);
  --scrim: rgba(0, 0, 0, 0.55);
  --accent-soft: #342b18;
  --accent-soft-hover: #44381d;
  --accent-ink: #f0d78f;
  --on-accent: #171717;
  --neutral-soft: var(--surface-2);
  --neutral-ink: var(--ink-2);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40), 0 1px 1px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 6px 22px rgba(0, 0, 0, 0.50);
  --shadow-lg: 0 14px 44px rgba(0, 0, 0, 0.60);
  --shadow-overlay: 0 18px 48px rgba(0, 0, 0, 0.60);
  --primary: #e6b93e;
  --primary-hover: #f0c953;
  --primary-press: #d9aa2e;
  --primary-soft: #342b18;
  --on-primary: #171717;
  --accent: #e6b93e;
  --accent-hover: #f0c953;
  --accent-press: #d9aa2e;
  --accent-ring: rgba(230, 185, 62, 0.60);
  --field-bg: #2b2b2b;
  --success: #2bd48a;
  --success-soft: #10301f;
  --success-ink: #4fd394;
  --warning: #ffd32c;
  --warning-soft: #3a2f0e;
  --warning-ink: #f5c84b;
  --danger: #ff5d6a;
  --danger-soft: #3a1f22;
  --danger-ink: #ff7884;
  --info: #c0c0c0;
  --info-soft: #2b2b2b;
  --info-ink: #eeeeee;
  --st-complete-bg: #1c3425;
  --st-complete-bd: #2c5139;
  --st-complete-ink: #a6dfb7;
  --st-inprogress-bg: #1a2b44;
  --st-inprogress-bd: #2a4468;
  --st-inprogress-ink: #a8c7f4;
  --st-notstarted-bg: var(--surface-2);
  --st-notstarted-bd: var(--line);
  --st-notstarted-ink: var(--ink-2);
  --st-paused-bg: #3a2a16;
  --st-paused-bd: #5c4122;
  --st-paused-ink: #f2c088;
  --st-billable-bg: #433819;
  --st-billable-bd: #665222;
  --st-billable-ink: #f4dda1;
  --st-billed-bg: #ddddda;
  --st-billed-bd: #ddddda;
  --st-billed-ink: #252525;
  --st-proposed-bg: #163435;
  --st-proposed-bd: #245253;
  --st-proposed-ink: #9edbdb;
  --st-nonbillable-bg: #252b33;
  --st-nonbillable-bd: #39424e;
  --st-nonbillable-ink: #b8c2ce;
  --st-inreview-bg: #2b2141;
  --st-inreview-bd: #453469;
  --st-inreview-ink: #d0bcf3;
  --st-cancelled-bg: #3a1e22;
  --st-cancelled-bd: #5c2f36;
  --st-cancelled-ink: #f0b3bb;
  --royal: #f0d78f;
}

@font-face {
font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("./vendor/fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./vendor/fonts/inter-latin-400.woff2") format("woff2");
}

@font-face {
font-family: "Inter";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("./vendor/fonts/inter-latin-400-italic.woff2") format("woff2");
}

@font-face {
font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./vendor/fonts/inter-latin-700.woff2") format("woff2");
}

@font-face {
font-family: "Inter";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("./vendor/fonts/inter-latin-700-italic.woff2") format("woff2");
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w, 216px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-3);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--bg) 100%);
  border-right: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-resizer {
  position: absolute;
  z-index: 8;
  top: 0;
  right: -5px;
  bottom: 0;
  width: 10px;
  cursor: col-resize;
  touch-action: none;
  outline: 0;
}

.sidebar-resizer::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 4px;
  bottom: 12px;
  width: 2px;
  border-radius: var(--radius-pill);
  background: transparent;
  transition: background var(--t-fast) var(--ease);
}

.sidebar-resizer:hover::after,
.sidebar-resizer:focus-visible::after,
.sidebar-resizer.is-dragging::after {
  background: var(--accent);
}

body.is-sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-2);
}

.brand-home {
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: opacity var(--t-fast) var(--ease);
}

.brand-home:hover {
  opacity: 0.7;
}

.brand-home:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.brand-icon {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  color: var(--ink);
  font-weight: 700;
  font-size: var(--text-md);
  letter-spacing: -0.01em;
}

.brand-sub {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 500;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-height: 0;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px var(--space-3);
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-md);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.nav-item:hover {
  background: var(--surface-hover);
}

.nav-item.active {
  background: var(--accent-soft);
  font-weight: 600;
}

.nav-icon {
  flex-shrink: 0;
  color: var(--muted);
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  color: var(--ink);
}

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-8);
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--bg) 28%);
  border-bottom: 0;
  position: sticky;
  top: 0;
  z-index: 5;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--ink);
}

.icon-btn:disabled {
  color: var(--faint);
  cursor: default;
}

.icon-btn.has-unread {
  position: relative;
  color: var(--ink-2);
}

.icon-btn.has-unread::after {
  content: attr(data-count);
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: var(--on-primary);
  font-size: var(--text-xs);
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: var(--on-primary);
  font-size: var(--text-xs);
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.inbox-tabs {
  display: inline-flex;
  gap: var(--space-1);
}

.inbox-tab {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--muted);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.inbox-tab.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

#inboxMarkAllBtn {
  margin-left: auto;
}

.inbox-list {
  display: flex;
  flex-direction: column;
  padding: 0 var(--card-pad-x) var(--space-4);
}

.inbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--line-subtle);
}

.inbox-row.is-unread {
  background: var(--surface-2);
}

.notif-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.notif-ic-collector {
  background: var(--st-inprogress-bg);
  color: var(--st-inprogress-ink);
}

.inbox-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  padding: 0;
}

.inbox-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--ink);
}

.inbox-row.is-unread .inbox-title::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: var(--space-2);
  border-radius: 50%;
  background: var(--danger);
  vertical-align: middle;
}

.inbox-body {
  font-size: var(--text-sm);
  color: var(--muted);
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.inbox-actions {
  display: flex;
  gap: var(--space-2);
  flex: 0 0 auto;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
}

.inbox-row:hover .inbox-actions {
  opacity: 1;
}

.inbox-act {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.inbox-act:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.workspace-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.workspace-badge img {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
}

.topbar-profile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
}

.topbar-profile {
  width: 42px;
  height: 42px;
}

.topbar-profile .avatar {
  width: 42px;
  height: 42px;
  font-size: var(--text-md);
}

.topbar-profile:hover .avatar {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.topbar-titles {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.topbar-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.topbar-eyebrow {
  font-size: var(--text-sm);
  font-weight: 600;
}

.topbar-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.board-header-settings {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-left: var(--space-4);
}

.topbar {
  padding-right: var(--space-6);
}

.topbar-profile {
  margin-left: var(--space-1);
}

.search-overlay {
  --search-width: 460px;
  position: fixed;
  inset: 0;
  z-index: 85;
  background: transparent;
  transition: background var(--t-base) var(--ease);
  pointer-events: none;
}

.search-overlay[hidden] {
  display: none;
}

.search-overlay.is-open {
  background: var(--scrim);
  pointer-events: auto;
}

.search-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100vh;
  width: var(--search-width);
  max-width: 96vw;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-overlay);
  transform: translateX(100%);
  transition: transform 0.28s var(--ease);
  pointer-events: auto;
}

.search-overlay.is-open .search-panel {
  transform: translateX(0);
}

.search-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--line-subtle);
  color: var(--muted);
}

.search-input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--text-lg);
  color: var(--ink);
  outline: none;
}

.search-results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.search-section-title {
  padding: var(--space-3) var(--space-4) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.search-empty {
  padding: var(--space-6) var(--space-4);
  color: var(--faint);
  font-size: var(--text-md);
}

.search-result {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-sm);
}

.search-result:hover {
  background: var(--surface-hover);
}

.search-result .sr-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--ink);
}

.search-result .sr-icon-board {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.search-result .sr-icon-invoice,
.search-result .sr-icon-proposal {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.search-result .sr-icon-project {
  background: var(--primary-soft);
  color: var(--on-primary);
}

.search-result .sr-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sr-name {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--ink);
}

.sr-meta {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--muted);
}

.search-result .sr-body .sr-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.search-result .sr-body .sr-meta {
  font-size: var(--text-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  display: block;
}

.sr-board {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

@media (prefers-reduced-motion: reduce) {

.search-panel,
.search-overlay {
  transition: none;
}

}

.content {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-8) 48px;
  min-width: 0;
}

.screen {
  display: none;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

.screen.active {
  display: flex;
  animation: screen-in var(--t-base) var(--ease);
}

@keyframes screen-in {
from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {

.screen.active {
  animation: none;
}

}

html {
  overscroll-behavior: none;
  scrollbar-gutter: stable;
  background: var(--bg);
}

body {
  overscroll-behavior: none;
}

.table-wrap,
.mw-table-wrap,
.mw-cal-grid,
.gantt-scroll,
#calendarView,
#ganttView {
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.table-wrap::-webkit-scrollbar,
.mw-table-wrap::-webkit-scrollbar,
.mw-cal-grid::-webkit-scrollbar,
.gantt-scroll::-webkit-scrollbar,
#calendarView::-webkit-scrollbar,
#ganttView::-webkit-scrollbar {
  display: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card + .card {
  margin-top: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-4) var(--card-pad-x) var(--space-3);
}

.card-header > div:first-child {
  min-width: 0;
}

.card-title {
  margin: 0;
  font-size: var(--text-h3);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.card-sub {
  margin: var(--space-1) 0 0;
  color: var(--muted);
  font-size: var(--text-h4);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line-subtle);
  background: var(--surface-2);
}

.invoice-action-hint {
  margin: 0;
  padding: 0 var(--space-5);
  min-height: 1.2em;
  font-size: var(--text-sm);
  color: var(--muted);
  background: var(--surface-2);
}

.invoice-action-hint:empty {
  padding: 0;
  min-height: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
}

.metric-sub {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 500;
}

.metric-accent {
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 80%);
}

.metric-accent .metric-label {
  color: var(--accent);
}

[hidden] {
  display: none !important;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.field-label {
  color: var(--muted);
  font-size: var(--text-h4);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: 9px var(--control-pad-x);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-p2);
  font-family: inherit;
  outline: 0;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--line-strong);
}

textarea.input,
.field textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.rich-input {
  min-height: calc(4 * 1.5em);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-y: auto;
  cursor: text;
}

.rich-input:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.rich-input b,
.rich-input strong {
  font-weight: 800;
}

.rich-input i,
.rich-input em {
  font-style: italic;
}

select.input,
.field select {
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: var(--space-8);
  cursor: pointer;
}

[data-theme="dark"] select.input,
[data-theme="dark"] .field select {
  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='%239aa09a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  display: inline-grid;
  place-content: center;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}

input[type="checkbox"]::before {
  content: "";
  width: 11px;
  height: 11px;
  transform: scale(0);
  transition: transform var(--t-fast) var(--ease);
  background: var(--surface);
  clip-path: polygon(13% 46%, 0 60%, 38% 100%, 100% 22%, 86% 8%, 38% 72%);
}

input[type="checkbox"]:hover:not(:checked):not(:disabled) {
  border-color: var(--accent);
}

input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

input[type="checkbox"]:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line-subtle);
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: var(--space-3);
  padding: var(--space-1) var(--card-pad-x) var(--space-3);
}

.field-wide {
  grid-column: span 2;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--line-subtle);
  background: var(--surface);
}

.status-tab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  background: var(--surface);
  border-bottom: 1px solid var(--line-subtle);
}

.status-tab-row .status-tabs {
  flex: 1 1 auto;
  border-bottom: 0;
}

.sheet-tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
  margin-right: var(--space-5);
}

.tab,
.status-check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 28px;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}

.tab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--neutral-soft);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
}

.tab:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.tab.active {
  background: var(--accent-soft);
  border-color: transparent;
}

.tab.active span {
  background: var(--accent);
  color: var(--on-accent);
}

.status-check input {
  width: 16px;
  height: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.pill.Complete {
  background: var(--st-complete-bg);
  border-color: var(--st-complete-bd);
  color: var(--st-complete-ink);
}

.pill.Paused {
  background: var(--st-paused-bg);
  border-color: var(--st-paused-bd);
  color: var(--st-paused-ink);
}

.pill.NotStarted {
  background: var(--st-notstarted-bg);
  border-color: var(--st-notstarted-bd);
  color: var(--st-notstarted-ink);
}

.pill.InProgress {
  background: var(--st-inprogress-bg);
  border-color: var(--st-inprogress-bd);
  color: var(--st-inprogress-ink);
}

.pill.Billable {
  background: var(--st-billable-bg);
  border-color: var(--st-billable-bd);
  color: var(--st-billable-ink);
}

.pill.Proposed {
  background: var(--st-proposed-bg);
  border-color: var(--st-proposed-bd);
  color: var(--st-proposed-ink);
}

.pill.Billed {
  background: var(--st-billed-bg);
  border-color: var(--st-billed-bd);
  color: var(--st-billed-ink);
}

.pill.NonBillable {
  background: var(--st-nonbillable-bg);
  border-color: var(--st-nonbillable-bd);
  color: var(--st-nonbillable-ink);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

.status-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.status-chip.subtle {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding-left: var(--space-1);
}

.status-chip.subtle::before {
  display: none;
}

.status-chip.warning {
  border-color: var(--warning-soft);
  background: var(--warning-soft);
  color: var(--warning-ink);
}

.status-chip.warning::before {
  background: var(--warning);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-bottom: var(--space-4);
}

.settings-section + .settings-section {
  border-top: 1px solid var(--line-subtle);
  padding-top: var(--space-4);
}

.settings-section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-2);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 40px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-md);
}

.settings-row-label {
  color: var(--muted);
  font-weight: 500;
}

.settings-action {
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
  font-size: var(--text-md);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.settings-action:hover {
  background: var(--surface-hover);
}

.settings-action.danger:hover {
  background: var(--danger-soft);
}

.settings-action[aria-pressed="true"] {
  background: var(--accent-soft);
}

#activityFeedList {
  display: flex;
  flex-direction: column;
  padding: 0;
}

#activityFeedList .activity-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
}

#activityFeedList .activity-row:last-child {
  border-bottom: 0;
}

#activityFeedList .activity-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
}

#activityFeedList .activity-where {
  flex: none;
}

#activityFeedList .activity-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

#activityFeedList .activity-link:hover {
  text-decoration: underline;
}

#activityFeedList .activity-title-dead {
  font-weight: 600;
  color: var(--faint);
}

#activityFeedList .activity-text {
  display: block;
  color: var(--ink);
  font-size: var(--text-sm);
}

#activityFeedList .activity-row.is-log .activity-text {
  color: var(--faint);
}

#activityFeedList .activity-when {
  flex: none;
  color: var(--faint);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.collector-cycles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: stretch;
}

.cycle-card {
  position: relative;
  min-width: 220px;
  padding: var(--space-4) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.cycle-card.is-soon {
  border-color: var(--warning);
}

.cycle-count {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}

.cycle-card.is-soon .cycle-count {
  color: var(--warning-ink);
}

.cycle-label-text {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--muted);
}

.cycle-client-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.cycle-chip {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-3);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.cycle-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.cycle-none {
  font-size: var(--text-xs);
  color: var(--faint);
}

.cycle-edit {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
}

.cycle-card.is-editing {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 280px;
}

.cycle-clients {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: 160px;
  overflow: auto;
}

.cycle-client-opt {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.cycle-actions {
  display: flex;
  gap: var(--space-2);
}

.cycle-add {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 36px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-pill);
  padding: 0 var(--space-4);
  font: inherit;
  font-size: var(--text-body);
  font-weight: 600;
  cursor: pointer;
}

.cycle-add:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.collector-selbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 var(--card-pad-x) var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  border-radius: var(--radius-md);
}

.collector-selbar .bulk-count {
  color: var(--ink);
}

.collector-selbar .btn {
  margin-left: auto;
}

.collector-log {
  margin: var(--space-3) var(--card-pad-x) var(--space-1);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line-subtle);
}

.collector-log-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.collector-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line-subtle);
  font-size: var(--text-md);
  color: var(--ink-2);
}

.collector-log-date {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--muted);
  font-size: var(--text-sm);
}

.collector-group {
  margin-bottom: var(--space-4);
}

.collector-group-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--card-pad-x) var(--space-2);
}

.collector-client {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--ink);
}

.collector-total {
  font-weight: 700;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.collector-group-head .collector-batch {
  margin-left: auto;
}

.settings-tabs {
  display: inline-flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.settings-tab {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--muted);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.settings-tab.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.settings-pane {
  padding: var(--space-1) var(--card-pad-x) var(--space-5);
  max-width: 640px;
}

.settings-pane[hidden] {
  display: none;
}

.settings-account-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) 0 var(--space-4);
}

.settings-account-meta {
  flex: 1;
  min-width: 0;
}

.settings-account-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
}

.settings-account-email {
  font-size: var(--text-sm);
  color: var(--muted);
}

.theme-options {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.theme-option {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-md);
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.theme-option:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.theme-option.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.config-group {
  padding: var(--space-1) var(--space-3) var(--space-3);
}

.config-head {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-2);
  margin: var(--space-2) 0;
}

.config-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 34px;
}

.config-tools {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.config-color {
  border: 0;
  background: transparent;
  padding: var(--space-1);
  cursor: pointer;
  border-radius: var(--radius-sm);
  line-height: 0;
  display: inline-flex;
}

.config-color:hover {
  background: var(--surface-hover);
}

.config-color:hover .config-swatch {
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.config-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line-strong);
  vertical-align: middle;
}

.config-del {
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
}

.config-del:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.config-locked,
.config-tag {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--faint);
  white-space: nowrap;
}

.config-tbl {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

.config-tbl col.cfg-name-col {
  width: auto;
}

.config-tbl col.cfg-color-col {
  width: 68px;
}

.config-tbl col.cfg-act-col {
  width: 104px;
}

.config-tbl .cfg-color-cell {
  text-align: center;
}

.config-tbl .cfg-action-cell {
  text-align: right;
  white-space: nowrap;
}

.config-name.is-locked {
  display: inline-block;
  padding: var(--space-1) var(--space-1);
  color: var(--ink);
}

.config-name[contenteditable] {
  display: inline-block;
  min-width: 60px;
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-1);
  outline: none;
  cursor: text;
}

.config-name[contenteditable]:focus {
  background: var(--surface-2);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.config-name[contenteditable]:hover:not(:focus) {
  background: var(--surface-hover);
}

.config-lock {
  font-style: normal;
  font-size: var(--text-xs);
  margin-left: var(--space-1);
  opacity: 0.5;
  vertical-align: middle;
  cursor: default;
}

.cp-pop {
  position: fixed;
  z-index: 650;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
  width: 218px;
}

.cp-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.cp-swatch {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-control);
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  display: block;
  transition: transform 0.1s;
}

.cp-swatch:hover {
  transform: scale(1.15);
  border-color: var(--line-strong);
}

.cp-swatch.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--surface);
}

.cp-hex-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.cp-hex {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.cp-hex:focus {
  border-color: var(--accent-ring);
}

.cp-hex.cp-hex-invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.cp-native {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-1);
  cursor: pointer;
  background: var(--surface);
  flex: 0 0 auto;
}

.type-chip {
  cursor: pointer;
}

.type-picker .cell-picker-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.type-check {
  position: relative;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-control);
  flex: 0 0 auto;
}

.type-option.on .type-check {
  background: var(--accent);
  border-color: var(--accent);
}

.type-option.on .type-check::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border-right: 2px solid var(--on-accent);
  border-bottom: 2px solid var(--on-accent);
  transform: rotate(40deg);
}

.type-add {
  color: var(--muted);
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
  padding: 0 var(--card-pad-x) var(--space-4);
}

.tbl {
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: var(--tbl-font);
  background: var(--surface);
  border: 1px solid var(--tbl-line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.sheet-table {
  overflow: visible;
}

.tbl th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 38px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--tbl-head-font);
  font-weight: 600;
  text-align: left;
  padding: 0 var(--tbl-pad-x);
  vertical-align: middle;
  border-bottom: 1px solid var(--tbl-line);
  border-right: 1px solid var(--line-subtle);
  white-space: nowrap;
}

.tbl td {
  height: var(--tbl-row-h);
  padding: 0 var(--tbl-pad-x);
  font-size: var(--tbl-font);
  color: var(--ink);
  border-bottom: 1px solid var(--line-subtle);
  border-right: 1px solid var(--line-subtle);
  vertical-align: middle;
  overflow: hidden;
}

.tbl th {
  overflow: hidden;
}

.cell-clip {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.cell-clip,
.item-cell .item-inner,
.due-cell .due-wrap {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.cell-clip.is-clipped,
.item-cell .item-inner.is-clipped,
.due-cell .due-wrap.is-clipped {
  -webkit-mask-image: linear-gradient(to right, var(--mask-solid) calc(100% - 16px), transparent);
  mask-image: linear-gradient(to right, var(--mask-solid) calc(100% - 16px), transparent);
}

.tbl th:last-child,
.tbl td:last-child {
  border-right: 0;
}

.tbl tbody tr {
  transition: background var(--t-fast) var(--ease);
}

.tbl tbody tr:hover {
  background: var(--surface-hover);
}

.tbl tbody tr:last-child td {
  border-bottom: 0;
}

.tbl .money {
  text-align: left;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.col-select {
  width: 40px;
}

.col-status {
  width: 118px;
}

.col-client {
  width: 116px;
}

.col-type {
  width: 150px;
}

.col-money {
  width: 96px;
}

.col-item {
  width: 188px;
}

.col-person {
  width: 72px;
}

.col-due {
  width: 138px;
}

.col-timeline {
  width: 152px;
}

#projectTable.hide-col-client .col-client {
  visibility: collapse;
}

#projectTable.hide-col-type .col-type {
  visibility: collapse;
}

#projectTable.hide-col-person .col-person {
  visibility: collapse;
}

#projectTable.hide-col-status .col-status {
  visibility: collapse;
}

#projectTable.hide-col-owed .col-money {
  visibility: collapse;
}

#projectTable.hide-col-due .col-due {
  visibility: collapse;
}

#projectTable.hide-col-timeline .col-timeline {
  visibility: collapse;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
  touch-action: none;
}

.col-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  left: 3px;
  width: 1px;
  height: 100%;
  background: transparent;
  transition: background var(--t-fast) var(--ease);
}

.col-resizer:hover::after,
.col-resizer.is-dragging::after {
  background: var(--accent);
  width: 2px;
}

body.is-col-resizing {
  cursor: col-resize;
  user-select: none;
}

.col-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.col-reset:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.col-reset:active {
  color: var(--accent-ink);
  border-color: var(--accent);
}

.sub-fill .col-reset {
  margin: 0 auto;
  display: flex;
}

.code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.description-cell {
  max-width: none;
}

.description-cell .line-subtitle {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--text-xs);
}

.select-cell {
  text-align: center;
}

.select-cell input {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.job-number-button {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease);
}

.job-number-button:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sheet-table .cell.editable {
  position: relative;
  cursor: cell;
  outline: none;
  transition: box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.sheet-table .cell.editable:hover {
  background: var(--surface-hover);
}

.sheet-table .cell.editable.is-active {
  box-shadow: inset 0 0 0 2px var(--primary);
  background: var(--primary-soft);
}

.sheet-table .cell.editable.is-editing {
  padding: 0;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.sheet-table td.cell {
  position: relative;
}

.sheet-table .subitem-table td {
  position: relative;
}

.sheet-table .sub-cell {
  cursor: cell;
  outline: none;
}

.sheet-table .sub-cell.is-active {
  box-shadow: inset 0 0 0 2px var(--primary);
  background: var(--primary-soft);
}

.sheet-table .sub-cell.is-editing {
  padding: 0;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.sheet-table .sub-cell.is-editing .cell-editor {
  min-height: 38px;
  padding: 0 var(--space-2);
}

.cell-fill-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: crosshair;
  touch-action: none;
  z-index: 4;
}

.cell-fill-handle::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 9px;
  height: 9px;
  border: 1px solid var(--surface);
  border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.sheet-table .cell.editable.is-fill-target,
.sheet-table .sub-cell.is-fill-target {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.sheet-table .cell.editable.is-fill-source,
.sheet-table .sub-cell.is-fill-source {
  box-shadow: inset 0 0 0 2px var(--primary);
}

body.is-cell-filling {
  cursor: crosshair;
  user-select: none;
}

.sub-name-text {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  vertical-align: middle;
}

.sub-empty {
  color: var(--faint);
}

.cell-editor {
  width: 100%;
  height: 100%;
  min-height: var(--tbl-row-h);
  padding: 0 var(--space-3);
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--tbl-font);
  outline: none;
}

select.cell-editor {
  cursor: pointer;
  appearance: none;
  padding-right: var(--space-6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236f685c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.cell-flag {
  display: inline-block;
  margin-left: var(--space-2);
  color: var(--warning);
  font-size: var(--text-xs);
  vertical-align: middle;
  opacity: 0.7;
  cursor: help;
}

.period-edit {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) 11px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  background: var(--glass-2);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}

.period-tone-Complete,
.period-edit.period-tone-Complete {
  color: var(--st-complete-ink);
}

.period-tone-Paused,
.period-edit.period-tone-Paused {
  color: var(--st-paused-ink);
}

.period-tone-NotStarted,
.period-edit.period-tone-NotStarted {
  color: var(--st-notstarted-ink);
}

.period-tone-InProgress,
.period-edit.period-tone-InProgress {
  color: var(--st-inprogress-ink);
}

.period-tone-Billable,
.period-edit.period-tone-Billable {
  color: var(--st-billable-ink);
}

.period-tone-Billed,
.period-edit.period-tone-Billed {
  color: var(--st-billed-ink);
}

.period-tone-NonBillable,
.period-edit.period-tone-NonBillable {
  color: var(--st-nonbillable-ink);
}

.period-edit:hover {
  background: var(--accent-soft);
}

.sheet-row {
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

.sheet-row:hover {
  background: var(--surface-hover);
}

.sheet-row.is-selected {
  background: var(--accent-soft);
}

.sheet-row.is-selected:hover {
  background: var(--accent-soft-hover);
}

.sheet-table .sheet-row {
  height: var(--tbl-row-h);
  background: var(--surface);
}

.sheet-table .sheet-row:hover {
  background: var(--surface-hover);
}

.sheet-table .sheet-row.is-selected {
  background: var(--accent-soft);
}

.sheet-table .sheet-row.is-selected:hover {
  background: var(--accent-soft-hover);
}

.group-header {
  cursor: pointer;
  user-select: none;
}

.group-header-cell {
  padding: var(--space-3) var(--space-4) 9px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line-subtle);
  border-left: 3px solid var(--line-strong);
  white-space: nowrap;
}

.group-header:hover .group-header-cell {
  background: var(--surface-hover);
}

.group-header.is-collapsed .group-header-cell {
  border-bottom-color: var(--line);
}

.group-caret {
  transition: transform var(--t-fast) var(--ease);
}

.group-count {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.group-total {
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sheet-table .group-header-cell {
  padding: 9px var(--space-2);
  background: var(--surface);
  border-left: 0;
  border-top: 1px solid var(--table-line);
  border-bottom: 1px solid var(--table-line);
  box-shadow: inset 3px 0 0 var(--group-accent, transparent);
}

.sheet-table .group-header:hover .group-header-cell {
  background: var(--surface-hover);
}

.sheet-table .group-header.is-collapsed .group-header-cell {
  border-bottom-color: var(--table-line);
}

.group-add-row td {
  padding: 0;
  border-bottom: 1px solid var(--line-subtle);
}

.group-add {
  display: inline-flex;
  align-items: center;
  width: 100%;
  height: var(--tbl-row-h);
  padding: 0 var(--tbl-pad-x) 0 23px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.group-add:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.th-ico {
  display: inline-flex;
  align-items: center;
  margin-right: var(--space-2);
  vertical-align: -0.16em;
  color: var(--faint);
}

.th-ico svg {
  width: 1em;
  height: 1em;
  display: block;
}

.th-sort:hover .th-ico {
  color: var(--muted);
}

.th-sort.sorted .th-ico {
  color: var(--accent);
}

.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.th-sort:hover {
  color: var(--ink-2);
}

.th-sort::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: var(--space-2);
  vertical-align: middle;
  opacity: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}

.th-sort.sorted {
  color: var(--accent);
}

.th-sort.sorted::after {
  opacity: 1;
}

.th-sort.sorted[data-sort-dir="asc"]::after {
  transform: rotate(180deg);
}

.bulk-bar {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 60;
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform-origin: bottom left;
  animation: bulk-in var(--t-base) var(--ease);
}

@keyframes bulk-in {
from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bulk-count {
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--ink);
}

.bulk-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}

.bulk-field {
  margin: 0;
  width: 100%;
}

.bulk-bar .bulk-field .input {
  width: 100%;
}

.bulk-bar .btn-trash {
  align-self: flex-end;
}

.add-row-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: auto;
  align-self: flex-start;
  margin: var(--space-1) var(--card-pad-x) var(--space-4);
  min-height: 36px;
  padding: 0 var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-body);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.add-row-inline:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  color: var(--ink);
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  color: var(--on-primary);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

.avatar.sm {
  width: 24px;
  height: 24px;
  font-size: var(--text-xs);
}

.auth-error {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger-ink);
  font-size: var(--text-xs);
}

.discussion {
  margin-top: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

.discussion-head {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
  margin-bottom: var(--space-3);
}

.discussion-head-sub {
  margin-top: var(--space-4);
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.comment {
  display: flex;
  gap: 9px;
}

.comment-body {
  min-width: 0;
}

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--text-xs);
}

.comment-meta strong {
  color: var(--ink);
}

.comment-meta span {
  color: var(--faint);
  font-size: var(--text-xs);
}

.comment.is-log .comment-log-text {
  color: var(--muted);
  font-style: italic;
}

.comment-text {
  font-size: var(--text-sm);
  color: var(--ink-2);
  margin-top: var(--space-1);
  word-break: break-word;
}

.comment-composer {
  display: flex;
  gap: var(--space-2);
}

.comment-composer .input {
  flex: 1;
}

.activity-feed {
  display: flex;
  flex-direction: column;
}

.activity-feed:not(.compact) {
  padding: var(--space-2) var(--space-5) var(--space-5);
}

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 0;
  border-bottom: 1px solid var(--line-subtle);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.activity-time {
  font-size: var(--text-xs);
  color: var(--faint);
}

.empty-state.small {
  padding: var(--space-3) 0;
  font-size: var(--text-xs);
  text-align: left;
}

.line-picker {
  display: block;
  max-height: 560px;
  overflow: auto;
  border-bottom: 1px solid var(--line-subtle);
}

.invoice-lines-table {
  display: grid;
  min-width: 0;
}

.invoice-line-head,
.line-item {
  display: grid;
  grid-template-columns: 94px 106px minmax(94px, 1fr) 100px 86px 44px 34px;
}

.invoice-line-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.invoice-line-head span {
  min-height: 38px;
  padding: 0 var(--space-3);
  color: var(--muted);
  font-size: var(--tbl-head-font);
  font-weight: 600;
  display: flex;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
  border-right: 1px solid var(--line-subtle);
}

.invoice-line-head span:last-child {
  border-right: 0;
}

.line-item .line-hours-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.invoice-line-head span:last-child,
.line-item > span:last-child {
  justify-content: center;
}

.line-item {
  background: var(--surface);
  border-bottom: 1px solid var(--line-subtle);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

.line-item:hover {
  background: var(--surface-2);
}

.line-item:last-child {
  border-bottom: 0;
}

.line-item > span {
  height: var(--tbl-row-h);
  padding: 0 var(--space-3);
  font-size: var(--tbl-font);
  color: var(--ink);
  display: flex;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  border-right: 1px solid var(--line-subtle);
}

.line-item > span:last-child {
  border-right: 0;
}

.line-item .money {
  justify-content: flex-end;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.line-item .pill,
.invoice-line-head + .line-item .pill {
  height: 22px;
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
}

.line-item input {
  width: 16px;
  height: 16px;
}

.invoice-client-name {
  font-weight: 600;
}

.line-subtitle {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--text-xs);
}

.invoice-selected-total {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
  color: var(--muted);
}

.invoice-selected-total strong {
  color: var(--ink);
  font-size: var(--text-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.disclose {
  border-bottom: 1px solid var(--line-subtle);
}

.disclose > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background var(--t-fast) var(--ease);
}

.disclose > summary::-webkit-details-marker {
  display: none;
}

.disclose > summary::before {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform var(--t-base) var(--ease);
  margin-right: var(--space-1);
}

.disclose[open] > summary::before {
  transform: rotate(45deg);
}

.disclose > summary:hover {
  background: var(--surface-2);
}

.disclose .field-grid {
  border-bottom: 0;
  padding-top: var(--space-1);
}

.saved-invoice-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.saved-invoice-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: background var(--t-fast) var(--ease);
}

.saved-invoice-item:hover {
  background: var(--surface-2);
}

.saved-invoice-titlerow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.saved-invoice-name {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  min-width: 0;
}

.saved-invoice-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
}

.month-bars,
.warnings {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}

.month-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 96px;
  align-items: center;
  gap: var(--space-3);
}

.month-row > :first-child {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
}

.month-row .money {
  text-align: right;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--neutral-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--t-base) var(--ease);
}

.warnings {
  border-top: 1px solid var(--line-subtle);
}

.warning-item {
  padding: var(--space-3) var(--space-3);
  background: var(--warning-soft);
  border: 1px solid var(--warning-soft);
  border-radius: var(--radius-md);
  color: var(--warning-ink);
  font-size: var(--text-xs);
}

.empty-state {
  padding: var(--space-8) var(--space-5);
  text-align: center;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

.invoice-split {
  display: grid;
  grid-template-columns: var(--invoice-split-left, 64%) 8px minmax(0, 1fr);
  gap: var(--space-2);
  align-items: start;
}

.split-handle {
  width: 8px;
  align-self: stretch;
  border-radius: var(--radius-pill);
  cursor: col-resize;
  background: transparent;
  transition: background var(--t-fast) var(--ease);
  touch-action: none;
}

.split-handle:hover,
.split-handle:active {
  background: var(--accent-soft);
}

.invoice-top-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.invoice-template-select {
  min-width: 180px;
}

.doc-color-input {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.invoice-client-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.invoice-client-row .input {
  flex: 1;
  min-width: 0;
}

.invoice-client-summary {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--muted);
}

.invoice-client-summary:empty {
  display: none;
}

.invoice-client-summary .ccard-name {
  font-weight: 600;
  color: var(--ink-2);
  display: inline;
}

.invoice-client-summary .ccard-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin-left: var(--space-3);
}

.invoice-client-summary .ccard-address {
  display: inline;
  margin-left: var(--space-3);
  white-space: normal;
}

.invoice-details-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.field-compact {
  flex: 1 1 120px;
  max-width: 170px;
}

.field-compact .field-label {
  font-size: var(--text-xs);
}

.field-compact .input {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
}

.customize-tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.customize-tab {
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.customize-tab:last-child {
  border-right: 0;
}

.customize-tab:hover:not(.active) {
  background: var(--surface-hover);
}

.customize-tab.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.customize-panels .customize-panel {
  width: 100%;
}

.customize-hint {
  margin: var(--space-2) 0 0;
  color: var(--faint);
  font-size: var(--text-xs);
}

.saved-invoice-pop {
  position: fixed;
  z-index: 40;
  width: min(420px, calc(100vw - 16px));
  max-height: 60vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
}

.saved-invoice-pop-head {
  padding: var(--space-2) var(--space-2) var(--space-2);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--muted);
}

.line-item--missing {
  cursor: default;
  background: var(--surface-2);
}

.line-item--missing:hover {
  background: var(--surface-2);
}

.line-item--missing > span {
  color: var(--muted);
}

.missing-pill {
  background: var(--danger-soft);
  color: var(--danger-ink);
  border: 1px solid var(--danger-soft);
}

.invoice-form-pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.invoice-preview-pane {
  position: sticky;
  top: 84px;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: calc(100vh - 104px);
  min-width: 0;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.preview-allsaved {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill, var(--radius-pill));
  white-space: nowrap;
}

.preview-allsaved:hover {
  background: var(--neutral-soft);
}

.preview-allsaved[disabled] {
  color: var(--muted);
  cursor: default;
  background: transparent;
}

.preview-allsaved-count {
  opacity: 0.75;
}

.preview-label {
  color: var(--ink);
  font-size: var(--text-sm);
}

.preview-hint {
  color: var(--muted);
  font-size: var(--text-sm);
}

.preview-toggle {
  display: inline-flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--neutral-soft);
  border-radius: var(--radius-pill, var(--radius-pill));
}

.preview-toggle-btn {
  border: 0;
  background: transparent;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill, var(--radius-pill));
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
}

.preview-toggle-btn.is-active {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.ref-empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--muted);
  font-size: var(--text-sm);
}

.preview-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0;
  background: var(--surface);
}

.invoice-live-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 8.5 / 11;
  height: auto;
  margin: 0;
  background: var(--document-paper);
  border: 0;
  box-shadow: none;
  overflow: hidden;
  zoom: 1;
}

.invoice-live-preview .invoice-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 816px;
  min-height: 1056px;
  box-shadow: none;
  transform: scale(calc(100cqw / 816px));
  transform-origin: top left;
}

.invoice-live-preview:empty {
  position: static;
  aspect-ratio: auto;
  width: 100%;
  min-height: 320px;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8);
  color: var(--muted);
  font-size: var(--text-md);
  background: var(--surface);
}

.invoice-live-preview:empty::before {
  content: "Pick a client and at least one line item to see the live preview.";
}

.section-block {
  padding: var(--space-4) var(--card-pad-x);
  border-bottom: 1px solid var(--line-subtle);
}

.section-block:last-of-type {
  border-bottom: 0;
}

.section-block-title {
  margin-bottom: var(--space-3);
  color: var(--ink);
  font-size: var(--text-h3);
  font-weight: 700;
}

.field-grid.two-col,
.field-grid.three-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0;
  border-bottom: 0;
  gap: var(--space-3);
}

.field-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inline-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
  height: 36px;
}

.status-tabs-tight {
  padding: 0 0 var(--space-3) 0;
  border-bottom: 0;
  background: transparent;
}

.col-business {
  width: 220px;
}

.col-contact {
  width: 180px;
}

.col-phone {
  width: 140px;
}

.col-actions {
  width: 100px;
}

.tbl th.actions {
  text-align: left;
  white-space: nowrap;
}

.tbl td.actions {
  text-align: right;
  white-space: nowrap;
}

.contact-row-actions {
  display: inline-flex;
  gap: var(--space-1);
}

.template-dialog {
  border: 0;
  background: transparent;
  padding: 0;
}

.template-dialog::backdrop {
  background: var(--scrim);
}

.template-dialog-card {
  width: min(440px, 90vw);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
}

.template-dialog-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.template-dialog-card header h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink);
}

.template-dialog-card footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.dialog-hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--scrim);
  opacity: 0;
  visibility: hidden;
  transition: opacity 260ms var(--ease), visibility 260ms var(--ease);
}

.drawer.open {
  opacity: 1;
  visibility: visible;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  transform: translateX(100%);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.drawer.open .drawer-panel {
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {

.drawer,
.drawer-panel {
  transition: none;
}

}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--line-subtle);
}

.drawer-eyebrow {
  margin: 0 0 var(--space-1);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.drawer-title {
  margin: 0;
  font-size: var(--text-h2);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.drawer-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  overflow-y: auto;
}

.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--line-subtle);
  background: var(--surface-2);
}

.drawer-footer-right {
  display: flex;
  gap: var(--space-2);
}

@media (max-width: 940px) {

.invoice-split {
  grid-template-columns: minmax(0, 1fr);
}

.split-handle {
  display: none;
}

.invoice-preview-pane {
  position: static;
  max-height: none;
  aspect-ratio: auto;
}

}

@media (max-width: 1100px) {

.metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filter-bar,
.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid.three-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

}

@media (max-width: 820px) {

.app-layout {
  grid-template-columns: 1fr;
}

.sidebar-resizer {
  display: none;
}

.sidebar {
  flex-direction: row;
  align-items: center;
  height: auto;
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  border-right: 0;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--bg) 100%);
}

.sidebar-brand {
  padding: 0;
}

.sidebar-nav {
  flex-direction: row;
  flex: 0 1 auto;
}

.topbar {
  padding: var(--space-3) var(--space-4);
}

.content {
  padding: var(--space-4) var(--space-4) var(--space-8);
}

}

@media (max-width: 580px) {

.metric-grid,
.filter-bar,
.field-grid,
.form-grid {
  grid-template-columns: 1fr;
}

.topbar {
  flex-wrap: wrap;
  gap: var(--space-3);
}

.topbar-eyebrow,
#topbarEyebrow {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  max-width: 100%;
}

.card-header {
  flex-direction: column;
  align-items: flex-start;
}

.field-wide {
  grid-column: span 1;
}

}

.invoice-print-area {
  display: none;
}

.invoice-page {
  position: relative;
  min-height: 11in;
  padding: 0.55in 0.62in 0.5in 0.88in;
  background: var(--document-paper);
  color: var(--document-ink); /* site slate */
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  box-shadow: var(--document-shadow);
}

.invoice-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0.55in;
  margin: -0.55in -0.62in 0.4in -0.88in;
  padding: 0.5in 0.62in 0.42in 0.88in;
  background: var(--document-tint);
}

.invoice-hero-info {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.55in;
  align-items: start;
}

.invoice-info-block { min-width: 0; }

.invoice-brand {
  color: var(--doc-accent, var(--royal));
  font-size: 24px;
  font-weight: 900;
}

.invoice-brand img.invoice-logo {
  display: block;
  max-height: 0.6in;
  max-width: 2.4in;
  object-fit: contain;
}

.invoice-from {
  margin-top: 0.08in;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-line;
}

.invoice-title {
  margin: 0;
  color: var(--doc-accent, var(--royal));
  font-size: 24px;
  text-align: right;
}

.invoice-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7in;
  margin-top: 0.52in;
}

.invoice-print-area .invoice-label,
.invoice-live-preview .invoice-label {
  margin: 0 0 0.08in;
  font-size: 11px;
  font-weight: 800;
  color: var(--document-ink);
  text-transform: none;
  letter-spacing: 0;
}

.invoice-print-area .invoice-value,
.invoice-live-preview .invoice-value {
  margin: 0;
  font-size: 21px;
  font-weight: 900;
  color: var(--document-ink);
}

.invoice-print-area .invoice-subvalue,
.invoice-live-preview .invoice-subvalue {
  margin: 0.13in 0 0;
  font-size: 10px;
  line-height: 1.4;
  white-space: pre-line;
  color: var(--document-ink);
}

.invoice-print-area .accent-bar,
.invoice-live-preview .accent-bar {
  width: 2px;
  height: 0.62in;
  margin: 0.24in 0;
  background: var(--doc-accent, var(--royal));
}

.print-table-wrap {
  width: auto;
  margin: 0.22in -0.62in 0 -0.88in; /* bleed to the page's left/right padding */
}

.print-row {
  display: grid;
  grid-template-columns: 1fr 0.7in 1in 1in;
  align-items: center;
  padding: 0 0.62in 0 0.88in; /* re-inset the content; the row bg/borders bleed */
  border-bottom: 1px solid var(--document-line);
  break-inside: avoid;
  page-break-inside: avoid;
}

.print-row .cell {
  padding: 10px 8px;
  font-size: 12px;
  border-right: 1px solid var(--document-rule); /* column hairlines, like the app tables */
}

.print-row .cell:first-child { padding-left: 0; }

.print-row .cell:last-child { border-right: 0; padding-right: 0; }

.print-row-head { background: var(--document-tint); }

.print-row-head .cell {
  font-size: 11px;
  font-weight: 800;
  color: var(--document-muted);
}

.print-row .center {
  text-align: center;
}

.print-hours { margin-top: 2px; font-size: 11px; color: var(--faint); }

.invoice-summary {
  display: grid;
  grid-template-columns: 1fr 2in;
  gap: 0.45in;
  margin-top: 0.22in;
  break-inside: avoid;
  page-break-inside: avoid;
}

.invoice-totals {
  display: grid;
  gap: 0.09in;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.2in;
  font-size: 12px;
  line-height: 1.4;
}

.total-row strong,
.balance-due strong {
  font-weight: 900;
}

.balance-due {
  color: var(--doc-accent, var(--royal));
  font-weight: 900;
}

.due-date-row {
  margin-top: 0;
}

.payment-block {
  display: block;
  text-align: left;
  margin-top: 0.18in;
}

.payment-block img {
  width: 1.15in;
  height: auto;
  margin-top: 0.16in;
}

.payment-copy {
  font-size: 11px;
  line-height: 1.45;
}

.invoice-message {
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-line;
  padding: 0.18in 0.22in;
  background: var(--document-tint);
  border-radius: 4px;
  color: var(--document-ink);
  break-inside: avoid;
  page-break-inside: avoid;
}

.invoice-message strong {
  display: block;
  margin-bottom: 0.08in;
}

.invoice-message br:first-of-type {
  display: none;
}

.invoice-message-hero {
  margin: -0.1in 0 0.28in;
}

.invoiced-by {
  margin-top: 0.16in;
  font-size: 12px;
  font-weight: 800;
}

@media print {

body {
    background: var(--document-paper);
  }

body > :not(.invoice-print-area) {
    display: none !important;
  }

.invoice-print-area,
.invoice-print-area.has-preview {
    display: block;
    margin: 0;
    max-width: none;
    padding: 0;
  }

@page {
    size: letter;
    margin: 0.45in 0 0.45in 0;
  }

@page :first {
    margin: 0 0 0.45in 0;
  }

.invoice-page {
    box-shadow: none;
    padding: 0 0.62in 0 0.88in;
    min-height: 0;
    break-after: auto;
  }

.invoice-page::before {
    position: fixed;
    left: 0.16in;
    top: 0.52in;
  }

.invoice-hero {
    margin: 0 -0.62in 0.4in -0.88in;
    padding: 0.55in 0.62in 0.42in 0.88in;
    break-inside: avoid;
    page-break-inside: avoid;
  }

.invoice-page > section,
.invoice-page > table,
.invoice-page > div {
    break-inside: auto;
  }

.print-table {
    border-collapse: separate;
    border-spacing: 0;
  }

.print-table thead {
    display: table-row-group;
  }

}

/* =========================================================================
   Anthropic-inspired editorial headings (phase 3 reskin)
   ========================================================================= */
.brand-name,
.card-title,
.metric-value,
.topbar-title,
.drawer-title {
  font-family: var(--font-serif);
  letter-spacing: -0.01em;
}

.card-title {
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.topbar {
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.topbar-eyebrow {
  color: var(--accent-ink);
}

.nav-item {
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-3);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-shadow: none;
}

.nav-item.active .nav-icon {
  color: var(--accent-ink);
}

.metric-grid {
  gap: var(--space-4);
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
}

.metric {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.metric:hover {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.metric-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
}

.metric-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink);
}

.metric-accent {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
}

.metric-accent:hover {
  background: var(--accent-soft-hover);
  box-shadow: var(--shadow-sm);
}

.metric-accent .metric-label,
.metric-accent .metric-sub {
  color: var(--accent-ink);
}

.card-actions,
.filter-bar,
.field-grid,
.status-tabs {
  background: var(--surface);
}

.th-sort.sorted,
.th-sort.sorted::after {
  color: var(--accent-ink);
}

.tab.active {
  color: var(--accent-ink);
}

select.input,
.field select {
  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='%23767676' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.dd-menu {
  border-color: var(--line);
}

.period-edit {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.status-chip {
  background: var(--surface);
  border-color: var(--line-strong);
}

@media (prefers-reduced-motion: reduce) {

.metric {
  transition: none;
}

}

.avatar:has(img) {
  background: transparent;
}

.template-dialog-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-overlay);
}

.template-dialog::backdrop {
  background: var(--scrim);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.drawer {
  background: var(--scrim);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.drawer-panel {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pill.Complete,
.period-edit.period-tone-Complete {
  background: var(--st-complete-bg) !important;
  color: var(--st-complete-ink) !important;
  border-color: var(--st-complete-bd) !important;
}

.pill.Paused,
.period-edit.period-tone-Paused {
  background: var(--st-paused-bg) !important;
  color: var(--st-paused-ink) !important;
  border-color: var(--st-paused-bd) !important;
}

.pill.NotStarted,
.period-edit.period-tone-NotStarted {
  background: var(--st-notstarted-bg) !important;
  color: var(--st-notstarted-ink) !important;
  border-color: var(--st-notstarted-bd) !important;
}

.pill.InProgress,
.period-edit.period-tone-InProgress {
  background: var(--st-inprogress-bg) !important;
  color: var(--st-inprogress-ink) !important;
  border-color: var(--st-inprogress-bd) !important;
}

.pill.Billable,
.period-edit.period-tone-Billable {
  background: var(--st-billable-bg) !important;
  color: var(--st-billable-ink) !important;
  border-color: var(--st-billable-bd) !important;
}

.pill.NonBillable,
.period-edit.period-tone-NonBillable {
  background: var(--st-nonbillable-bg) !important;
  color: var(--st-nonbillable-ink) !important;
  border-color: var(--st-nonbillable-bd) !important;
}

.pill.Proposed,
.period-edit.period-tone-Proposed {
  background: var(--st-proposed-bg) !important;
  color: var(--st-proposed-ink) !important;
  border-color: var(--st-proposed-bd) !important;
}

.pill.InReview {
  background: var(--st-inreview-bg) !important;
  color: var(--st-inreview-ink) !important;
  border-color: var(--st-inreview-bd) !important;
}

.pill.Cancelled {
  background: var(--st-cancelled-bg) !important;
  color: var(--st-cancelled-ink) !important;
  border-color: var(--st-cancelled-bd) !important;
}

.pill.Billed,
.period-edit.period-tone-Billed {
  background: var(--st-billed-bg) !important;
  color: var(--st-billed-ink) !important;
  border-color: var(--st-billed-bd) !important;
}

.period-edit:hover {
  background: var(--accent-soft) !important;
  color: var(--accent-ink) !important;
  border-color: var(--accent-ring) !important;
}

.app-layout a {
  color: var(--accent-ink);
}

.toast {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 1000;
  display: none;
  align-items: center;
  gap: var(--space-4);
  max-width: min(420px, calc(100vw - 32px));
  padding: var(--space-3) var(--space-4);
  background: var(--ink);
  color: var(--on-primary);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-md);
}

.toast.toast--show {
  display: inline-flex;
}

.toast-action {
  background: transparent;
  color: var(--accent);
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#trashList .table-wrap {
  padding-top: var(--space-4);
}

.trash-title {
  font-weight: 600;
}

.trash-sub {
  color: var(--muted);
}

.trash-empty {
  padding: var(--space-6) var(--card-pad-x);
  opacity: 0.6;
}

.boards-nav {
  display: flex;
  flex-direction: column;
  margin: var(--space-1) 0 var(--space-2);
}

.boards-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-2) var(--space-1);
}

.boards-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 0;
  background: transparent;
  padding: var(--space-1) var(--space-1);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.boards-toggle:hover {
  background: var(--surface-hover);
  color: var(--ink-2);
}

.boards-caret {
  flex: 0 0 auto;
  transition: transform var(--t-fast) var(--ease);
}

.boards-caret.is-collapsed {
  transform: rotate(-90deg);
}

.boards-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  width: 20px;
  height: 20px;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
}

.boards-add:hover {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--accent-ink);
}

.boards-empty {
  padding: var(--space-1) var(--space-3) var(--space-2);
  font-size: var(--text-xs);
  opacity: 0.5;
}

.board-item {
  display: flex;
  align-items: center;
}

.board-item .board-pick {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  font-size: var(--text-xs);
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.board-item.active .board-pick {
  font-weight: 700;
}

.board-item {
  border-radius: var(--radius-sm);
}

.board-item:hover {
  background: var(--surface-hover);
}

.board-emoji {
  flex: 0 0 auto;
  font-size: var(--text-sm);
  line-height: 1;
}

.board-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.task-count.board-count {
  margin-left: auto;
  flex: 0 0 auto;
}

.board-edit {
  background: transparent;
  border: 0;
  padding: var(--space-1) var(--space-3);
  cursor: pointer;
  opacity: 0;
  font-size: var(--text-xs);
}

.board-item:hover .board-edit {
  opacity: 0.6;
}

.board-edit:hover {
  opacity: 1;
}

.board-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
  padding: 0;
  max-width: 560px;
  width: calc(100vw - 32px);
  overflow: hidden;
}

.board-editor::backdrop {
  background: var(--scrim);
}

.board-editor-form {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
}

.board-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--line-subtle);
}

.board-editor-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.board-editor-subtitle {
  margin: var(--space-1) 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.35;
}

.board-editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
}

.board-editor-main,
.board-editor-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.board-color-input {
  height: 38px;
  padding: var(--space-1);
}

.board-editor-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.board-editor-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5) var(--space-4);
  border-top: 1px solid var(--line-subtle);
}

.board-editor-spacer {
  flex: 1;
}

.board-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.board-swatch {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
}

.board-swatch.selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.board-icon-input {
  width: 100%;
  flex: 0 0 auto;
  text-align: center;
  font-size: 18px;
  padding: var(--space-2) var(--space-2);
}

.board-icon-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  max-height: 246px;
  overflow-y: auto;
  overflow-x: hidden;
}

.board-icon-preset {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--text-md);
  line-height: 1;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

.board-icon-preset:hover {
  background: var(--surface-hover);
}

@media (max-width: 640px) {

.board-editor {
  max-width: none;
  width: calc(100vw - 20px);
}

.board-editor-head {
  padding: var(--space-4) var(--space-4) var(--space-3);
}

.board-editor-body {
  grid-template-columns: 1fr;
  gap: var(--space-4);
  padding: var(--space-4);
}

.board-icon-presets {
  grid-template-columns: repeat(5, 1fr);
}

.board-editor-actions {
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.board-editor-spacer {
  display: none;
}

#boardEditDelete {
  margin-right: auto;
}

}

.view-switch {
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.view-tab {
  padding: var(--space-1) var(--space-4);
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

.view-tab:last-child {
  border-right: 0;
}

.view-tab:hover:not(.active) {
  background: var(--surface-hover);
}

.view-tab.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.view-pane[hidden] {
  display: none;
}

.gantt-zoom {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--space-2);
}

#workspaceCard:not([data-view="gantt"]) .gantt-zoom {
  display: none;
}

.gz-levels {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.gz-level {
  padding: var(--space-1) var(--space-3);
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

.gz-level:last-child {
  border-right: 0;
}

.gz-level:hover:not(.active) {
  background: var(--surface-hover);
}

.gz-level.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.gz-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-md);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

.gz-step:hover:not(:disabled) {
  background: var(--surface-hover);
}

.gz-step:disabled {
  opacity: 0.35;
  cursor: default;
}

#workspaceCard[data-view="calendar"] .status-tab-row,
#workspaceCard[data-view="gantt"] .status-tab-row,
#workspaceCard[data-view="calendar"] #bulkBar,
#workspaceCard[data-view="gantt"] #bulkBar {
  display: none !important;
}

.view-stub {
  margin: var(--space-2) 0 var(--space-1);
  padding: 64px var(--space-6);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
}

.view-stub-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  color: var(--ink);
}

.view-stub-text {
  margin: 0;
  font-size: var(--text-sm);
}

#calendarView {
  --cal-lane: 20px;
  padding: var(--space-1) var(--card-pad-x) var(--space-4);
}

.cal-head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-1) var(--space-4);
}

.cal-nav {
  display: inline-flex;
  gap: var(--space-2);
  flex: 0 0 auto;
}

.cal-nav-btn,
.cal-today {
  min-height: 32px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.cal-nav-btn {
  width: 32px;
  padding: 0;
  font-size: var(--text-lg);
  line-height: 1;
}

.cal-nav-btn:hover,
.cal-today:hover {
  background: var(--surface-hover);
}

.cal-title {
  flex: 1;
  margin: 0;
  font-size: 18px;
}

.cal-legend {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--text-xs);
}

.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  background: var(--surface);
}

.cal-dow {
  background: var(--surface-2);
}

.cal-dow span {
  padding: var(--space-2) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
  border-right: 1px solid var(--line-subtle);
}

.cal-dow span:last-child {
  border-right: 0;
}

.cal-weeks {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.cal-week {
  position: relative;
  min-height: calc(28px + var(--lanes, 0) * var(--cal-lane) + 6px);
  border-bottom: 1px solid var(--line);
}

.cal-week:last-child {
  border-bottom: 0;
}

.cal-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-cell {
  border-right: 1px solid var(--line-subtle);
  padding: var(--space-1) var(--space-1);
  min-width: 0;
}

.cal-cell:last-child {
  border-right: 0;
}

.cal-cell.out {
  background: var(--neutral-soft);
}

.cal-daynum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-2);
}

.cal-cell.out .cal-daynum {
  color: var(--muted);
}

.cal-cell.today .cal-daynum {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 50%;
}

.cal-overlay {
  position: absolute;
  left: 3px;
  right: 3px;
  top: 26px;
  bottom: 2px;
  pointer-events: none;
}

.cal-bar,
.cal-task {
  position: absolute;
  height: 18px;
  padding: 0 var(--space-2);
  border: 1px solid var(--line);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  pointer-events: auto;
}

.cal-task {
  height: 16px;
  font-size: var(--text-xs);
  line-height: 14px;
  border-style: dashed;
}

.cal-bar.round-l {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.cal-bar.round-r {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.cal-bar:not(.round-l) {
  border-left-width: 0;
}

.cal-bar:not(.round-r) {
  border-right-width: 0;
}

.cal-bar.Complete,
.cal-task.Complete,
.cal-undated-chip.Complete {
  background: var(--st-complete-bg);
  border-color: var(--st-complete-bd);
  color: var(--st-complete-ink);
}

.cal-bar.Paused,
.cal-task.Paused,
.cal-undated-chip.Paused {
  background: var(--st-paused-bg);
  border-color: var(--st-paused-bd);
  color: var(--st-paused-ink);
}

.cal-bar.NotStarted,
.cal-task.NotStarted,
.cal-undated-chip.NotStarted {
  background: var(--st-notstarted-bg);
  border-color: var(--st-notstarted-bd);
  color: var(--st-notstarted-ink);
}

.cal-bar.InProgress,
.cal-task.InProgress,
.cal-undated-chip.InProgress {
  background: var(--st-inprogress-bg);
  border-color: var(--st-inprogress-bd);
  color: var(--st-inprogress-ink);
}

.cal-bar.Billable,
.cal-task.Billable,
.cal-undated-chip.Billable {
  background: var(--st-billable-bg);
  border-color: var(--st-billable-bd);
  color: var(--st-billable-ink);
}

.cal-bar.Billed,
.cal-task.Billed,
.cal-undated-chip.Billed {
  background: var(--st-billed-bg);
  border-color: var(--st-billed-bd);
  color: var(--st-billed-ink);
}

.cal-bar.NonBillable,
.cal-task.NonBillable,
.cal-undated-chip.NonBillable {
  background: var(--st-nonbillable-bg);
  border-color: var(--st-nonbillable-bd);
  color: var(--st-nonbillable-ink);
}

.cal-undated {
  margin-top: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: var(--space-3) var(--space-4);
}

.cal-undated-head {
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
}

.cal-undated-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.cal-undated-chip {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.cal-undated-chip:hover {
  filter: brightness(0.97);
}

.gantt-scroll {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin: var(--space-1) var(--card-pad-x) var(--space-4);
}

.gantt-scroll:not([data-zoom="fit"]) {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.gantt-scroll:not([data-zoom="fit"])::-webkit-scrollbar {
  display: block;
  height: 10px;
}

.gantt-scroll:not([data-zoom="fit"])::-webkit-scrollbar-track {
  background: transparent;
}

.gantt-scroll:not([data-zoom="fit"])::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--radius-pill);
}

.gantt-inner {
  position: relative;
}

.gantt-axis {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.gantt-axis-name {
  width: 240px;
  flex: 0 0 240px;
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.gantt-axis-cols {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.gantt-axis-months {
  position: relative;
  flex: 0 0 30px;
  height: 30px;
}

.gantt-month {
  position: absolute;
  top: 0;
  height: 30px;
  line-height: 30px;
  padding-left: var(--space-2);
  box-sizing: border-box;
  font-size: var(--text-xs);
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  color: var(--muted);
  border-left: 1px solid var(--line-subtle);
}

.gantt-axis-ticks {
  position: relative;
  flex: 0 0 18px;
  height: 18px;
  border-top: 1px solid var(--line-subtle);
}

.gantt-tick {
  position: absolute;
  top: 0;
  height: 18px;
  line-height: 18px;
  box-sizing: border-box;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  border-left: 1px solid var(--line-subtle);
}

.gantt-tick.is-weekend {
  background: var(--surface-2);
}

.gantt-today {
  position: absolute;
  top: 0;
  width: 2px;
  background: var(--accent);
  z-index: 0;
  pointer-events: none;
}

.gantt-rows {
  position: relative;
  z-index: 2;
}

.gantt-row {
  display: flex;
  height: 34px;
  border-bottom: 1px solid var(--line-subtle);
}

.gantt-row.is-project {
  background: var(--surface-2);
}

.gantt-name {
  width: 240px;
  flex: 0 0 240px;
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 var(--space-2);
  overflow: hidden;
}

.gantt-row.is-project .gantt-name {
  background: var(--surface-2);
}

.gantt-pname {
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.gantt-tname {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  width: 100%;
  font-size: var(--text-xs);
}

.gantt-tlabel {
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.gantt-dep-btn {
  margin-left: auto;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0.35;
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-1);
}

.gantt-row:hover .gantt-dep-btn {
  opacity: 1;
}

.gantt-track {
  position: relative;
  flex: 0 0 auto;
}

.gantt-bar {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  text-align: left;
  cursor: pointer;
  padding: 0 var(--space-2);
}

.gantt-bar-project {
  top: 4px;
  height: 21px;
  line-height: 19px;
}

.gantt-bar-task {
  top: 8px;
  height: 14px;
  line-height: 12px;
  background: var(--surface);
  border-color: var(--line-strong);
  font-weight: 500;
}

.gantt-nodate {
  line-height: 30px;
  padding-left: var(--space-2);
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--muted);
}

.gantt-bar-project.Complete {
  background: var(--st-complete-bg);
  border-color: var(--st-complete-bd);
  color: var(--st-complete-ink);
}

.gantt-bar-project.Paused {
  background: var(--st-paused-bg);
  border-color: var(--st-paused-bd);
  color: var(--st-paused-ink);
}

.gantt-bar-project.NotStarted {
  background: var(--st-notstarted-bg);
  border-color: var(--st-notstarted-bd);
  color: var(--st-notstarted-ink);
}

.gantt-bar-project.InProgress {
  background: var(--st-inprogress-bg);
  border-color: var(--st-inprogress-bd);
  color: var(--st-inprogress-ink);
}

.gantt-bar-project.Billable {
  background: var(--st-billable-bg);
  border-color: var(--st-billable-bd);
  color: var(--st-billable-ink);
}

.gantt-bar-project.Billed {
  background: var(--st-billed-bg);
  border-color: var(--st-billed-bd);
  color: var(--st-billed-ink);
}

.gantt-bar-project.NonBillable {
  background: var(--st-nonbillable-bg);
  border-color: var(--st-nonbillable-bd);
  color: var(--st-nonbillable-ink);
}

.gantt-arrows {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

.gantt-arrow {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
}

.dep-x {
  margin-left: auto;
  opacity: 0.5;
}

.dep-empty {
  padding: var(--space-2) var(--space-3);
  color: var(--muted);
  font-size: var(--text-xs);
}

.dd {
  position: relative;
  display: block;
}

.dd > select.input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0;
}

.dd-menu {
  position: fixed;
  z-index: 600;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.dd-menu[hidden] {
  display: none;
}

.cols-menu {
  min-width: 210px;
  padding: var(--space-1) 0;
}

.cols-menu-head {
  padding: 9px var(--space-3) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
}

.cols-menu-head + .cols-menu-head {
  border-top: 1px solid var(--line-subtle);
  margin-top: var(--space-1);
}

.cols-menu-sep {
  height: 1px;
  margin: var(--space-2) var(--space-2);
  background: var(--line-subtle);
}

.cols-reset {
  color: var(--accent-ink);
  font-weight: 600;
}

.cols-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: 0;
  font: inherit;
  color: var(--ink-2);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.cols-option:hover {
  background: var(--surface-hover);
}

.cols-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: var(--text-xs);
  line-height: 1;
}

.cols-option.on .cols-check {
  background: var(--accent);
  border-color: var(--accent);
}

.cols-option.on .cols-check::before {
  content: "\2713";
  color: var(--on-accent);
}

.cols-option .cols-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.cols-option.chosen {
  font-weight: 700;
}

.confirm-modal {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-overlay);
  padding: 0;
  max-width: 360px;
  width: calc(100vw - 32px);
}

.confirm-modal::backdrop {
  background: var(--scrim);
}

.confirm-modal-form {
  padding: var(--space-5);
}

.confirm-modal-message {
  margin: 0 0 var(--space-4);
  line-height: 1.5;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.dp {
  position: relative;
  display: block;
}

.dp > input[type="date"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0;
}

.dp-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.dp-toggle .dp-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.dp-toggle .dp-text.dp-empty {
  color: var(--faint);
}

.dp-toggle .dp-icon {
  flex: 0 0 auto;
  opacity: 0.55;
  font-size: var(--text-xs);
}

.dp-pop,
.dp-cal {
  position: fixed;
  z-index: 600;
  width: 244px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
}

.dp-pop[hidden] {
  display: none;
}

.dp-type {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  margin-bottom: var(--space-2);
  outline: none;
}

.dp-type:focus {
  border-color: var(--accent-ring);
}

.dp-type.dp-type-invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.dp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.dp-title {
  font-weight: 600;
  font-size: var(--text-sm);
}

.dp-nav {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  width: 26px;
  height: 26px;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.dp-nav:hover {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--accent-ink);
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-1);
}

.dp-dow {
  text-align: center;
  font-size: var(--text-xs);
  opacity: 0.5;
  padding: var(--space-1) 0;
}

.dp-cell {
  aspect-ratio: 1 / 1;
}

.dp-day {
  width: 100%;
  height: 100%;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font: inherit;
  font-size: var(--text-xs);
  padding: 0;
}

.dp-day:hover {
  background: var(--surface-hover);
}

.dp-day.selected {
  background: var(--accent);
  color: var(--on-accent);
}

.dp-foot {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
}

.dp-foot button {
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: var(--text-xs);
  opacity: 0.7;
  padding: var(--space-1) var(--space-1);
}

.dp-foot button:hover {
  opacity: 1;
  text-decoration: underline;
}

.task-expand {
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  width: 16px;
  padding: 0;
  margin-right: var(--space-1);
  opacity: 0.55;
  line-height: 1;
}

.task-expand:hover {
  opacity: 1;
}

.task-progress {
  display: inline-block;
  margin-left: var(--space-2);
  font-size: var(--text-xs);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0 var(--space-2);
  opacity: 0.75;
  vertical-align: middle;
}

.task-progress.done {
  background: var(--success-soft);
  border-color: var(--success-soft);
  color: var(--success-ink);
  opacity: 1;
}

.task-rows-row > .task-cell {
  padding: var(--space-2) var(--space-6) var(--space-4) 52px;
  background: var(--surface-2);
}

.task-del {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  cursor: pointer;
  opacity: 0.4;
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-2);
}

.task-del:hover {
  opacity: 1;
}

.cell-picker {
  position: fixed;
  z-index: 600;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.status-picker .cell-picker-option {
  padding: var(--space-1) var(--space-2);
}

.sheet-table .cell.editable.is-copied {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.avatar {
  overflow:hidden;
}

.avatar img {
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:50%;
  display:block;
}

.avatar.lg {
  width:72px;
  height:72px;
  font-size:24px;
}

#profileDrawer .profile-avatar-row {
  display:flex;
  align-items:center;
  gap:var(--space-3);
  margin-bottom:4px;
}

#profileDrawer .profile-save-row {
  display:flex;
  align-items:center;
  gap:var(--space-3);
  margin-top:4px;
}

#profileDrawer .profile-email-row {
  display:flex;
  align-items:center;
  gap:var(--space-3);
  margin-top:8px;
}

#profileDrawer .field-msg {
  font-size:var(--text-xs);
  color:var(--muted);
}

#profileDrawer hr {
  border:none;
  border-top:1px solid var(--line-subtle);
  margin:4px 0;
}

#profileDrawer .profile-fields {
  display:flex;
  flex-direction:column;
  gap:10px;
}

.hovercard {
  position:fixed;
  z-index:10000;
  display:none;
  min-width:200px;
  max-width:280px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-lg);
  padding:12px;
}

.hovercard.show {
  display:block;
}

.hovercard .hc-head {
  display:flex;
  align-items:center;
  gap:var(--space-2);
  margin-bottom:6px;
}

.hovercard .hc-line {
  font-size:var(--text-xs);
  color:var(--muted);
  margin-top:2px;
}

.comment-actions {
  display:flex;
  gap:var(--space-3);
  margin-top:4px;
}

.comment-actions button {
  background:none;
  border:none;
  color:var(--muted);
  font-size:var(--text-xs);
  cursor:pointer;
  padding:0;
  text-decoration:underline;
}

.comment-actions button:hover {
  color:var(--ink);
}

.comment-edit-input {
  width:100%;
  box-sizing:border-box;
  min-height:54px;
  padding:var(--space-2) var(--space-2);
  border:1px solid var(--line-strong);
  border-radius:var(--radius-sm);
  font:inherit;
  font-size:var(--text-sm);
  resize:vertical;
}

.subitem-row.is-done .sub-name-input {
  color: var(--ink);
}

.task-status-pill {
  border: 1px solid var(--st-notstarted-bd);
  cursor: pointer;
  background: var(--st-notstarted-bg);
  color: var(--st-notstarted-ink);
}

.task-status-pill.InProgress {
  background: var(--st-inprogress-bg);
  color: var(--st-inprogress-ink);
  border-color: var(--st-inprogress-bd);
}

.task-status-pill.Paused {
  background: var(--st-paused-bg);
  color: var(--st-paused-ink);
  border-color: var(--st-paused-bd);
}

.task-status-pill.Complete {
  background: var(--st-complete-bg);
  color: var(--st-complete-ink);
  border-color: var(--st-complete-bd);
}

.task-status-pill.InReview {
  background: var(--st-inreview-bg);
  color: var(--st-inreview-ink);
  border-color: var(--st-inreview-bd);
}

.task-status-pill.Cancelled {
  background: var(--st-cancelled-bg);
  color: var(--st-cancelled-ink);
  border-color: var(--st-cancelled-bd);
}

.range-pop {
  width: 560px;
  padding: var(--space-3);
  position: fixed;
  z-index: 600;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: none;
  overflow: visible;
}

.rp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.rp-hint {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-2);
  flex: 1;
  text-align: center;
}

.rp-months {
  display: flex;
  gap: var(--space-4);
}

.rp-month {
  flex: 1;
  min-width: 0;
}

.rp-month-title {
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-2);
}

.rp-day.in-range {
  background: var(--accent-soft);
  border-radius: 0;
}

.sheet-table .cell {
  font-variant-numeric: tabular-nums;
}

.type-cell {
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  max-width: 220px;
}

.type-empty {
  color: var(--faint);
}

.th-addcol {
  text-align: left;
}

.addcol-cell {
  background: var(--surface-2);
}

.addcol-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.addcol-btn:hover,
.addcol-btn.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

tr[data-accent] > td:first-child {
  box-shadow: inset 3px 0 0 var(--group-accent, transparent);
}

.item-inner {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}

.item-open {
  overflow: hidden;
  text-overflow: clip;
}

.item-cell {
  font-weight: 600;
}

.item-open {
  background: none;
  border: 0;
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-1) var(--space-1);
  border-radius: var(--radius-control);
}

.item-open:hover {
  background: var(--accent-soft);
  text-decoration: underline;
}

.task-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-control);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
}

.task-count.done {
  background: var(--success-soft);
  color: var(--success-ink);
}

.chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: none;
  color: var(--table-muted);
  cursor: pointer;
  border-radius: var(--radius-control);
  padding: 0;
}

.chev:hover {
  background: var(--neutral-soft);
  color: var(--table-ink);
}

.chev svg {
  display: block;
}

.group-header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: var(--text-md);
}

.group-header .group-count,
.group-header .group-total {
  color: var(--table-muted);
  font-weight: 400;
  font-size: var(--text-xs);
}

.tbl td.status-cell {
  text-align: center;
}

.status-cell .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  height: 26px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.due-wrap {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  vertical-align: middle;
}

.due-text {
  font-size: var(--tbl-font);
  color: var(--ink-2);
  white-space: nowrap;
}

.due-empty {
  color: var(--faint);
}

.due-wrap.is-overdue .dp-toggle .dp-text,
.due-wrap.is-overdue .due-text,
.due-wrap.is-overdue .due-input {
  color: var(--danger);
  font-weight: 600;
}

.due-wrap .dp-toggle,
.mw-date-cell .dp-toggle,
.sub-date .dp-toggle {
  border-color: transparent;
  background: transparent;
  font-size: var(--tbl-font);
}

.due-wrap .dp-toggle:hover,
.mw-date-cell .dp-toggle:hover,
.sub-date .dp-toggle:hover {
  border-color: var(--line);
  background: var(--surface);
}

.duration-text,
.timeline-empty {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--tbl-font);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.duration-label {
  overflow: hidden;
  text-overflow: clip;
}

.timeline-empty {
  color: var(--faint);
  cursor: pointer;
  font-size: var(--tbl-font);
}

.cell-cal-icon {
  flex: 0 0 auto;
  color: var(--muted);
}

.dp-toggle .dp-warn {
  color: var(--danger);
  opacity: 1;
}

.due-warn {
  display: block;
  flex: none;
  color: var(--danger);
}

.timeline-cell {
  text-align: left;
  cursor: pointer;
}

.timeline-bar {
  display: inline-flex;
  align-items: center;
  height: 26px;
  border-radius: var(--radius-pill);
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
  line-height: 1;
  white-space: nowrap;
  background: var(--neutral-soft);
  color: var(--neutral-ink);
  border: 1px solid var(--line-strong);
}

.timeline-bar .duration-text {
  color: inherit;
}

.timeline-bar.NotStarted {
  background: var(--st-notstarted-bg);
  color: var(--st-notstarted-ink);
  border-color: var(--st-notstarted-bd);
}

.timeline-bar.InProgress {
  background: var(--st-inprogress-bg);
  color: var(--st-inprogress-ink);
  border-color: var(--st-inprogress-bd);
}

.timeline-bar.Paused {
  background: var(--st-paused-bg);
  color: var(--st-paused-ink);
  border-color: var(--st-paused-bd);
}

.timeline-bar.Billable {
  background: var(--st-billable-bg);
  color: var(--st-billable-ink);
  border-color: var(--st-billable-bd);
}

.timeline-bar.Proposed {
  background: var(--st-proposed-bg);
  color: var(--st-proposed-ink);
  border-color: var(--st-proposed-bd);
}

.timeline-bar.NonBillable {
  background: var(--st-nonbillable-bg);
  color: var(--st-nonbillable-ink);
  border-color: var(--st-nonbillable-bd);
}

.timeline-bar.Billed {
  background: var(--st-billed-bg);
  color: var(--st-billed-ink);
  border-color: var(--st-billed-bd);
}

.timeline-bar.Complete {
  background: var(--st-complete-bg);
  color: var(--st-complete-ink);
  border-color: var(--st-complete-bd);
}

.timeline-bar.InReview {
  background: var(--st-billable-bg);
  color: var(--st-billable-ink);
  border-color: var(--st-billable-bd);
}

.person-cell {
  cursor: pointer;
}

.person-cell .person-rollup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  height: 100%;
}

.avatar-empty {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px dashed var(--line-strong);
  vertical-align: middle;
}

.person-cell:hover .avatar-empty {
  border-color: var(--accent);
}

.person-rollup .is-owner {
  display: inline-flex;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--accent);
}

.avatar-more {
  font-size: var(--text-xs);
  color: var(--table-muted);
  margin-left: var(--space-1);
}

.group-header {
  --group-accent: transparent;
}

.group-header.NotStarted,
tr[data-accent="NotStarted"] {
  --group-accent: var(--st-notstarted-bd);
}

.group-header.InProgress,
tr[data-accent="InProgress"] {
  --group-accent: var(--st-inprogress-bd);
}

.group-header.Paused,
tr[data-accent="Paused"] {
  --group-accent: var(--st-paused-bd);
}

.group-header.Billable,
tr[data-accent="Billable"] {
  --group-accent: var(--st-billable-bd);
}

.group-header.Billed,
tr[data-accent="Billed"] {
  --group-accent: var(--st-billed-bd);
}

.group-header.NonBillable,
tr[data-accent="NonBillable"] {
  --group-accent: var(--st-nonbillable-bd);
}

.group-header.Complete,
tr[data-accent="Complete"] {
  --group-accent: var(--st-complete-bd);
}

.group-header.InReview,
tr[data-accent="InReview"] {
  --group-accent: var(--st-inreview-bd);
}

.group-header.Cancelled,
tr[data-accent="Cancelled"] {
  --group-accent: var(--st-cancelled-bd);
}

.group-header.Proposed,
tr[data-accent="Proposed"] {
  --group-accent: var(--st-proposed-bd);
}

@keyframes sub-in {
from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; }
}

body #authGate {
  background: var(--bg);
}

#authGate .gate-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  background: var(--surface);
  font-family: var(--font-sans);
}

#authGate .gate-logo {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-md);
}

#authGate .gate-brand h1 {
  color: var(--ink);
  font-family: var(--font-sans);
}

#authGate .gate-brand p {
  color: var(--muted);
}

#authGate #gateTitle {
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 700;
}

#authGate .gate-card label {
  color: var(--muted);
}

#authGate .gate-card input {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

#authGate .gate-card input:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#authGate #gateSubmit {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-xs);
  transition: background var(--t-fast) var(--ease);
}

#authGate #gateSubmit:hover:not(:disabled) {
  background: var(--primary-hover);
}

#authGate .gate-row button {
  color: var(--muted);
}

#authGate .gate-row button:hover {
  color: var(--accent-ink);
}

#authGate .gate-msg {
  border-radius: var(--radius-sm);
}

#authGate .gate-msg.error {
  background: var(--danger-soft);
  color: var(--danger-ink);
  border: 1px solid var(--danger-soft);
}

#authGate .gate-msg.ok {
  background: var(--success-soft);
  color: var(--success-ink);
  border: 1px solid var(--success-soft);
}

#authGate .gate-msg.info {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

html body.booting {
  background: var(--bg);
}

html body.booting::after {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
}

.brand-logo {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1;
}

.brand-logo-dot {
  color: var(--accent);
}

.board-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin: var(--space-1) 0 var(--space-4);
  padding: 0 var(--card-pad-x);
}

.board-toolbar .toolbar-search {
  width: 160px;
  flex: 0 1 160px;
}

.board-toolbar .toolbar-spacer {
  flex: 1;
}

.board-toolbar .toolbar-select,
.board-toolbar > .dd > .dd-toggle {
  max-width: 126px;
}

.group-header .group-title {
  font-size: var(--text-md);
  font-weight: 800;
}

.group-header.NotStarted .group-title {
  color: var(--st-notstarted-ink);
}

.group-header.InProgress .group-title {
  color: var(--st-inprogress-ink);
}

.group-header.Paused .group-title {
  color: var(--st-paused-ink);
}

.group-header.Billable .group-title {
  color: var(--st-billable-ink);
}

.group-header.Billed .group-title {
  color: var(--st-billed-ink);
}

.group-header.Proposed .group-title {
  color: var(--st-proposed-ink);
}

.group-header.NonBillable .group-title {
  color: var(--st-nonbillable-ink);
}

.group-header.Complete .group-title {
  color: var(--st-complete-ink);
}

.group-header-cell {
  padding: var(--space-4) var(--space-4) var(--space-2) var(--space-3);
}

.item-card-overlay {
  --ic-width: 460px;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: transparent;
  transition: background var(--t-base) var(--ease);
  pointer-events: none;
}

.item-card-overlay.is-open {
  background: var(--scrim);
  pointer-events: auto;
}

.item-card {
  position: absolute;
  top: 0;
  right: 0;
  height: 100vh;
  width: var(--ic-width);
  max-width: 96vw;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-overlay);
  transform: translateX(100%);
  transition: transform 0.28s var(--ease);
  pointer-events: auto;
}

.item-card.is-open {
  transform: translateX(0);
}

.ic-resizer {
  position: absolute;
  top: 0;
  right: var(--ic-width);
  width: 8px;
  height: 100vh;
  margin-right: -4px;
  cursor: col-resize;
  z-index: 81;
  pointer-events: auto;
}

.ic-resizer::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  width: 2px;
  height: 100%;
  background: transparent;
  transition: background var(--t-fast) var(--ease);
}

.item-card-overlay.is-open .ic-resizer:hover::after,
.ic-resizer.is-dragging::after {
  background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {

.item-card,
.item-card-overlay {
  transition: none;
}

}

.ic-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6) var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line-subtle);
}

.ic-head-main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex-wrap: wrap;
}

.ic-title-btn {
  background: none;
  border: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-h2);
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.ic-title-btn:hover {
  background: var(--accent-soft);
}

.ic-title-input {
  font-size: 18px;
  font-weight: 700;
  max-width: 320px;
}

.ic-status-pill {
  cursor: pointer;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
}

.ic-client-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink-2);
  cursor: pointer;
}

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

.ic-head-tools {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 0 0 auto;
}

.ic-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: none;
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.ic-nav:hover {
  background: var(--neutral-soft);
  color: var(--ink);
}

.ic-nav:disabled {
  opacity: 0.35;
  cursor: default;
  background: none;
}

.ic-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.ic-section {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line-subtle);
}

.ic-section:last-child {
  border-bottom: 0;
}

.ic-money-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.ic-money-field,
.ic-notes-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.ic-money-field .ic-field-label,
.ic-notes-field .ic-field-label {
  padding-top: 0;
}

.ic-notes-field {
  margin-top: var(--space-4);
}

.ic-notes {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  font-size: var(--text-body);
}

.ic-composer {
  flex: 0 0 auto;
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.ic-composer .input {
  flex: 1;
}

.ic-field {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-1) 0;
}

.ic-field-label {
  color: var(--muted);
  font-size: var(--text-h4);
  font-weight: 600;
  padding-top: var(--space-2);
}

.ic-field-control {
  min-width: 0;
}

.ic-field-value {
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-body);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.ic-field-value:hover {
  background: var(--surface-hover);
  border-color: var(--line);
}

.ic-field-value:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ic-field-value.is-editing {
  padding: 0;
  cursor: default;
  border-color: transparent;
  background: none;
}

.ic-empty {
  color: var(--faint);
}

.ic-readonly {
  display: inline-block;
  padding: var(--space-2) var(--space-2);
  font-size: var(--text-body);
  color: var(--ink-2);
}

.ic-dates {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ic-dates-sep {
  color: var(--faint);
}

.ic-section-title {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-h3);
  font-weight: 700;
  color: var(--ink);
}

.ic-subitems-body .subitem-wrap {
  margin: 0;
}

.ic-tabs {
  display: flex;
  gap: var(--space-2);
}

.ic-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 28px;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}

.ic-tab:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.ic-tab.active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-ink);
}

.ic-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--neutral-soft);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
}

.ic-tab.active .ic-tab-count {
  background: var(--accent);
  color: var(--on-accent);
}

.ic-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.ic-panel .ic-field {
  grid-template-columns: 64px 1fr;
}

.ic-panel .ic-section-title {
  margin-top: var(--space-3);
}

.ic-invoice-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ic-invoice-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3);
  font-size: var(--text-body);
}

.ic-invoice-row + .ic-invoice-row {
  border-top: 1px solid var(--line-subtle);
}

.ic-invoice-row span {
  color: var(--muted);
  font-size: var(--text-h4);
  white-space: nowrap;
}

.ic-comment-list {
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
}

.ic-header-task .ic-task-owner {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
}

.ic-effort {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ic-task-effort {
  width: 64px;
  text-align: right;
}

.ic-effort-label {
  font-size: var(--text-xs);
  color: var(--faint);
}

.ic-subs-total {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--faint);
  margin-left: var(--space-2);
}

.ic-deps .ic-field {
  align-items: flex-start;
}

.ic-dep-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.ic-dep-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-3);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
  color: var(--ink);
}

.ic-dep-chip:hover {
  border-color: var(--accent);
}

.ic-dep-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.task-open {
  opacity: 0;
  border: 0;
  background: none;
  color: var(--faint);
  cursor: pointer;
  padding: 0 var(--space-2) 0 0;
  font-size: var(--text-sm);
}

.subitem-row:hover .task-open {
  opacity: 1;
}

.task-open:hover {
  color: var(--accent);
}

.ic-unavailable {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:var(--space-3);
  padding:48px var(--card-pad-x);
  text-align:center;
  min-height:60%;
}

.ic-unavailable-glyph {
  font-size:32px;
  opacity:.7;
}

.ic-unavailable-title {
  margin:0;
  font-size:1.1rem;
}

.ic-unavailable-msg {
  margin:0;
  color:var(--ink-2);
  max-width:36ch;
}

.route-unavailable {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:var(--space-3);
  padding:64px var(--card-pad-x);
  text-align:center;
}

.route-unavailable-glyph {
  font-size:32px;
  opacity:.7;
}

.route-unavailable-title {
  margin:0;
  font-size:1.1rem;
}

.route-unavailable-msg {
  margin:0;
  color:var(--ink-2);
  max-width:36ch;
}

.mywork-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-1) var(--card-pad-x) var(--space-4);
}

.mywork-body .mw-table-wrap {
  padding: 0;
}

.mw-empty {
  padding: var(--space-8) 0;
}

.mw-buckets {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.mw-group-header.is-overdue td {
  box-shadow: inset 3px 0 0 var(--danger);
}

.mw-group-header.is-today td {
  box-shadow: inset 3px 0 0 var(--accent);
}

.mw-group-header.is-overdue .group-title {
  color: var(--danger);
}

.mw-group-header.is-today .group-title {
  color: var(--accent-ink);
}

.mw-table-wrap {
  overflow-x: auto;
}

th.mw-task-cell {
  width: 280px;
}

th.mw-board-cell {
  width: 140px;
}

th.mw-item-cell {
  width: 140px;
}

th.mw-status-cell {
  width: 124px;
}

th.mw-date-cell {
  width: 150px;
}

th.mw-delete-cell {
  width: 44px;
}

.mw-delete-cell {
  text-align: center;
}

/* Hover-reveal only where hover exists; touch layouts keep the shared
   .task-del resting opacity so the control stays discoverable. */
@media (hover: hover) {
  .mw-row .task-del {
    opacity: 0;
  }

  .mw-row:hover .task-del,
  .mw-row .task-del:focus-visible {
    opacity: 1;
  }
}

.mw-board {
  color: var(--ink-2);
  white-space: nowrap;
}

.mw-board-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.mw-board-link:hover {
  color: var(--accent-ink);
}

.sheet-row.is-overdue td:not(.status-cell):not(.timeline-cell),
.sheet-row.is-overdue .item-open,
.sheet-row.is-overdue .cell-clip,
.sheet-row.is-overdue .mw-board {
  color: var(--danger);
}

.mw-open:disabled {
  color: var(--muted);
  cursor: default;
  text-decoration: none;
  background: none;
}

.mw-cal-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.mw-cal-title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--ink);
}

.mw-cal-today-btn {
  margin-left: auto;
}

.mw-cal-empty {
  margin-bottom: var(--space-3);
}

.mw-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  background: var(--surface);
}

.mw-cal-dow {
  padding: var(--space-2) var(--space-2);
  font-size: var(--text-xs);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.mw-cal-day {
  min-height: 90px;
  padding: var(--space-2) var(--space-2);
  border-top: 1px solid var(--line-subtle);
  border-left: 1px solid var(--line-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  align-items: flex-start;
}

.mw-cal-grid > .mw-cal-day:nth-of-type(7n + 1) {
  border-left: 0;
}

.mw-cal-day.is-blank {
  background: var(--surface-2);
}

.mw-cal-day.is-today {
  background: var(--accent-soft);
}

.mw-cal-daynum {
  font-size: var(--text-xs);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.mw-cal-day.is-today .mw-cal-daynum {
  color: var(--accent-ink);
  font-weight: 600;
}

.mw-cal-day.is-overdue .mw-cal-daynum::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
}

.mw-cal-task {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.mw-cal-task:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.mw-cal-day.is-overdue .mw-cal-task {
  border-color: var(--danger);
}

.mw-cal-more {
  font-size: var(--text-xs);
  color: var(--muted);
}

@media (max-width: 700px) {

.mw-cal-grid {
  grid-template-columns: repeat(7, 90px);
}

}

.board-toolbar {
  gap: var(--space-2);
}

.board-toolbar > .btn,
.board-toolbar .toolbar-search,
.board-toolbar .toolbar-select,
.board-toolbar .dd .dd-toggle {
  box-sizing: border-box;
  height: 36px;
  padding: 0 var(--space-4);
  font-size: var(--text-body);
  line-height: normal;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.board-toolbar .toolbar-search,
.board-toolbar .toolbar-select,
.board-toolbar .dd .dd-toggle {
  border-radius: var(--radius-panel);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
}

.board-toolbar .toolbar-search {
  line-height: normal;
}

.board-toolbar .dd {
  height: 36px;
  display: inline-flex;
  align-items: center;
}

.sub-name-head {
  position: relative;
}

.sub-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
}

.sub-resizer::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  width: 1px;
  height: 100%;
  background: transparent;
  transition: background var(--t-fast) var(--ease);
}

.sub-resizer:hover::after,
.sub-resizer.is-dragging::after {
  background: var(--accent);
  width: 2px;
}

.subitem-row:hover td {
  background: var(--surface-hover);
}

.sub-name-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  padding: var(--space-2) var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink);
  overflow: hidden;
  text-overflow: clip;
}

.ic-subitems-body .sub-fill {
  display: none;
}

.ic-subitems-body .sub-resizer {
  display: none;
}

.ic-subitems-body {
  container-type: inline-size;
}

@container (max-width: 540px) {

}

.sub-name-input:hover {
  border-color: var(--line);
}

.sub-name-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.task-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 96px;
  height: 26px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.sub-date-input {
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--ink-2);
  font-family: inherit;
}

.sub-date-input:hover {
  border-color: var(--line);
}

.sub-date-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.task-owner {
  border: 0;
  background: none;
  padding: var(--space-1);
  border-radius: var(--radius-pill);
  cursor: pointer;
  line-height: 0;
}

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

.subitem-row:hover .task-del {
  opacity: 1;
}

.subitem-add-row td {
  padding: 0;
  border-left: 0 !important;
}

.subitem-add-row:hover td {
  background: var(--surface);
}

.sub-add-input {
  display: block;
  width: 100%;
  height: var(--tbl-row-h);
  border: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  padding: 0 var(--space-4);
  outline: none;
}

.sub-add-input::placeholder {
  color: var(--muted);
  font-weight: 600;
}

.sub-add-input:hover {
  background: var(--surface-hover);
}

.sub-add-input:focus {
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.filter-anchor {
  position: relative;
  display: inline-flex;
}

.filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 120;
  width: 264px;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.filter-panel[hidden] {
  display: none;
}

.fp-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--muted);
}

.fp-row > span {
  font-weight: 600;
}

.fp-row .input,
.fp-row .dd {
  width: 100%;
}

.fp-clear {
  align-self: flex-end;
  border: 0;
  background: none;
  color: var(--accent-ink);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-control);
}

.fp-clear:hover {
  background: var(--accent-soft);
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--text-xs);
  font-weight: 700;
}

.view-tab,
.settings-tab,
.customize-tab,
.inbox-tab,
.ic-nav,
.theme-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 34px;
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-body);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.view-tab:hover,
.settings-tab:hover,
.customize-tab:hover,
.inbox-tab:hover,
.ic-nav:hover,
.theme-option:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.view-tab.active,
.settings-tab.active,
.customize-tab.active,
.inbox-tab.active,
.ic-nav.active,
.theme-option.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.icon-btn,
.cal-nav-btn,
.mw-cal-nav,
.dp-nav,
.col-reset,
.sub-col-reset,
.board-edit,
.cycle-edit,
.addcol-btn,
.config-del,
.comment-del,
.task-del,
.task-owner {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.icon-btn:hover,
.cal-nav-btn:hover,
.mw-cal-nav:hover,
.dp-nav:hover,
.col-reset:hover,
.sub-col-reset:hover,
.board-edit:hover,
.cycle-edit:hover,
.addcol-btn:hover,
.task-owner:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.config-del:hover,
.comment-del:hover,
.task-del:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.settings-action {
  width: auto;
  align-self: flex-start;
  min-height: 36px;
  padding: 0 var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  justify-content: center;
  gap: var(--space-2);
}

.settings-action:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.settings-action.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line-strong));
}

.settings-action.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.settings-action[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--accent-ink);
}

.saved-invoice-toolbar {
  display:flex;
  justify-content:flex-end;
  margin-bottom:var(--space-2);
}

.saved-invoice-group-head {
  font-weight:700;
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.04em;
  opacity:.65;
  margin:var(--space-3) 0 var(--space-1);
}

.saved-invoice-main {
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:var(--space-1);
}

.saved-invoice-sub {
  color:var(--muted);
  font-size:var(--text-xs);
  line-height:1.4;
}

.saved-invoice-rename {
  background:none;
  border:none;
  cursor:pointer;
  opacity:.5;
  font-size:.85rem;
  padding:0 var(--space-1);
  flex:none;
}

.saved-invoice-rename:hover {
  opacity:1;
}

.saved-invoice-name-edit {
  font:inherit;
  padding:var(--space-1) var(--space-1);
}

.doc-unavailable {
  display:flex;
  align-items:center;
  gap:var(--space-2);
  padding:var(--space-3) var(--card-pad-x);
  color:var(--ink-2);
}

.doc-unavailable-glyph {
  opacity:.7;
}

.doc-preview-modal {
  position:fixed;
  inset:0;
  z-index:1000;
  display:flex;
  align-items:center;
  justify-content:center;
}

.doc-preview-modal[hidden] {
  display:none;
}

.doc-preview-backdrop {
  position:absolute;
  inset:0;
  background: var(--scrim);
}

.doc-preview-panel {
  position:relative;
  background:var(--surface);
  border-radius:var(--radius-panel);
  max-width:680px;
  width:92vw;
  max-height:86vh;
  overflow:auto;
  padding:var(--space-4) var(--space-5);
  box-shadow: var(--shadow-overlay);
}

.doc-preview-head {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:var(--space-3);
  margin-bottom:var(--space-3);
}

.doc-preview-head-actions {
  display:flex;
  gap:var(--space-2);
}

.doc-preview-summary {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:var(--space-2) var(--space-4);
  margin-bottom:var(--space-4);
}

.doc-preview-summary .dp-message {
  grid-column:1/-1;
  opacity:.8;
}

.dp-label {
  font-size:.7rem;
  text-transform:uppercase;
  letter-spacing:.04em;
  opacity:.6;
  margin-right:var(--space-1);
}

.doc-preview-items-head {
  font-weight:700;
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.04em;
  opacity:.65;
  margin:var(--space-2) 0 var(--space-2);
}

.doc-preview-table {
  width:100%;
  border-collapse:collapse;
  font-size:.85rem;
}

.doc-preview-table td {
  padding:var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--line);
}

.doc-preview-table .dp-amount {
  text-align:right;
  white-space:nowrap;
}

.sidebar-account {
  margin-top: auto;
  position: relative;
  padding: 0 var(--space-1);
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: var(--space-2);
  border: none;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.account-chip:hover {
  background: var(--surface-hover);
}

.account-avatar {
  flex-shrink: 0;
}

.account-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.account-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.account-email {
  font-size: var(--text-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.account-caret {
  margin-left: auto;
  color: var(--muted);
  flex-shrink: 0;
}

.account-menu {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
  padding: var(--space-2);
  z-index: 50;
}

.account-menu[hidden] {
  display: none;
}

.account-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 9px var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.account-menu-item:hover {
  background: var(--surface-hover);
}

.account-menu-item.danger {
  color: var(--danger-ink);
}

.account-menu-item .nav-icon {
  flex-shrink: 0;
}

.agent-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.5;
  vertical-align: middle;
  margin-left: var(--space-2);
}

.settings-help {
  margin: 0 var(--space-3) var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--muted);
}

.settings-help a {
  color: var(--accent-ink);
}

.agents-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.agent-row {
  flex-direction: column;
  align-items: stretch;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: var(--space-2) var(--space-3);
}

.agent-row.is-revoked {
  opacity: 0.6;
}

.agent-row.is-paused,
.agent-row.is-expired {
  border-color: var(--warning);
}

.agent-row-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.agent-row-name .status-chip {
  margin-left: var(--space-2);
  vertical-align: middle;
}

.agent-row-reason {
  font-size: var(--text-xs);
  color: var(--warning-ink);
}

.agent-row-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.agent-row-name {
  font-weight: 600;
  color: var(--ink);
}

.agent-row-meta {
  font-size: var(--text-xs);
  color: var(--faint);
}

.agent-row-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.agent-add-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-3) var(--space-3) 0;
}

.agent-add-row,
.agent-edit-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.agent-add-row > .input {
  flex: 1;
  min-width: 160px;
}

.agent-expiry-field {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--muted);
}

.agent-expiry-field .input {
  width: auto;
}

.agent-scope-picker {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3) var(--space-3);
  margin: 0;
  min-width: 0;
}

.agent-scope-picker legend {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

.agent-scope-presets {
  display: inline-flex;
  gap: var(--space-2);
}

.agent-scope-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-2) var(--space-3);
}

.agent-scope-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink-2);
  min-width: 0;
}

.agent-scope-tag {
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--warning-soft);
  color: var(--warning-ink);
  font-size: var(--text-xs);
  font-weight: 600;
}

.agent-edit-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.agent-alert {
  margin: 0 var(--space-3) var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--warning);
  background: var(--warning-soft);
  border-radius: var(--radius-sm);
  color: var(--warning-ink);
  font-size: var(--text-sm);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.agent-activity-filters {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin: 0 var(--space-3) var(--space-3);
}

.agent-activity-filters .dd,
.agent-activity-filters select {
  min-width: 180px;
}

.agent-activity-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.agent-activity-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 0 var(--space-3);
  background: var(--surface);
}

.agent-activity-list .empty-state {
  padding: var(--space-3);
}

.agent-event {
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(64px, auto) minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
}

.agent-event:first-child {
  border-top: 0;
}

.agent-event.is-problem {
  background: var(--warning-soft);
}

.agent-event-time {
  font-size: var(--text-xs);
  color: var(--faint);
  white-space: nowrap;
}

.agent-event-who {
  font-weight: 600;
  color: var(--ink);
}

.agent-event-what {
  min-width: 0;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.agent-event-target {
  color: var(--muted);
  font-size: var(--text-xs);
}

.agent-event-detail {
  display: block;
  font-size: var(--text-xs);
  color: var(--warning-ink);
}

.agent-event-outcome {
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.agent-event-outcome.tone-ok {
  color: var(--success);
}

.agent-event-outcome.tone-muted {
  color: var(--muted);
}

.agent-event-outcome.tone-warning {
  color: var(--warning-ink);
}

.agent-event-outcome.tone-danger {
  color: var(--danger-ink);
}

.agent-activity-more {
  margin: var(--space-3) var(--space-3) 0;
  align-self: flex-start;
}

@media (max-width: 640px) {
  .agent-event {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .agent-event-what {
    grid-column: 1 / -1;
  }
}

.agent-token-reveal {
  margin: 0 var(--space-3) var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--warning);
  background: var(--warning-soft);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.agent-token-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--warning-ink);
}

.agent-token-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.agent-token-value {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  user-select: all;
}

.agent-token-help {
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.agent-token-help code {
  font-size: var(--text-xs);
}
