/* Vosquil design system.
   Neutral white and grey with near-black ink (the landing page alone keeps its warm paper),
   one blue accent kept for what matters (the current page, main actions, links, key figures),
   Fraunces page titles, Inter for everything else. Light by default (html[data-theme="light"]); dark is neutral graphite. The printed quote uses print.css.

   Contents: tokens · base · app shell · sidebar · top bar · page header & tabs · buttons ·
   forms · tables · badges & status · cards & stats · chart · empty states · toasts & dialog ·
   loading · get started · settings · team · quote editor · auth · responsive */

/* ============ Tokens ============ */
:root {
  color-scheme: dark;
  --bg: #111214;
  --sidebar-bg: #0d0e10;
  --surface: #17181b;
  --surface-2: #1c1d21;
  --surface-3: #232529;
  --hover: rgba(255, 255, 255, .045);
  --border: #2a2c31;
  --border-soft: #212226;
  --border-strong: #363840;
  --text: #ededef;
  --text-2: #b8bac1;
  --muted: #9a9ca5;
  --faint: #8e919a;
  --accent: #9db0ff;
  --accent-btn: #3f61ee;  /* white button text at 5:1 */
  --accent-btn-hover: #3557e0;
  --accent-soft: rgba(120, 145, 255, .12);
  --accent-line: rgba(157, 176, 255, .35);
  --chart: #7f97ff;
  --chart-muted: #2b2e36;
  --danger: #ff7b6b;
  --danger-btn: #e5484d;
  --danger-soft: rgba(255, 107, 107, .11);
  --ok: #4cc38a;
  --ok-soft: rgba(76, 195, 138, .12);
  --warn: #f0b13d;
  --warn-soft: rgba(240, 177, 61, .12);
  --violet: #b39dff;
  --violet-soft: rgba(179, 157, 255, .12);
  --on-ok: #111214;
  --radius-lg: 10px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 8px 24px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .25);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55), 0 4px 14px rgba(0, 0, 0, .3);
  --ring: 0 0 0 3px rgba(120, 145, 255, .3);
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 56px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9ca5' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9ca5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9;
  --sidebar-bg: #fbfbfc;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f0f1f4;
  --hover: rgba(16, 24, 40, .04);
  --border: #e4e6eb;
  --border-soft: #eef0f3;
  --border-strong: #d3d6dd;
  --text: #16181d;
  --text-2: #40444d;
  --muted: #5c616b;
  --faint: #646973;
  --accent: #2f4ec4;
  --accent-btn: #2f4ec4;
  --accent-btn-hover: #2440a8;
  --accent-soft: rgba(47, 78, 196, .08);
  --accent-line: rgba(47, 78, 196, .28);
  --chart: #2f4ec4;
  --chart-muted: #e2e6f0;
  --danger: #b42318;
  --danger-btn: #c4321f;
  --danger-soft: rgba(180, 35, 24, .07);
  --ok: #15704a;
  --ok-soft: rgba(21, 112, 74, .09);
  --warn: #8a4b00;
  --warn-soft: rgba(230, 150, 20, .14);
  --violet: #5f48c2;
  --violet-soft: rgba(95, 72, 194, .08);
  --on-ok: #ffffff;
  --shadow-xs: 0 1px 1px rgba(16, 24, 40, .04);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow: 0 8px 24px rgba(16, 24, 40, .08), 0 2px 6px rgba(16, 24, 40, .05);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .14), 0 4px 14px rgba(16, 24, 40, .06);
  --ring: 0 0 0 3px rgba(47, 78, 196, .22);
  --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c616b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c616b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; } /* wide tables scroll inside their own box, never the whole page */
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 "Inter", ui-sans-serif, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { color: var(--text); line-height: 1.25; letter-spacing: -.015em; font-weight: 600; }
/* Page titles in the landing page's serif; everything you work with stays in Inter. */
h1 { font-family: "Fraunces", Georgia, serif; font-optical-sizing: auto; font-weight: 560; font-size: 1.875rem; letter-spacing: -.02em; margin: 0 0 .25rem; }
h2 { font-size: 1rem; margin: 0 0 .75rem; }
h3 { font-size: .9rem; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--text); color: var(--bg); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.center { text-align: center; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.icon { flex: none; vertical-align: middle; }
.show-sm { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
form.inline { display: inline; margin: 0; }

/* ============ App shell ============ */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .22s var(--ease); }
.sidebar-collapsed .app { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
.main-col { min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1.75rem 2.25rem 4rem; min-width: 0; flex: 1; }
main > * { animation: page-in .28s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============ Sidebar ============ */
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar-bg); border-right: 1px solid var(--border); z-index: 40; }
.sidebar-inner { height: 100%; display: flex; flex-direction: column; padding: .75rem .625rem; gap: .25rem; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; height: 40px; padding: 0 .25rem 0 .375rem; margin-bottom: .375rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 650; font-size: .975rem; color: var(--text); letter-spacing: -.02em; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent-btn); color: #fff; flex: none; }
.workspace { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; margin: 0 0 .75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-xs); min-width: 0; }
.workspace-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); font-weight: 650; font-size: .8rem; flex: none; overflow: hidden; }
.workspace-avatar img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.workspace-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.workspace-name { font-weight: 600; font-size: .85rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-role { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; margin: 0 -.25rem; padding: 0 .25rem; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.side-group-label { font-size: .6875rem; font-weight: 600; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; padding: 1rem .65rem .4rem; white-space: nowrap; overflow: hidden; }
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.side-button, .collapse-button {
  position: relative; display: flex; align-items: center; gap: .7rem; width: 100%; height: 34px; padding: 0 .65rem;
  border-radius: var(--radius-sm); border: 0; background: none; color: var(--muted); font: inherit;
  font-weight: 500; font-size: .875rem; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden;
  box-shadow: none; transition: background .15s, color .15s;
}
.side-button .icon { width: 18px; height: 18px; stroke-width: 1.75; transition: color .15s; }
.side-button:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.side-button.active { background: var(--surface-3); color: var(--text); font-weight: 550; }
:root[data-theme="light"] .side-button.active { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.side-button.active .icon { color: var(--accent); }
.side-button.active::before { content: ""; position: absolute; left: -.625rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.collapse-button { width: 28px; height: 28px; padding: 0; justify-content: center; color: var(--faint); border-radius: 6px; flex: none; }
.collapse-button:hover { background: var(--hover); color: var(--text); }
.collapse-button .icon { width: 18px; height: 18px; transition: transform .22s var(--ease); }
.sidebar-collapsed .collapse-button .icon { transform: rotate(180deg); }
.sidebar .drawer-close { display: none; }
.side-foot { border-top: 1px solid var(--border); margin: .5rem -.625rem 0; padding: .625rem .625rem 0; display: flex; flex-direction: column; gap: 2px; }

/* Collapsed (icon-only) sidebar on wide screens */
.sidebar-collapsed .side-label, .sidebar-collapsed .workspace-text, .sidebar-collapsed .user-text,
.sidebar-collapsed .user-menu > summary > .chev, .sidebar-collapsed .brand-name { display: none; }
.sidebar-collapsed .side-group-label { height: 1px; padding: 0; margin: .75rem .5rem; background: var(--border); color: transparent; }
.sidebar-collapsed .side-button { justify-content: center; padding: 0; }
.sidebar-collapsed .sidebar-head { flex-direction: column; height: auto; gap: .5rem; padding: 0; }
.sidebar-collapsed .workspace { justify-content: center; padding: .4rem; border-color: transparent; background: none; box-shadow: none; }
.sidebar-collapsed .user-menu > summary { justify-content: center; padding: .35rem 0; }

/* User menu (bottom of the sidebar) */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; display: flex; align-items: center; gap: .65rem; padding: .45rem .55rem; border-radius: var(--radius-sm); cursor: pointer; transition: background .15s; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--hover); }
.user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.user-text strong { font-weight: 550; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-text span { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu .chev { color: var(--faint); width: 16px; height: 16px; }
.menu-panel {
  position: absolute; bottom: calc(100% + 6px); left: 0; min-width: 220px; width: 100%; z-index: 60;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: .3rem; animation: pop-in .16s var(--ease) both; transform-origin: bottom left;
}
.sidebar-collapsed .menu-panel { width: 220px; }
.menu-item { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .6rem; border-radius: 6px; background: none; border: 0; box-shadow: none; color: var(--text-2); font: inherit; font-size: .85rem; font-weight: 500; text-align: left; cursor: pointer; justify-content: flex-start; }
.menu-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.menu-item .icon { width: 16px; height: 16px; color: var(--muted); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; background: var(--border); margin: .3rem -.3rem; }
.menu-label { font-size: .72rem; color: var(--faint); padding: .35rem .6rem .2rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
@keyframes pop-in { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }

.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .75rem; flex: none; box-shadow: inset 0 0 0 1px var(--accent-line); }
.scrim { display: none; }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; gap: .75rem; align-items: center;
  padding: 0 2.25rem; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border-soft);
}
.crumbs { display: flex; align-items: center; gap: .4rem; min-width: 0; font-size: .85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .sep { color: var(--faint); }
.crumbs [aria-current] { color: var(--text); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .right { margin-left: auto; display: flex; gap: .35rem; align-items: center; }
.topbar-action { display: inline-flex; align-items: center; gap: .4rem; height: 32px; background: none; border: 1px solid var(--border); color: var(--text-2); font: inherit; font-weight: 500; font-size: .8125rem; padding: 0 .7rem; border-radius: var(--radius-sm); cursor: pointer; box-shadow: none; }
.topbar-action:hover { background: var(--hover); color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.topbar-action .icon { width: 15px; height: 15px; color: var(--muted); }
.menu-button { display: none; width: 34px; height: 34px; padding: 0; background: none; border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); box-shadow: none; }
.menu-button:hover { background: var(--hover); }
.topbar .brand { display: none; }

/* ============ Page header & tabs ============ */
.page-head { position: relative; z-index: 20; display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .6rem; }
.page-head h1 .badge, h1 .badge, h1 .tag { font-family: "Inter", ui-sans-serif, system-ui, sans-serif; font-size: .75rem; letter-spacing: 0; }
.page-head .actions { margin: 0; }
.subtitle { margin: .35rem 0 0; color: var(--muted); font-size: .9rem; }
.eyebrow { color: var(--muted); margin: 0 0 .4rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.back-link { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .85rem; font-weight: 500; margin: 0 0 .75rem; }
.back-link:hover { color: var(--text); text-decoration: none; }
.back-link .icon { width: 16px; height: 16px; }

.tabs { display: flex; gap: 1.5rem; margin: -.5rem 0 1.75rem; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: flex; align-items: center; gap: .45rem; padding: .7rem 0 .8rem; color: var(--muted); font-weight: 500; font-size: .875rem; white-space: nowrap; transition: color .15s; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background .15s; }
.tab.active { color: var(--text); }
.tab.active::after { background: var(--accent); }
.soon-tag { display: inline-flex; align-items: center; font-size: .625rem; line-height: 1; height: 16px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-3); border-radius: 4px; padding: 0 .35rem; white-space: nowrap; font-weight: 600; }

/* ============ Buttons ============ */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 36px;
  font: inherit; font-weight: 550; font-size: .875rem; line-height: 1; padding: 0 .95rem; border-radius: var(--radius-sm);
  border: 1px solid var(--accent-btn); background: var(--accent-btn); color: #fff; cursor: pointer; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(0, 0, 0, .2);
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s, transform .08s, opacity .15s;
}
button:hover, .button:hover { background: var(--accent-btn-hover); border-color: var(--accent-btn-hover); text-decoration: none; }
button:active, .button:active { transform: translateY(.5px); }
button:focus-visible, .button:focus-visible { outline: none; box-shadow: var(--ring); }
button .icon, .button .icon { width: 16px; height: 16px; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.secondary, .button.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
button.secondary:hover, .button.secondary:hover { background: var(--surface-2); border-color: var(--faint); }
button.secondary .icon, .button.secondary .icon { color: var(--muted); }
button.ghost, .button.ghost { background: none; border-color: transparent; color: var(--text-2); box-shadow: none; }
button.ghost:hover, .button.ghost:hover { background: var(--hover); color: var(--text); }
button.link { background: none; border: none; box-shadow: none; color: var(--accent); padding: 0; height: auto; font-weight: 550; }
button.link:hover { background: none; text-decoration: underline; text-underline-offset: 3px; }
.danger { color: var(--danger) !important; }
button.danger:not(.link):not(.menu-item), .button.danger { background: var(--danger-btn); border-color: var(--danger-btn); color: #fff !important; }
button.danger:not(.link):not(.menu-item):hover { filter: brightness(1.08); }
button.danger-soft { color: var(--danger); }
button.danger-soft .icon { color: var(--danger) !important; }
button.danger-soft:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.icon-button { width: 32px; height: 32px; padding: 0; background: none; border: 1px solid transparent; box-shadow: none; color: var(--faint); border-radius: var(--radius-sm); }
.icon-button:hover { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.icon-button .icon { width: 16px; height: 16px; }
.small-button { height: 28px; padding: 0 .65rem; font-size: .8125rem; }
.small-button .icon { width: 14px; height: 14px; }

/* ============ Forms ============ */
.narrow { max-width: 680px; margin: 0 auto; }
.app .narrow { margin: 0; }
.narrow > h1 { margin-bottom: 1.5rem; }
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 1.5rem; }
.form-card .actions { margin: 1.5rem -1.5rem -1.5rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.stacked .field, .stacked > div:not(.actions):not(.field-row):not(.form-errors) { margin-bottom: 1.1rem; display: flex; flex-direction: column; gap: .4rem; }
.stacked .field:last-of-type { margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 0 1rem; }
.field-row .field { margin-bottom: 1.1rem !important; }
.stacked label, .field > label, .field-set legend { font-weight: 550; font-size: .8125rem; color: var(--text-2); }
.helptext { color: var(--muted); font-size: .8rem; line-height: 1.45; }
input, select, textarea { color: var(--text); font: inherit; }
.stacked input:not([type=checkbox]):not([type=radio]):not([type=file]), .stacked select, .stacked textarea,
.search, .lines input:not([type=checkbox]), .lines select, .invite-link {
  height: 38px; padding: 0 .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); width: 100%;
  background: var(--surface-2); color: var(--text); font-size: .875rem; box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
:root[data-theme="light"] .stacked input:not([type=checkbox]):not([type=radio]):not([type=file]),
:root[data-theme="light"] .stacked select, :root[data-theme="light"] .stacked textarea,
:root[data-theme="light"] .search, :root[data-theme="light"] .lines input:not([type=checkbox]),
:root[data-theme="light"] .lines select, :root[data-theme="light"] .invite-link { background-color: var(--surface); }
.stacked textarea { height: auto; min-height: 96px; padding: .6rem .75rem; resize: vertical; line-height: 1.5; }
select, .stacked select, .lines select { appearance: none; -webkit-appearance: none; background-image: var(--icon-chevron) !important; background-repeat: no-repeat !important; background-position: right .55rem center !important; background-size: 16px !important; padding-right: 2rem !important; cursor: pointer; }
.stacked input:hover, .stacked select:hover, .stacked textarea:hover, .search:hover, .lines input:hover, .lines select:hover { border-color: var(--faint); }
.stacked input:focus, .stacked select:focus, .stacked textarea:focus, .search:focus, .lines input:focus, .lines select:focus, .invite-link:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
/* Dropdown lists: solid colours in both themes. Selects with a see-through background
   (line editor, filters) otherwise open a white list with pale text. */
select option, select optgroup { background-color: var(--surface-2); color: var(--text); }
select optgroup { color: var(--muted); font-style: normal; font-weight: 600; }
:root[data-theme="light"] select option, :root[data-theme="light"] select optgroup { background-color: var(--surface); }
/* Unit picker: a dropdown, with a box to type your own unit under it after "Other…". */
.unit-picker { display: flex; flex-direction: column; gap: .35rem; }
.unit-picker .unit-custom[hidden] { display: none; }
input[type=date]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
:root:not([data-theme="light"]) input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1); }
::placeholder { color: var(--faint); opacity: 1; }
/* A hint longer than its box ends in … instead of being cut mid-word. */
input:not([type=checkbox]):not([type=radio]):not([type=file]) { text-overflow: ellipsis; }
input[type=checkbox] { accent-color: var(--accent-btn); width: 16px; height: 16px; margin: 0; cursor: pointer; }
.field-check { flex-direction: row !important; flex-wrap: wrap; }
.check-label { display: inline-flex !important; align-items: center; gap: .6rem; cursor: pointer; color: var(--text) !important; font-weight: 500 !important; font-size: .875rem !important; }
.field-check .helptext { flex-basis: 100%; margin-left: 1.6rem; }
.field-set { border: 0; padding: 0; margin: 0; }
.field-set > div { display: flex; flex-direction: column; gap: .35rem; margin-top: .4rem; }
.field-set label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; color: var(--text); }
input[type=file] { color: var(--muted); font-size: .8125rem; max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 550; font-size: .8125rem; margin-right: .75rem; height: 32px; padding: 0 .8rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; transition: background .15s; }
input[type=file]::file-selector-button:hover { background: var(--surface-3); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger) !important; }
.has-error input:focus, .has-error select:focus, .has-error textarea:focus { box-shadow: 0 0 0 3px var(--danger-soft) !important; }
.errorlist { list-style: none; color: var(--danger); margin: 0; padding: 0; font-size: .8rem; font-weight: 500; }
.form-errors { display: block; background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); border-radius: var(--radius-sm); padding: .7rem .9rem; margin-bottom: 1.25rem; }
.form-errors .errorlist { font-size: .85rem; }
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: 1.5rem; }
.actions > a:not(.button) { display: inline-flex; align-items: center; height: 36px; font-weight: 550; font-size: .875rem; color: var(--text-2); padding: 0 .85rem; border-radius: var(--radius-sm); }
.actions > a:not(.button):hover { background: var(--hover); color: var(--text); text-decoration: none; }
.actions > a.danger { margin-left: auto; }
.actions > a.danger:hover { background: var(--danger-soft); }
.search { max-width: 360px; padding-left: 2.25rem !important; background-image: var(--icon-search); background-repeat: no-repeat; background-position: .75rem 50%; background-size: 16px; }
.search::-webkit-search-cancel-button { cursor: pointer; }
.search.htmx-request { background-image: var(--icon-search), none; }

/* ============ Tables ============ */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); font-size: .875rem; }
th, td { text-align: left; padding: .75rem 1rem; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
th { background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 550; letter-spacing: .01em; padding-top: .6rem; padding-bottom: .6rem; border-bottom-color: var(--border); white-space: nowrap; }
th.num { text-align: right; }
th.center { text-align: center; }
td { color: var(--text-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--hover); }
tbody tr:has(td.empty):hover td { background: none; }
.row-link { font-weight: 550; color: var(--text); }
.row-link:hover { color: var(--accent); text-decoration: none; }
.cell-strong { color: var(--text); font-weight: 550; }
.mono { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace; font-size: .8rem; color: var(--muted); }
.row-actions { width: 1%; white-space: nowrap; text-align: right; }
.row-action { display: inline-flex; align-items: center; gap: .3rem; font-weight: 550; font-size: .8125rem; height: 28px; padding: 0 .6rem; border-radius: 6px; color: var(--text-2); }
.row-action:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.row-action .icon { width: 15px; height: 15px; }
table + p, .table-wrap + p, .table-card + p { margin-top: 1rem; }
td.empty { padding: 0; }
.table-wrap { overflow-x: auto; }
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-card table { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.table-toolbar { display: flex; align-items: center; gap: .75rem; padding: .75rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.table-toolbar .search { margin: 0; flex: 1; min-width: 200px; }
.table-toolbar .count { margin-left: auto; color: var(--muted); font-size: .8125rem; }
.person { display: inline-flex; align-items: center; gap: .65rem; font-weight: 550; color: var(--text); }
.status { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; font-size: .8125rem; color: var(--text-2); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status-on::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status-pending { color: var(--warn); }
.status-pending::before { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.status-off { color: var(--muted); }

/* ============ Badges ============ */
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 550; line-height: 1; height: 22px; padding: 0 .55rem; border-radius: 6px; vertical-align: middle; white-space: nowrap; background: var(--surface-3); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); }
.badge.draft, .badge.issued { padding-left: .5rem; }
.badge.draft::before, .badge.issued::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.draft { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 22%, transparent); }
.badge.issued { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 22%, transparent); }
.badge.soon { background: var(--surface-3); color: var(--muted); }
.badge.role-owner { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); }
.badge.role-admin { background: var(--violet-soft); color: var(--violet); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--violet) 25%, transparent); }
.badge.role-team_lead { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 22%, transparent); }
.badge.role-field_worker { background: var(--surface-3); color: var(--text-2); }

/* ============ Cards & stats ============ */
.card-section, .panel-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-sm); }
.card-section table { box-shadow: none; }
.panel { margin-bottom: 1.5rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; }
.panel-head .muted { font-size: .8125rem; }
.panel-link { display: inline-flex; align-items: center; gap: .25rem; font-weight: 550; font-size: .8125rem; color: var(--text-2); }
.panel-link:hover { color: var(--accent); text-decoration: none; }
.panel-link .icon { width: 14px; height: 14px; transition: transform .15s var(--ease); }
.panel-link:hover .icon { transform: translateX(2px); }
.section-title { font-size: .8125rem; font-weight: 600; color: var(--muted); margin: 2rem 0 .75rem; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 0 0 1.25rem; }
.stat, .tour-card, .card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem;
  display: flex; flex-direction: column; gap: .25rem; color: var(--text); box-shadow: var(--shadow-sm);
  transition: border-color .18s, transform .18s var(--ease), box-shadow .18s;
}
a.stat:hover, .tour-card:hover, a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.stat-label { color: var(--muted); font-size: .8125rem; font-weight: 500; display: flex; align-items: center; gap: .5rem; }
.stat-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); margin-left: auto; }
.stat-icon .icon { width: 15px; height: 15px; }
.stat strong { font-size: 1.625rem; font-weight: 600; letter-spacing: -.025em; font-variant-numeric: tabular-nums; margin-top: .35rem; line-height: 1.2; }
.stat-note { color: var(--muted); font-size: .8rem; }
.stat-arrow { position: absolute; right: 1rem; bottom: 1rem; color: var(--faint); opacity: 0; transform: translateX(-4px); transition: opacity .18s, transform .18s var(--ease); }
a.stat:hover .stat-arrow { opacity: 1; transform: none; }
.stat-arrow .icon { width: 16px; height: 16px; }
.stats.upcoming { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat.placeholder { background: transparent; border-style: dashed; box-shadow: none; padding: .9rem 1.1rem; }
.stat.placeholder strong { color: var(--faint); font-size: 1.15rem; margin-top: .15rem; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.dash-grid > * { margin-bottom: 0; }
.glance { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.glance li + li { border-top: 1px solid var(--border-soft); }
.glance a { display: flex; align-items: center; gap: .75rem; padding: .7rem .25rem; color: var(--text-2); border-radius: 6px; transition: background .15s; }
.glance a:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.glance .glance-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); color: var(--muted); }
.glance .glance-icon .icon { width: 15px; height: 15px; }
.glance .glance-value { margin-left: auto; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-soft); }
.quick-actions .button { width: 100%; }

.planned { max-width: 620px; margin: 1rem auto 0; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.5rem 2rem 2rem; box-shadow: var(--shadow-sm); }
.planned p:first-of-type { font-size: 1rem; color: var(--text); max-width: 46ch; margin-left: auto; margin-right: auto; }
.planned .muted { max-width: 52ch; margin-left: auto; margin-right: auto; font-size: .875rem; }
.planned .button { margin-top: .5rem; }

/* ============ Chart (dashboard, one series) ============ */
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.chart-head h2 { margin: 0 0 .15rem; }
.chart-total { text-align: right; }
.chart-total strong { display: block; font-size: 1.375rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.chart-total span { color: var(--muted); font-size: .8rem; }
.bars { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; height: 180px; align-items: end; padding-top: .5rem; border-bottom: 1px solid var(--border); }
.bars::before, .bars::after { content: ""; position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border-soft); pointer-events: none; }
.bars::before { top: 50%; }
.bars::after { top: .5rem; }
.bar { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline: none; }
.bar-fill { width: min(44px, 62%); height: var(--h); min-height: 0; background: var(--chart); border-radius: 4px 4px 0 0; opacity: .88; transform-origin: bottom; animation: bar-grow .6s var(--ease) both; transition: opacity .15s; }
.bar:nth-child(2) .bar-fill { animation-delay: .04s; } .bar:nth-child(3) .bar-fill { animation-delay: .08s; }
.bar:nth-child(4) .bar-fill { animation-delay: .12s; } .bar:nth-child(5) .bar-fill { animation-delay: .16s; }
.bar:nth-child(6) .bar-fill { animation-delay: .2s; }
.bar.zero .bar-fill { height: 2px; background: var(--border-strong); opacity: 1; }
.bar:hover .bar-fill, .bar:focus-visible .bar-fill { opacity: 1; }
.bars:hover .bar:not(:hover) .bar-fill { opacity: .45; }
.bar::before { content: ""; position: absolute; inset: 0 8%; border-radius: 6px; background: var(--hover); opacity: 0; transition: opacity .15s; }
.bar:hover::before, .bar:focus-visible::before { opacity: 1; }
.bar-tip { position: absolute; bottom: calc(var(--h) + 10px); left: 50%; transform: translate(-50%, 4px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow); padding: .45rem .65rem; font-size: .75rem; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s, transform .15s var(--ease); z-index: 2; text-align: left; }
.bar-tip strong { display: block; font-size: .85rem; color: var(--text); font-variant-numeric: tabular-nums; }
.bar-tip span { color: var(--muted); }
.bar:hover .bar-tip, .bar:focus-visible .bar-tip { opacity: 1; transform: translate(-50%, 0); }
.bar.zero .bar-tip { bottom: 14px; }
.bar-labels { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; margin-top: .5rem; }
.bar-labels span { text-align: center; font-size: .75rem; color: var(--muted); text-transform: capitalize; }
.bar-labels span.current { color: var(--text); font-weight: 550; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .85rem; text-align: center; padding: 0 1rem; }
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ============ Empty states ============ */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; padding: 3rem 1.5rem; }
.empty-state .empty-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--muted); margin-bottom: .5rem; box-shadow: inset 0 0 0 1px var(--border); }
.empty-state .empty-icon .icon { width: 20px; height: 20px; }
.empty-state strong { color: var(--text); font-weight: 600; font-size: .9375rem; }
.empty-state span { color: var(--muted); font-size: .85rem; max-width: 40ch; }
.empty-state .button { margin-top: .85rem; }

/* ============ Toasts & dialog ============ */
.toasts { list-style: none; position: fixed; top: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; margin: 0; padding: 0; width: min(380px, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: .65rem; padding: .8rem .8rem .8rem 1rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); color: var(--text); font-size: .875rem; font-weight: 500; animation: toast-in .32s var(--ease) both; }
.toast.leaving { animation: toast-out .22s ease-in both; }
.toast-icon { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; flex: none; margin-top: 1px; background: var(--ok-soft); color: var(--ok); }
.toast-icon .icon { width: 13px; height: 13px; stroke-width: 2.5; }
.toast.error .toast-icon, .toast.warning .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast.info .toast-icon { background: var(--accent-soft); color: var(--accent); }
.toast-text { flex: 1; padding-top: 1px; }
.toast-close { width: 24px; height: 24px; padding: 0; background: none; border: 0; box-shadow: none; color: var(--faint); border-radius: 5px; }
.toast-close:hover { background: var(--hover); color: var(--text); }
.toast-close .icon { width: 14px; height: 14px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

dialog.confirm { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(420px, calc(100vw - 2rem)); }
dialog.confirm[open] { animation: pop-in .18s var(--ease) both; }
dialog.confirm::backdrop { background: rgba(5, 7, 12, .55); backdrop-filter: blur(2px); animation: fade-in .18s both; }
.confirm-body { display: flex; gap: .9rem; padding: 1.4rem 1.4rem 1.2rem; }
.confirm-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
.confirm-icon .icon { width: 18px; height: 18px; }
dialog.is-danger .confirm-icon { background: var(--danger-soft); color: var(--danger); }
.confirm-body h2 { margin: .1rem 0 .35rem; font-size: 1rem; }
.confirm-body p { margin: 0; color: var(--text-2); font-size: .875rem; }
.confirm-actions { display: flex; justify-content: flex-end; gap: .5rem; padding: .85rem 1.4rem; background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@keyframes fade-in { from { opacity: 0; } }

/* ============ Loading ============ */
.loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 200; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity .2s; }
.loading-bar::before { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: loading-slide 1s ease-in-out infinite; }
.is-loading .loading-bar { opacity: 1; transition-delay: .15s; }
@keyframes loading-slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
button.htmx-request, .htmx-request > button { position: relative; color: transparent !important; pointer-events: none; }
button.htmx-request::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-color: #fff #fff transparent transparent; animation: spin .7s linear infinite; }
button.secondary.htmx-request::after, button.icon-button.htmx-request::after, button.link.htmx-request::after { border-color: var(--muted) var(--muted) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
tr.htmx-swapping td { opacity: 0; transition: opacity .25s; }
tr.htmx-added td { animation: row-in .35s var(--ease) both; }
@keyframes row-in { from { opacity: 0; background: var(--accent-soft); } }
.saved-flash { animation: saved .9s var(--ease); }
@keyframes saved { 0% { color: var(--accent); } 100% { color: inherit; } }

/* ============ Get started ============ */
.setup { margin: 0 0 2rem; }
.setup > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .9rem; padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); transition: border-color .15s; }
.setup > summary:hover { border-color: var(--border-strong); }
.setup > summary::-webkit-details-marker { display: none; }
.setup[open] > summary { margin-bottom: .75rem; }
.setup-progress { display: flex; flex-direction: column; gap: .5rem; width: 100%; font-size: .85rem; }
.all-set { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ok); color: var(--on-ok); flex: none; }
.all-set .icon { width: 16px; height: 16px; stroke-width: 2.5; }
.progress { width: 100%; height: 6px; border: none; border-radius: 999px; overflow: hidden; background: var(--surface-3); appearance: none; -webkit-appearance: none; }
.progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 999px; }
.progress::-webkit-progress-value { background: var(--accent-btn); border-radius: 999px; transition: width .4s var(--ease); }
.progress::-moz-progress-bar { background: var(--accent-btn); border-radius: 999px; }
.checklist { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.checklist li { display: flex; gap: .9rem; align-items: flex-start; padding: 1rem 1.25rem; transition: background .15s; }
.checklist li + li { border-top: 1px solid var(--border-soft); }
.checklist li:not(.done):hover { background: var(--hover); }
.checklist li > div { display: flex; flex-direction: column; gap: .15rem; font-size: .875rem; }
.checklist strong { font-weight: 550; }
.checklist strong a { color: var(--text); }
.checklist strong a:hover { color: var(--accent); text-decoration: none; }
.checklist .check { flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 1.5px dashed var(--border-strong); display: grid; place-items: center; color: var(--on-ok); }
.checklist .check .icon { width: 13px; height: 13px; stroke-width: 3; }
.checklist li.done .check { background: var(--ok); border: 0; }
.checklist li.done strong { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.tour { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.tour-card { gap: .3rem; padding: 1.15rem 1.25rem 1.25rem; }
.tour-card > .icon { color: var(--accent); width: 34px; height: 34px; padding: 8px; border-radius: 9px; background: var(--accent-soft); margin-bottom: .6rem; box-shadow: inset 0 0 0 1px var(--accent-line); }
.tour-card strong { font-size: .9375rem; font-weight: 600; }
.tour-card .muted { font-size: .8125rem; line-height: 1.5; }

/* ============ Company profile / settings ============ */
.settings-section { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 0 1.5rem 1.4rem; margin: 0 0 1.25rem; min-width: 0; box-shadow: var(--shadow-sm); }
.settings-section legend { float: left; width: calc(100% + 3rem); margin: 0 -1.5rem 1.25rem; padding: .95rem 1.5rem; font-weight: 600; font-size: .9375rem; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.settings-section legend + * { clear: both; }
.settings-section > .helptext { margin: -.25rem 0 1rem; }
.logo-row { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.logo-preview { width: 148px; height: 96px; border: 1px dashed var(--border-strong); border-radius: var(--radius); display: grid; place-items: center; background: var(--surface-2); padding: .6rem; flex: none; text-align: center; font-size: .8rem; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-fields { flex: 1; min-width: 220px; }
.logo-fields .field + .field { margin-top: .9rem; }
.logo-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .6rem; }
.file-button { position: relative; cursor: pointer; }
.file-button .file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.file-button:has(.file-input:focus-visible) { box-shadow: var(--ring); }
.logo-fields .helptext { margin: 0; }
.form-error { display: flex; align-items: center; gap: .4rem; margin: .6rem 0 0; color: var(--danger); font-size: .85rem; font-weight: 500; }
.form-error .icon, .save-note .icon { width: 16px; height: 16px; flex: none; }
.save-note { display: flex; align-items: center; gap: .4rem; margin: .6rem 0 0; color: var(--ok); font-size: .85rem; font-weight: 500; }
.save-note.is-error { color: var(--danger); }
.theme-choices { display: flex; gap: .75rem; flex-wrap: wrap; margin: 0 0 .9rem; }
.theme-choice { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; padding: .6rem .6rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; font-weight: 550 !important; font-size: .85rem !important; min-width: 150px; color: var(--text) !important; transition: border-color .15s, box-shadow .15s; }
.theme-choice:hover { border-color: var(--faint); }
.theme-choice:has(input:checked) { border-color: var(--accent); box-shadow: var(--ring); }
.theme-choice input { position: absolute; opacity: 0; pointer-events: none; }
.theme-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-swatch { display: grid; grid-template-columns: 1fr 3fr; grid-template-rows: 1fr 2fr; gap: 4px; width: 130px; height: 72px; padding: 5px; border-radius: 7px; }
.theme-swatch span { border-radius: 3px; }
.theme-swatch span:nth-child(1) { grid-row: 1 / 3; }
.theme-dark .theme-swatch { background: #111214; border: 1px solid #2a2c31; }
.theme-dark .theme-swatch span:nth-child(1), .theme-dark .theme-swatch span:nth-child(3) { background: #1c1d21; }
.theme-dark .theme-swatch span:nth-child(2) { background: #3f61ee; }
.theme-light .theme-swatch { background: #f6f7f9; border: 1px solid #e4e6eb; }
.theme-light .theme-swatch span:nth-child(1), .theme-light .theme-swatch span:nth-child(3) { background: #ffffff; box-shadow: 0 0 0 1px #e4e6eb; }
.theme-light .theme-swatch span:nth-child(2) { background: #2f4ec4; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; padding: .9rem 0 1rem; margin-top: 0; background: linear-gradient(to top, var(--bg) 65%, transparent); }

/* ============ Team ============ */
.invite-box { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius-lg); padding: 1rem 1.15rem; margin: 0 0 1.25rem; }
.invite-box p { margin: .3rem 0 .75rem; font-size: .85rem; }
.invite-row { display: flex; gap: .5rem; }
.invite-link { font-size: .8rem; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--surface) !important; }
.deactivate { margin-top: 1.25rem; padding: 1rem 1.25rem; border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--border)); border-radius: var(--radius-lg); background: var(--surface); }
.deactivate p { margin: .3rem 0 0; font-size: .85rem; }
.reset-password { margin-top: 1.25rem; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.reset-password p { margin: .5rem 0 0; font-size: .85rem; }
.access td, .access th { padding-top: .55rem; padding-bottom: .55rem; }
.access .feature-row td { font-weight: 600; color: var(--text); background: var(--surface-2); }
.access .page-row td:first-child { padding-left: 2rem; color: var(--text-2); }
.access .yes { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.access .yes .icon { width: 12px; height: 12px; stroke-width: 3; }
.access .no { color: var(--faint); }
.access td:first-child, .access th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.access .feature-row td:first-child { background: var(--surface-2); }
.access th:first-child { background: var(--surface-2); }
.foot-note { display: flex; align-items: center; gap: .5rem; margin-top: 1rem; font-size: .85rem; color: var(--muted); }
.foot-note .icon { width: 16px; height: 16px; }

/* ============ Quote editor ============ */
.header-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 0 1rem; }
.header-form > .field { margin-bottom: 1.1rem !important; }
.header-form > .field:has(textarea) { grid-column: 1 / -1; margin-bottom: 0 !important; }
.header-form > .actions { grid-column: 1 / -1; margin-top: 1.1rem; justify-content: flex-end; }
.doc-meta { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: .5rem 0 0; color: var(--muted); font-size: .85rem; }
.doc-meta span { display: inline-flex; align-items: center; gap: .4rem; }
.doc-meta .icon { width: 15px; height: 15px; color: var(--faint); }
.lines-card { padding: 0; overflow: hidden; }
.lines-card > .panel-head { padding: 1.1rem 1.5rem 0; }
.lines { border: none; box-shadow: none; border-radius: 0; background: transparent; }
.lines th { background: transparent; border-bottom: 1px solid var(--border); padding: .55rem .5rem; }
.lines th:first-child, .lines td:first-child { padding-left: 1.5rem; }
.lines th:last-child, .lines td:last-child { padding-right: 1.5rem; }
.lines td { padding: .45rem .5rem; color: var(--text); }
.lines tbody tr:hover td { background: transparent; }
.lines input:not([type=checkbox]), .lines select { height: 34px; padding: 0 .6rem; font-size: .85rem; box-shadow: none; }
.lines input:not([type=checkbox]):not(:hover):not(:focus), .lines select:not(:hover):not(:focus) { border-color: var(--border); background-color: transparent; }
.lines input.desc { min-width: 240px; }
.lines input.qty { width: 5.5rem; text-align: right; }
.lines input.price { width: 7.5rem; text-align: right; }
.lines select { min-width: 6.5rem; }
.lines td.num { font-variant-numeric: tabular-nums; color: var(--text-2); }
.lines td.num:last-child, .lines td.num:nth-last-child(2):has(+ .row-actions) { font-weight: 550; color: var(--text); }
.lines td.center input[type=checkbox] { display: block; margin: 0 auto; }
.lines .errorlist { display: block; font-size: .8rem; margin-top: .2rem; }
.lines .errorlist:empty { display: none; }
.lines-empty { display: none; }
.lines-card tbody:empty + tfoot .lines-empty, #quote-lines:empty ~ .lines-empty { display: table-row; }
.lines-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 1.5rem; padding: 1.1rem 1.5rem 1.5rem; border-top: 1px solid var(--border); background: var(--surface-2); align-items: start; }
.add-lines { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.add-lines .search { margin: 0; flex: 1; min-width: 200px; max-width: none; }
.picker { list-style: none; padding: .25rem; margin: .5rem 0 0; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); animation: pop-in .16s var(--ease) both; }
.picker:empty { display: none; }
.picker-item { display: flex; align-items: center; gap: 1rem; padding: .45rem .5rem .45rem .75rem; border-radius: 7px; font-size: .875rem; }
.picker-item:hover { background: var(--hover); }
.picker-name { flex: 1; font-weight: 500; min-width: 0; color: var(--text); }
.picker-price { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .8125rem; }
.picker-empty { padding: .8rem 1rem; font-size: .85rem; }
.totals { margin: 0 0 1.5rem auto; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.25rem; box-shadow: var(--shadow-sm); font-size: .875rem; }
.lines-foot .totals { margin: 0; max-width: none; }
.totals dl { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; margin: 0; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text); }
.totals .grand { font-weight: 600; font-size: 1.125rem; border-top: 1px solid var(--border); padding-top: .7rem; margin-top: .25rem; color: var(--text); letter-spacing: -.01em; }
.totals p { margin: .8rem 0 0; font-size: .8rem; line-height: 1.45; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0 0 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.facts > div { padding: .9rem 1.25rem; min-width: 0; }
.facts > div + div { border-left: 1px solid var(--border-soft); }
.facts dt { color: var(--muted); font-size: .75rem; font-weight: 500; margin-bottom: .2rem; }
.facts dd { margin: 0; font-weight: 550; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem 1.3rem; margin: 0 0 1.25rem; }
.meta dt { color: var(--muted); font-weight: 500; }
.meta dd { margin: 0; }
.notes-card p { margin: 0; color: var(--text-2); font-size: .875rem; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.25rem; margin-top: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.danger-zone p { margin: 0; color: var(--muted); font-size: .85rem; }
.danger-zone button { display: inline-flex; align-items: center; gap: .4rem; }
.cards { display: flex; gap: 1rem; flex-wrap: wrap; }
.card { min-width: 180px; }
.card strong { font-size: 2rem; }
.confirm-page { text-align: center; padding: 2.25rem 2rem 2rem; }
.confirm-page .empty-icon { margin: 0 auto 1rem; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--danger-soft); color: var(--danger); }
.confirm-page h1 { font-size: 1.25rem; margin-bottom: .5rem; }
.confirm-page .actions { justify-content: center; }

/* ============ Catalogue ============ */
.filters select { height: 38px; padding: 0 .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background-color: var(--surface-2); color: var(--text); font-size: .8125rem; box-shadow: var(--shadow-xs); max-width: 200px; }
:root[data-theme="light"] .filters select { background-color: var(--surface); }
.filters select:hover { border-color: var(--faint); }
.filters select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.item-meta { display: flex; flex-wrap: wrap; gap: .15rem .75rem; margin-top: .2rem; font-size: .75rem; color: var(--muted); font-weight: 400; }
.num-meta { justify-content: flex-end; }
.subtle-link { color: var(--text-2); }
.subtle-link:hover { color: var(--accent); text-decoration: none; }
.badge.muted-badge { color: var(--faint); }
.margin { font-variant-numeric: tabular-nums; color: var(--ok); font-weight: 550; }
.margin.negative, .price-facts .negative { color: var(--danger); }
.price-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; margin: .25rem 0 1rem; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.price-facts > div { padding: .65rem .9rem; background: var(--surface-2); }
.price-facts > div + div { border-left: 1px solid var(--border); }
.price-facts dt { font-size: .75rem; color: var(--muted); }
.price-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.form-hint { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin: -.25rem 0 1rem; }
.form-hint .icon { width: 14px; height: 14px; }
.settings-section > .form-hint:last-child { margin-bottom: 0; }
.sticky-actions > a.danger { margin-left: 0; margin-right: auto; }
.customize-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; margin-bottom: 1.25rem; }
.customize-grid > * { margin-bottom: 0; }
.setting-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.setting-list > li { display: flex; align-items: center; gap: .5rem .75rem; padding: .6rem 0; border-top: 1px solid var(--border-soft); }
.setting-list > li:first-child { border-top: 0; }
.setting-list > li.htmx-added { animation: row-in .35s var(--ease) both; }
.setting-list > li.htmx-swapping { opacity: 0; transition: opacity .25s; }
.setting-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; }
.setting-main .item-meta { flex-basis: 100%; margin-top: 0; }
.setting-count { white-space: nowrap; }
.setting-empty { color: var(--muted); font-size: .85rem; padding: 1rem 0 !important; }
.inline-add { margin: 0 0 .5rem; }
.inline-add-row { display: flex; gap: .5rem; }
.inline-add .errorlist { margin-top: .35rem; }
.search.no-icon { padding-left: .75rem !important; background-image: none; max-width: none; flex: 1; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.presets form { margin: 0; }
.preset { width: 100%; height: auto; display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem; text-align: left; white-space: normal; line-height: 1.4; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; font-weight: 400; }
.preset:hover { background: var(--surface-3); border-color: var(--border-strong); }
.preset-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); flex: none; box-shadow: inset 0 0 0 1px var(--accent-line); }
.preset-icon .icon { width: 17px; height: 17px; }
.preset-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.preset-text strong { font-weight: 600; font-size: .875rem; }
.preset-text span { font-size: .75rem; color: var(--muted); }
.preset-add { color: var(--faint); transition: color .15s, transform .15s var(--ease); }
.preset:hover .preset-add { color: var(--accent); transform: scale(1.1); }
[hidden] { display: none !important; }

/* ============ Quote editor (v2) ============ */
.quote-head .actions { align-items: center; }
.quote-title { font-weight: 550; color: var(--text); }
.save-status { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); min-height: 1px; }
.save-status .icon { width: 14px; height: 14px; }
.save-status.is-saved { color: var(--ok); animation: fade-in .3s both; }
.save-status.is-error { color: var(--danger); max-width: 420px; }
.more-menu { position: relative; }
.more-menu > summary { list-style: none; }
.more-menu > summary::-webkit-details-marker { display: none; }
.button.icon-only { width: 36px; padding: 0; }
.menu-panel.menu-down { top: calc(100% + 6px); bottom: auto; left: auto; right: 0; width: max-content; min-width: 230px; transform-origin: top right; }
.details-card { padding-top: 1rem; }
.stacked .title-field input.title-input, .title-field input { width: calc(100% + 1rem) !important; height: auto !important; font-size: 1.25rem !important; border: 1px solid transparent !important; background: transparent !important; box-shadow: none !important; padding: .35rem .5rem !important; margin: 0 -.5rem .75rem; font-size: 1.25rem; font-weight: 600; letter-spacing: -.015em; color: var(--text); border-radius: var(--radius-sm); }
.title-field input:hover { background: var(--hover) !important; }
.title-field input:focus { outline: none; border-color: var(--accent) !important; box-shadow: var(--ring) !important; background: var(--surface-2) !important; }
.title-field { margin-bottom: 0 !important; }
.details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 0 1rem; }
.autosave-note { display: flex; align-items: center; gap: .35rem; margin: .9rem 0 0; }
.autosave-note .icon { width: 14px; height: 14px; color: var(--ok); }
.line-adders { display: flex; gap: .4rem; flex-wrap: wrap; }
.catalogue-add { padding: 0 1.5rem 1rem; }
.catalogue-add .search { max-width: none; }
.lines-edit textarea.desc, .lines-edit textarea.note-input { min-height: 34px; height: 34px; padding: .45rem .6rem; resize: none; field-sizing: content; max-height: 220px; line-height: 1.4; width: 100%; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: .85rem; }
.lines-edit textarea.desc:hover, .lines-edit textarea.note-input:hover { border-color: var(--faint); }
.lines-edit textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface-2); }
.lines-edit td.desc-cell { min-width: 260px; width: 40%; }
.line-row:focus-within td { background: var(--hover); }
.line-tools .tool { opacity: 0; transition: opacity .15s; }
.line-row:hover .tool, .line-row:focus-within .tool { opacity: 1; }
.move-group { display: inline-flex; flex-direction: column; vertical-align: middle; }
.move-group .icon-button { width: 26px; height: 16px; border-radius: 4px; }
.move-group .icon { width: 14px; height: 14px; }
.line-tools .icon-button.tool:hover { background: var(--hover); color: var(--text); }
.text-kind { display: flex; align-items: center; gap: .3rem; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin-bottom: .3rem; }
.text-kind .icon { width: 13px; height: 13px; }
.line-section td { background: color-mix(in srgb, var(--accent) 5%, transparent); border-top: 1px solid var(--border); }
.lines-edit .section-input { width: 100%; height: 36px; border: 1px solid transparent !important; background: transparent !important; font-weight: 650 !important; font-size: .95rem !important; color: var(--accent) !important; padding: 0 .5rem !important; border-radius: 8px; }
.lines-edit .section-input:hover { border-color: var(--border) !important; }
.lines-edit .section-input:focus { outline: none; border-color: var(--accent) !important; box-shadow: var(--ring); }
.line-note .note-input { font-style: italic; color: var(--text-2) !important; }
.line-flag { display: block; margin-top: .25rem; text-align: right; }
.line-flag:empty { display: none; }
.badge.estimate { background: var(--violet-soft); color: var(--violet); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--violet) 25%, transparent); gap: .25rem; height: 20px; font-size: .7rem; }
.badge.estimate .icon { width: 11px; height: 11px; }
.estimate-warning { display: flex; align-items: flex-start; gap: .55rem; padding: .7rem .85rem; margin-bottom: .75rem; border-radius: var(--radius); background: var(--violet-soft); color: var(--violet); font-size: .8125rem; font-weight: 500; }
.estimate-warning .icon { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.lines-empty-row td { padding: 0 !important; }
.doc-section td { padding-top: 1rem !important; font-weight: 650; color: var(--accent) !important; }
.doc-note td { font-style: italic; color: var(--text-2) !important; font-size: .85rem; }
.doc-subtotal td { background: var(--surface-2); font-size: .8rem; font-weight: 600; color: var(--text-2) !important; }
.doc-subtotal td:first-child { text-align: right; }

/* AI helper */
.ai-panel { margin: 0 1.5rem 1rem; border: 1px solid color-mix(in srgb, var(--violet) 30%, var(--border)); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--violet) 5%, var(--surface)); overflow: hidden; }
.ai-panel > summary { list-style: none; display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem; cursor: pointer; }
.ai-panel > summary::-webkit-details-marker { display: none; }
.ai-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #6d5bd0; color: #fff; flex: none; }
.ai-mark .icon { width: 17px; height: 17px; }
.ai-summary-text { flex: 1; display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.ai-summary-text strong { font-weight: 600; font-size: .9rem; }
.ai-summary-text span { color: var(--muted); font-size: .8rem; }
.ai-chevron { color: var(--faint); transition: transform .2s var(--ease); }
.ai-panel[open] .ai-chevron { transform: rotate(180deg); }
.ai-body { padding: 0 1rem 1rem; }
.ai-form textarea { width: 100%; min-height: 84px; padding: .7rem .8rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font: inherit; font-size: .875rem; line-height: 1.5; resize: vertical; }
:root[data-theme="light"] .ai-form textarea { background-color: var(--surface); }
.ai-form textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.ai-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: .6rem; }
.ai-actions button { background: #6d5bd0; border-color: #6d5bd0; }
.ai-actions button:hover { background: #5f4ec4; }
.ai-note { flex: 1; min-width: 220px; }
.ai-thinking { display: none; align-items: center; gap: .5rem; color: var(--violet); font-size: .8125rem; font-weight: 500; opacity: 1 !important; }
.ai-thinking.htmx-request { display: inline-flex; }
.ai-thinking.htmx-request + .ai-note { display: none; }
.ai-thinking::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.ai-off, .ai-error { display: flex; align-items: flex-start; gap: .6rem; padding: .8rem .9rem; border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); font-size: .85rem; }
.ai-off .icon, .ai-error .icon { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.ai-error { background: var(--danger-soft); color: var(--danger); margin-top: .75rem; }
.ai-review { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); animation: page-in .3s var(--ease) both; }
.ai-review-head { display: flex; flex-direction: column; gap: .15rem; margin-bottom: .6rem; }
.ai-assumptions { display: flex; gap: .5rem; align-items: flex-start; margin: 0 0 .75rem; padding: .6rem .8rem; background: var(--surface-2); border-radius: var(--radius-sm); font-size: .8125rem; color: var(--text-2); }
.ai-assumptions .icon { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--muted); }
.ai-title { margin: 0 0 .75rem; font-size: .85rem !important; }
.ai-lines { background: transparent; }
.ai-lines th:first-child, .ai-lines td:first-child { padding-left: .5rem !important; width: 36px; }
.ai-lines input[type=text] { height: 32px; padding: 0 .55rem; border: 1px solid var(--border); border-radius: 7px; background: transparent; color: var(--text); font: inherit; font-size: .85rem; width: 100%; }
.ai-lines input.qty { width: 4.5rem; text-align: right; }
.ai-lines input.price { width: 6.5rem; text-align: right; }
.ai-lines input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.ai-lines tr.ai-section td { font-weight: 600; }
.ai-lines tr:has(input[name=keep]:not(:checked)) td:not(:first-child) { opacity: .4; }
.ai-review-actions { display: flex; gap: .5rem; margin-top: .9rem; }
.ai-start { display: flex !important; align-items: center; gap: .75rem; padding: .8rem .9rem; margin: .25rem 0 0; border: 1px solid color-mix(in srgb, var(--violet) 30%, var(--border)); border-radius: var(--radius); cursor: pointer; background: color-mix(in srgb, var(--violet) 5%, transparent); }
.ai-start > span:last-child { display: flex; flex-direction: column; gap: .1rem; font-size: .875rem; }
.ai-start input { flex: none; }

/* ============ Sending a quote ============ */
dialog.send-dialog { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(600px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); }
dialog.send-dialog[open] { animation: pop-in .18s var(--ease) both; }
dialog.send-dialog::backdrop { background: rgba(5, 7, 12, .55); backdrop-filter: blur(2px); }
.send-head { display: flex; gap: .9rem; align-items: flex-start; padding: 1.25rem 1.4rem .75rem; }
.send-head > div { flex: 1; }
.send-head h2 { margin: .1rem 0 .25rem; font-size: 1.05rem; }
.send-head p { margin: 0; }
.send-body { padding: .25rem 1.4rem 1rem; }
.send-body .field { margin-bottom: .9rem !important; }
.send-body textarea { min-height: 170px !important; }
.send-preview { display: flex; flex-direction: column; gap: .35rem; padding: .7rem .85rem; margin-bottom: .75rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.send-link { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 550; color: var(--accent); }
.send-link .icon { width: 15px; height: 15px; }
.send-dialog .confirm-actions .ghost { margin-right: auto; }
.sent-card .setting-main .icon { width: 15px; height: 15px; color: var(--muted); }
.sent-card .panel-head .badge .icon { width: 12px; height: 12px; }
.sent-badge .icon { width: 11px; height: 11px; }
.badge.viewed { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 22%, transparent); gap: .3rem; }
.badge.viewed .icon { width: 12px; height: 12px; }

/* ============ Importing quotes ============ */
.upload-card { padding: 1.25rem; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 2.25rem 1rem; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-files { border-style: solid; border-color: var(--accent-line); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: .35rem; }
.dropzone-icon .icon { width: 22px; height: 22px; }
.dropzone-files { font-size: .8125rem; color: var(--accent); font-weight: 550; max-width: 90%; }
.upload-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.upload-foot .helptext { display: flex; align-items: center; gap: .4rem; flex: 1; min-width: 260px; margin: 0; }
.upload-foot .helptext .icon { width: 15px; height: 15px; flex: none; }
.import-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.import-row { display: flex; align-items: center; gap: .85rem; padding: .85rem 1.1rem; }
.import-row + .import-row { border-top: 1px solid var(--border-soft); }
.import-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-3); color: var(--muted); flex: none; }
.import-icon .icon { width: 17px; height: 17px; }
.import-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.import-main strong { font-weight: 550; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-reading { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; color: var(--violet); }
.import-reading::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.import-actions { display: flex; align-items: center; gap: .35rem; }
.status-ready .import-status { background: var(--accent-soft); color: var(--accent); }
.status-failed .import-status { background: var(--danger-soft); color: var(--danger); }
.status-imported .import-status { background: var(--ok-soft); color: var(--ok); }
.status-pending .import-status { background: var(--violet-soft); color: var(--violet); }
.review-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.25rem; align-items: start; }
.doc-viewer { position: sticky; top: calc(var(--topbar-h) + 1rem); display: flex; flex-direction: column; gap: .5rem; }
.doc-viewer iframe, .doc-viewer img { width: 100%; height: calc(100vh - var(--topbar-h) - 5rem); border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-sm); object-fit: contain; }
.review-form .settings-section { margin-bottom: 1rem; }
.save-choices > .choice-card { margin-bottom: .5rem; }
.save-choices .form-hint { margin: .5rem 0 0; }
.settings-section.is-off { opacity: .45; }
.settings-section.is-off :is(input, select, textarea) { pointer-events: none; }
.review-line-adders { display: flex; gap: .5rem; padding: .85rem 1.25rem 0; }
.lines-empty-note { padding: .75rem 1.25rem 0; margin: 0; }
.import-lines tr.added-line td { animation: row-in .35s var(--ease) both; }
.stacked > .review-layout { display: grid !important; margin-bottom: 1rem; }
.review-lines .import-lines td:nth-child(2) { min-width: 260px; width: 38%; }
.stacked .review-lines input.qty { width: 4.75rem !important; text-align: right; }
.stacked .review-lines input.price { width: 6.75rem !important; text-align: right; }
.stacked .review-lines input.desc { min-width: 220px; }
.stacked .review-lines input.unit-input { width: 7rem !important; }
.review-details { min-width: 0; }
.doc-viewer iframe, .doc-viewer img { max-height: 980px; }
.review-form textarea { height: auto; }
.review-lines { padding-left: 0 !important; padding-right: 0 !important; overflow: hidden; }
.review-lines legend { margin-left: 0 !important; margin-right: 0 !important; width: 100% !important; }
.review-lines .form-hint { padding: .75rem 1.25rem 0; }
.import-lines td { vertical-align: top; }
.import-lines select { height: 32px; font-size: .8125rem; border: 1px solid var(--border); border-radius: 7px; background-color: transparent; color: var(--text); padding: 0 1.75rem 0 .5rem; }
.import-lines .catalogue-cell { min-width: 170px; display: table-cell; }
.import-lines .catalogue-cell .badge { max-width: 180px; overflow: hidden; text-overflow: ellipsis; display: inline-flex; margin-bottom: .3rem; }
.import-lines .check-label { font-size: .78rem !important; align-items: flex-start; gap: .4rem; }
.import-lines tr.unreadable td { background: var(--danger-soft); }
.import-lines td .danger.small, .import-lines td .muted.small { display: block; margin-top: .25rem; }
.dashboard-choice > div, .dashboard-choice { display: grid !important; gap: .5rem; }
.dashboard-choice legend { margin-bottom: .4rem; }
.choice-card { display: flex !important; align-items: flex-start; gap: .65rem; padding: .7rem .85rem; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; font-weight: 400 !important; }
.choice-card:has(input:checked) { border-color: var(--accent); box-shadow: var(--ring); }
.choice-card input { margin-top: .2rem; accent-color: var(--accent-btn); }
.choice-card > span { display: flex; flex-direction: column; gap: .1rem; }
.choice-card strong { font-weight: 550; color: var(--text); }
@media (max-width: 1100px) {
  .review-layout, .stacked > .review-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-viewer { position: static; }
  .doc-viewer iframe, .doc-viewer img { height: 420px; }
}

/* ============ Auth pages (log in, sign up, invitation) ============ */
.no-sidebar { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.no-sidebar .topbar { background: transparent; border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0 1.5rem; }
.no-sidebar .topbar .brand { display: inline-flex; }
.no-sidebar main { display: flex; flex-direction: column; align-items: center; padding: 3rem 1rem 4rem; max-width: none; }
.no-sidebar .narrow { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; box-shadow: var(--shadow-lg); margin: 0; }
.no-sidebar .narrow h1 { margin-bottom: .35rem; font-size: 1.375rem; }
.no-sidebar .narrow .lead { color: var(--muted); margin: 0 0 1.5rem; font-size: .9rem; }
.no-sidebar .narrow .actions { margin-top: 1.5rem; }
.no-sidebar .narrow .actions button { width: 100%; height: 40px; }
.no-sidebar .narrow > p:last-child { margin: 1.5rem -2rem -2rem; padding: 1rem 2rem; text-align: center; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.auth-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; margin: 0 auto 1.5rem; background: var(--accent-btn); color: #fff; }
.auth-foot { margin-top: 1.5rem; color: var(--faint); font-size: .8rem; text-align: center; }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
  .tour { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts > div:nth-child(3) { border-left: 0; }
  .facts > div:nth-child(n+3) { border-top: 1px solid var(--border-soft); }
}
@media (max-width: 900px) {
  .app, .sidebar-collapsed .app { grid-template-columns: minmax(0, 1fr); }
  main { padding: 1.25rem 1rem 3rem; }
  .topbar { padding: 0 1rem; }
  .menu-button { display: inline-grid; place-items: center; }
  .topbar .brand { display: inline-flex; }
  .crumbs { display: none; }
  /* Off-canvas drawer */
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(288px, 86vw); transform: translateX(-102%); transition: transform .26s var(--ease), box-shadow .26s; box-shadow: none; }
  .sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(5, 7, 12, .5); opacity: 0; pointer-events: none; transition: opacity .26s; }
  .sidebar-open .scrim { opacity: 1; pointer-events: auto; }
  .sidebar-open body { overflow: hidden; }
  .sidebar-collapsed .side-label, .sidebar-collapsed .workspace-text, .sidebar-collapsed .user-text, .sidebar-collapsed .brand-name { display: revert; }
  .sidebar-collapsed .side-button { justify-content: flex-start; padding: 0 .65rem; }
  .sidebar-collapsed .side-group-label { height: auto; padding: 1rem .65rem .4rem; margin: 0; background: none; color: var(--faint); }
  .sidebar-collapsed .sidebar-head { flex-direction: row; height: 40px; padding: 0 .25rem 0 .375rem; }
  .sidebar-collapsed .workspace { justify-content: flex-start; padding: .5rem .6rem; border-color: var(--border); background: var(--surface); }
  .sidebar-collapsed .user-menu > summary { justify-content: flex-start; padding: .45rem .55rem; }
  .collapse-button { display: none; }
  .sidebar .drawer-close { display: grid; }
  .side-button { height: 40px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customize-grid { grid-template-columns: minmax(0, 1fr); }
  .stats.upcoming { grid-template-columns: minmax(0, 1fr); }
  .lines-foot { grid-template-columns: minmax(0, 1fr); }
  .tabs { margin-top: 0; }
  .hide-md { display: none; }
}
@media (max-width: 640px) {
  .app .topbar .brand-name { display: none; } /* the V mark is enough; the search box needs the room */
  h1 { font-size: 1.55rem; }
  .page-head { align-items: stretch; flex-direction: column; }
  .page-head > .button, .page-head .actions { width: 100%; }
  .page-head .actions > * { flex: 1; }
  .page-head > .button { width: 100%; }
  .stats, .tour { grid-template-columns: minmax(0, 1fr); }
  .topbar-action .label { display: none; }
  .card-section, .panel-card, .form-card { padding: 1rem 1rem 1.25rem; }
  .form-card .actions { margin: 1.25rem -1rem -1.25rem; padding: .85rem 1rem; }
  .settings-section { padding: 0 1rem 1.1rem; }
  .settings-section legend { width: calc(100% + 2rem); margin: 0 -1rem 1.1rem; padding: .85rem 1rem; }
  .lines-card > .panel-head { padding: 1rem 1rem 0; }
  .lines th:first-child, .lines td:first-child { padding-left: 1rem; }
  .lines th:last-child, .lines td:last-child { padding-right: 1rem; }
  .lines-foot { padding: 1rem; }
  .catalogue-add { padding: 0 1rem 1rem; }
  .ai-panel { margin: 0 1rem 1rem; }
  .line-tools .tool { opacity: 1; }
  .lines-card .lines td.text-cell { grid-column: 1 / -1; }
  .lines-edit td.desc-cell { min-width: 0; width: auto; }
  .lines-card .lines td.row-actions.line-tools { top: .55rem; right: .6rem; display: flex; flex-direction: row; align-items: center; gap: 0; }
  .lines-card .lines td.line-tools .move-group { flex-direction: row; }
  .lines-card .lines td.line-tools .move-group .icon-button { width: 28px; height: 28px; }
  .lines-card table.lines-edit tr td.desc-cell { padding-right: 8.5rem !important; }
  .no-sidebar main { padding-top: 1.5rem; }
  .no-sidebar .narrow { padding: 1.5rem 1.25rem; }
  .no-sidebar .narrow > p:last-child { margin: 1.25rem -1.25rem -1.5rem; padding: 1rem 1.25rem; }
  .hide-sm { display: none; }
  .filters select { max-width: none; flex: 1 1 140px; }
  .show-sm { display: block; margin-top: .3rem; }
  .card-section.lines-card { padding: 0; }
  /* Quote lines become stacked cards on phones */
  .lines-card .table-wrap { overflow: visible; }
  .lines-card table.lines, .lines-card .lines tbody { display: block; }
  .lines-card .lines thead { display: none; }
  .lines-card .lines tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem .6rem; padding: .9rem 1rem; border-bottom: 1px solid var(--border-soft); position: relative; }
  .lines-card .lines td { display: flex; flex-direction: column; gap: .25rem; padding: 0 !important; border: 0; min-width: 0; }
  .lines-card .lines td[data-label]::before { content: attr(data-label); font-size: .72rem; color: var(--muted); font-weight: 500; text-align: left; }
  .lines-card .lines td:first-child { grid-column: 1 / -1; padding-right: 2.5rem !important; }
  .lines-card .lines td.center input[type=checkbox] { margin: .55rem 0 0; }
  .lines-card .lines td.num { justify-content: flex-start; text-align: left; }
  .lines-card .lines td.num::before { text-align: left; }
  .lines-card .lines td.num > span { padding-top: .45rem; }
  .lines-card .lines td.num:not(:has(span)) { padding-top: 0; }
  .lines-card .lines td.row-actions { position: absolute; top: .9rem; right: 1rem; width: auto; }
  .lines-card .lines input.desc, .lines-card .lines input.qty, .lines-card .lines input.price, .lines-card .lines select { width: 100%; min-width: 0; }
  .lines-card .lines td:not([data-label]):not(:first-child):not(.row-actions) { grid-column: 1 / -1; }
  .bars { height: 150px; }
  .facts > div { padding: .75rem 1rem; }
  .toasts { top: auto; bottom: 1rem; left: 1rem; right: 1rem; width: auto; }
  .chart-total { text-align: left; }
  .danger-zone { flex-direction: column; align-items: flex-start; }
}
@media (hover: none) { .stat-arrow { display: none; } .line-tools .tool { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* Invoices */
.badge.unpaid, .badge.paid, .badge.cancelled, .badge.overdue { padding-left: .5rem; }
.badge.unpaid::before, .badge.paid::before, .badge.cancelled::before, .badge.overdue::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.unpaid { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
.badge.paid { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 22%, transparent); }
.badge.overdue { background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 22%, transparent); }
.badge.cancelled { color: var(--muted); text-decoration: line-through; }
.notice { padding: .65rem .9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 0 0 1rem; }
.payments-card .payment-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.payments-card .payment-form h3 { margin: 0 0 .75rem; font-size: .95rem; }
.facts.receivables { margin-bottom: 1.25rem; }

/* Description of the work, with the AI rewrite bar */
.description-field textarea { min-height: 7.5rem; }
.ai-rewrite { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.ai-rewrite .ai-mark { width: 26px; height: 26px; border-radius: 7px; }
.ai-rewrite .ai-mark .icon { width: 14px; height: 14px; }
.ai-rewrite input { flex: 1; min-width: 0; }
#ai-describe-thinking { margin-top: .5rem; }
.ai-proposal { margin-top: .75rem; padding: .85rem 1rem; border: 1px solid color-mix(in srgb, var(--violet) 35%, transparent); border-radius: var(--radius-sm); background: var(--violet-soft); }
.ai-proposal-text { white-space: pre-wrap; margin-top: .4rem; line-height: 1.55; color: var(--text); }
.ai-proposal .ai-review-actions { margin-top: .75rem; }
.ai-description { margin: 0 0 .9rem; }
.ai-description textarea { width: 100%; margin-top: .4rem; }
.doc-description { padding: 0 1.25rem 1rem; }
.doc-description h3 { margin: 0 0 .35rem; font-size: .9rem; }
.doc-description p { margin: 0; color: var(--text-2); line-height: 1.55; }
@media (max-width: 640px) { .ai-rewrite { flex-wrap: wrap; } .ai-rewrite input { flex-basis: calc(100% - 40px); } }
/* Small text boxes (e.g. notes for the client): two lines, growing as you type. */
.stacked textarea.compact { min-height: 4rem; field-sizing: content; max-height: 240px; }

/* Quick edit with AI (draft invoices) */
.ai-command-form { display: flex; gap: .75rem; align-items: flex-start; }
.ai-command-main { flex: 1; min-width: 0; display: grid; gap: .45rem; }
.ai-command-row { display: flex; gap: .5rem; }
.ai-command-row input { flex: 1; min-width: 0; }
.ai-change-list { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .35rem; }
.ai-change-list .check-label { align-items: flex-start; }
#ai-command-result:not(:empty) { margin-top: .75rem; }
@media (max-width: 640px) { .ai-command-row { flex-wrap: wrap; } .ai-command-row button { width: 100%; } }

/* Punch clock and timesheets */
.punch .punch-status { display: flex; gap: .9rem; align-items: center; margin-bottom: 1rem; }
.punch .punch-status > div { display: grid; gap: .15rem; }
.punch-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--faint); flex: none; }
.punch-status.is-on .punch-dot { background: var(--ok); box-shadow: 0 0 0 6px var(--ok-soft); animation: punch-pulse 2s ease-in-out infinite; }
@keyframes punch-pulse { 50% { box-shadow: 0 0 0 10px transparent; } }
.punch-project { font-size: 1.25rem; letter-spacing: -.01em; }
.punch-actions { margin-bottom: 1rem; }
.punch-button { width: 100%; justify-content: center; min-height: 56px; font-size: 1.05rem; }
.punch-switch { margin-bottom: 1rem; }
.punch-switch summary { cursor: pointer; font-weight: 550; }
.punch-switch form { margin-top: .9rem; }
.week-nav { display: flex; align-items: center; gap: .75rem; margin: 0 0 1rem; flex-wrap: wrap; }
.timesheet th .day-date { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.lunch-note { display: block; font-size: .7rem; color: var(--muted); }
.danger-zone { margin-top: 1rem; border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.danger-zone h2 { font-size: 1rem; margin: 0 0 .5rem; }
.punch-status.is-lunch .punch-dot { background: var(--warn); box-shadow: 0 0 0 6px var(--warn-soft); }
.punch-actions { display: grid; gap: .6rem; }

/* Calendar */
:root { --c0: #4c6ef5; --c1: #12b886; --c2: #f59f00; --c3: #e64980; --c4: #7950f2; --c5: #15aabf; --c6: #fd7e14; --c7: #82c91e; }
.c0 { --c: var(--c0); } .c1 { --c: var(--c1); } .c2 { --c: var(--c2); } .c3 { --c: var(--c3); }
.c4 { --c: var(--c4); } .c5 { --c: var(--c5); } .c6 { --c: var(--c6); } .c7 { --c: var(--c7); }
.cplain { --c: var(--accent); } .cpersonal { --c: var(--muted); }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--surface); }
.segmented a { padding: .3rem .8rem; border-radius: 999px; color: var(--muted); font-size: .85rem; text-decoration: none; }
.segmented a.active { background: var(--accent-soft); color: var(--text); font-weight: 550; }
.cal-toolbar { display: flex; align-items: center; gap: .5rem; margin: 0 0 1rem; flex-wrap: wrap; }
.cal-legend { margin-left: auto; display: flex; gap: 1rem; color: var(--muted); font-size: .8rem; }
.cal-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.cal-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--accent); }
.cal-legend .dot.personal { background: var(--muted); }
.cal-legend .bar-sample { width: 18px; height: 8px; border-radius: 3px; background: var(--c0); opacity: .8; display: inline-block; }
.cal-month { border: 1px solid var(--border); border-radius: var(--radius-lg, 14px); overflow: hidden; background: var(--surface); }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.cal-head div { padding: .5rem .6rem; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: 1.9rem repeat(var(--bar-rows, 0), 1.45rem) minmax(4.6rem, auto); position: relative; border-bottom: 1px solid var(--border); }
.cal-week:last-child { border-bottom: 0; }
.cal-day { grid-row: 1 / -1; border-right: 1px solid var(--border); padding: .3rem .45rem; }
.cal-day:nth-child(7) { border-right: 0; }
.cal-day.is-out { background: color-mix(in srgb, var(--surface) 70%, var(--bg, #000)); }
.cal-day.is-out .cal-date { color: var(--faint); }
.cal-date { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; border-radius: 999px; font-size: .8rem; font-weight: 550; color: var(--text); text-decoration: none; }
.cal-date:hover { background: var(--accent-soft); }
.cal-day.is-today .cal-date { background: var(--accent); color: #fff; }
.cal-bar { position: relative; z-index: 1; margin: 1px 3px; padding: 0 .5rem; border-radius: 6px; font-size: .72rem; font-weight: 600; line-height: 1.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; background: var(--c); text-decoration: none; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.cal-bar.cont-left { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-bar.cont-right { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.cal-bar.is-closed { opacity: .5; }
.cal-items { grid-row: -2; position: relative; z-index: 1; display: grid; align-content: start; gap: 2px; padding: .2rem .3rem .4rem; min-width: 0; }
.cal-item { display: block; padding: .15rem .4rem; border-radius: 5px; font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); text-decoration: none; background: color-mix(in srgb, var(--c) 16%, transparent); border-left: 3px solid var(--c); }
.cal-item:hover { background: color-mix(in srgb, var(--c) 26%, transparent); }
.cal-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-more { font-size: .72rem; color: var(--muted); padding-left: .4rem; }
.cal-agenda { display: none; }
.cal-agenda-day { margin-bottom: 1rem; }
.cal-agenda-day h2 { font-size: .85rem; margin: 0 0 .4rem; color: var(--muted); }
.cal-agenda-day.is-today h2 { color: var(--accent); }
.cal-agenda-day .cal-item { white-space: normal; padding: .5rem .6rem; margin-bottom: .3rem; font-size: .85rem; }
@media (max-width: 760px) { .cal-month { display: none; } .cal-agenda { display: block; } .cal-legend { display: none; } }
.cal-dialog { width: min(520px, calc(100vw - 2rem)); }
.cal-dialog-close { position: absolute; top: .75rem; right: .75rem; z-index: 2; }
.cal-panel-head { padding: 1.25rem 1.4rem 1rem; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, color-mix(in srgb, var(--c, var(--accent)) 18%, transparent), transparent); }
.cal-panel-head h2 { margin: .5rem 2rem .25rem 0; font-size: 1.2rem; }
.cal-panel-head p { display: flex; align-items: center; gap: .4rem; margin: 0; color: var(--muted); font-size: .85rem; }
.cal-facts { margin: 0; padding: .9rem 1.4rem; display: grid; gap: .7rem; }
.cal-facts div { display: grid; grid-template-columns: 7rem 1fr; gap: .75rem; }
.cal-facts dt { color: var(--muted); font-size: .8rem; }
.cal-facts dd { margin: 0; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.cal-facts dd .cal-item { width: 100%; }
.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: var(--surface-2, var(--accent-soft)); font-size: .8rem; }
.cal-panel-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .9rem 1.4rem 1.2rem; border-top: 1px solid var(--border); }
.cal-panel-actions .muted { margin-left: auto; }
.clash-warning { display: flex; gap: .6rem; padding: .8rem 1rem; border-radius: var(--radius); background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.clash-warning ul { margin: .3rem 0; padding-left: 1.1rem; }
.kind-choices { display: flex; gap: .5rem; flex-wrap: wrap; }
.kind-choice { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; }
.kind-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.delete-row { margin-top: .75rem; text-align: right; }
.agenda-day { margin-bottom: 1.25rem; }
.agenda-day h2 { font-size: .85rem; color: var(--muted); margin: 0 0 .5rem; }
.agenda-day ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.agenda-item { display: grid; grid-template-columns: 8.5rem 1fr auto; gap: .9rem; align-items: center; padding: .7rem .9rem; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.agenda-item:hover { border-color: var(--c); }
.agenda-main { display: grid; gap: .1rem; min-width: 0; }
.agenda-main .icon { width: 13px; height: 13px; margin-right: .3rem; }
.agenda-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--text); font-size: .72rem; font-weight: 650; margin-left: -6px; border: 2px solid var(--surface); }
@media (max-width: 640px) { .agenda-item { grid-template-columns: 1fr; gap: .25rem; } }
.team-grid th, .team-grid td { vertical-align: top; min-width: 7.5rem; }
.team-grid th[scope=row] { white-space: nowrap; font-weight: 550; }
.team-grid th[scope=row] .avatar { margin: 0 .35rem 0 0; }
.team-grid .is-today { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.team-block { display: block; margin-bottom: 3px; padding: .2rem .45rem; border-radius: 5px; font-size: .74rem; color: var(--text); text-decoration: none; background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent); border-left: 3px solid var(--c, var(--accent)); }
.team-block.busy { --c: var(--muted); background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--muted) 14%, transparent) 6px 12px); color: var(--muted); }
.team-free { color: var(--faint); font-size: .75rem; }
.repeat-box { border: 1px dashed var(--border); border-radius: var(--radius); padding: .9rem 1rem; margin: 0; display: grid; gap: .6rem; }
.weekday-choices, .repeat-box .field:has(.kind-choice) { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.weekday-choices .label, .repeat-box .label, .scope-choice .label { width: 100%; font-size: .85rem; font-weight: 550; }
.scope-choice { display: flex; flex-wrap: wrap; gap: .4rem; padding: .8rem 1rem; border-radius: var(--radius); background: var(--accent-soft); }
.delete-row { display: flex; gap: .5rem; justify-content: flex-end; align-items: center; }
.stacked .kind-choices, .stacked .weekday-choices, .stacked .end-choices, .stacked .scope-choice { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: .4rem; }
.stacked .kind-choices .kind-choice, .stacked .weekday-choices .kind-choice, .stacked .end-choices .kind-choice, .stacked .scope-choice .kind-choice { width: auto; flex: 0 0 auto; }

/* ============ Clients: client page, follow-ups, communication history ============ */
.client-head .client-id { display: flex; gap: 1rem; align-items: center; }
.client-avatar, .person-avatar { display: grid; place-items: center; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.client-avatar { width: 52px; height: 52px; font-size: 1.35rem; box-shadow: inset 0 0 0 1px var(--accent-line); }
.person-avatar { width: 32px; height: 32px; font-size: .85rem; }
.client-cell { display: flex; align-items: center; gap: .7rem; }
.cell-sub { display: block; font-weight: 400; }
.text-warn { color: var(--danger); }
.pulse { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.pulse-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border-radius: 999px; font-size: .8125rem; font-weight: 550; background: var(--surface-3); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); }
.pulse-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.pulse-chip.is-warn { background: var(--danger-soft); color: var(--danger); }
.pulse-chip.is-warn::before { background: var(--danger); }
.pulse-chip.is-ok { background: var(--ok-soft); color: var(--ok); }
.pulse-chip.is-ok::before { background: var(--ok); }
.client-facts > div { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.25rem; border-right: 1px solid var(--border); }
.client-facts > div:last-child { border-right: 0; }
.client-facts strong { font-size: 1.25rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.client-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 1.25rem; align-items: start; }
.client-grid .panel-card h2 { font-size: 1rem; margin: 0; display: inline-flex; align-items: center; gap: .45rem; }
.client-grid .panel-card h2 .icon { width: 16px; height: 16px; color: var(--violet); }
.client-grid .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: .72rem; }
.client-danger { text-align: right; margin: 0; }

/* Composer: log a call in a few taps, and plan the next step in the same go. */
.composer { display: grid; gap: .65rem; padding: .9rem; margin-bottom: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.composer-kinds { display: flex; flex-wrap: wrap; gap: .35rem; }
.composer-kind { position: relative; display: inline-flex; align-items: center; gap: .35rem; padding: .32rem .7rem; border-radius: 999px; border: 1px solid var(--border); font-size: .8125rem; color: var(--text-2); cursor: pointer; transition: background .15s, border-color .15s; }
.composer-kind input { position: absolute; opacity: 0; pointer-events: none; }
.composer-kind .icon { width: 14px; height: 14px; }
.composer-kind:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.composer-kind:has(input:focus-visible) { box-shadow: var(--ring); }
.composer textarea, .composer select, .composer input[type=text], .composer input[type=datetime-local] { width: 100%; padding: .5rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background-color: var(--surface); color: var(--text); font-size: .875rem; }
.composer select { height: 36px; }
.composer textarea { min-height: 64px; resize: vertical; line-height: 1.5; }
.composer-extras { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.composer-field { display: grid; gap: .25rem; font-size: .75rem; color: var(--muted); font-weight: 550; }
.composer-field > span { display: inline-flex; align-items: center; gap: .3rem; }
.composer-field .icon { width: 13px; height: 13px; color: var(--warn); }
.composer-field[hidden] { display: none; }
.composer-next { grid-column: 1 / -1; }
/* The date-and-time box is wide: give it its own row, and never let a box overflow its cell. */
.composer-field { min-width: 0; }
.composer-field input, .composer-field select { min-width: 0; max-width: 100%; box-sizing: border-box; }
.composer-field:has(input[type=datetime-local]) { grid-column: 1 / -1; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }

/* Timeline */
.tl-day { margin-bottom: 1.1rem; }
.tl-date { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .6rem; font-weight: 600; }
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.tl-item { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: .75rem; padding: .35rem 0; }
.tl-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); box-shadow: 0 0 0 4px var(--surface), inset 0 0 0 1px var(--border); }
.tl-dot .icon { width: 15px; height: 15px; }
.tl-call .tl-dot, .tl-meeting .tl-dot, .tl-visit .tl-dot { background: var(--accent-soft); color: var(--accent); }
.tl-email .tl-dot, .tl-text .tl-dot { background: var(--violet-soft); color: var(--violet); }
.tl-ok .tl-dot, .tl-follow_ups .tl-dot { background: var(--ok-soft); color: var(--ok); }
.tl-documents .tl-dot { background: var(--surface-2); color: var(--muted); }
.tl-body { min-width: 0; padding-top: .3rem; }
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem; }
.tl-head strong { font-weight: 600; font-size: .9rem; }
.tl-head strong a { color: inherit; }
.tl-meta { color: var(--muted); font-size: .78rem; }
.tl-remove { margin-left: auto; width: 26px; height: 26px; opacity: 0; transition: opacity .15s; }
.tl-item:hover .tl-remove, .tl-remove:focus-visible { opacity: 1; }
.tl-detail { margin: .25rem 0 0; color: var(--text-2); font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.tl-more { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-top: .75rem; border-top: 1px solid var(--border-soft); }
.history-filters { display: grid; gap: .6rem; margin-bottom: 1rem; }
.history-filters select { max-width: 320px; height: 36px; padding: 0 2rem 0 .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background-color: var(--surface); }
.filter-chips .kind-choice { position: relative; padding: .3rem .7rem; font-size: .8125rem; }
.filter-chips .kind-choice input { position: absolute; opacity: 0; pointer-events: none; }

/* Follow-ups */
.fu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.fu { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: .7rem; align-items: center; padding: .55rem .25rem; border-bottom: 1px solid var(--border-soft); }
.fu:last-child { border-bottom: 0; }
.fu-check { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1.5px solid var(--faint); background: transparent; color: transparent; box-shadow: none; cursor: pointer; transition: all .15s; }
.fu-check .icon { width: 14px; height: 14px; }
.fu-check:hover { border-color: var(--ok); color: var(--ok); background: transparent; }
.fu.is-done .fu-check { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.fu.is-done .fu-note { text-decoration: line-through; color: var(--muted); }
.fu-main { display: grid; gap: .15rem; min-width: 0; }
.fu-note { font-weight: 550; font-size: .9rem; overflow-wrap: anywhere; }
.fu-note a { color: inherit; }
.fu-meta { color: var(--muted); font-size: .78rem; display: flex; flex-wrap: wrap; gap: .2rem; align-items: center; }
.fu-meta a { color: var(--text-2); display: inline-flex; align-items: center; gap: .25rem; }
.fu-meta .icon { width: 12px; height: 12px; }
.fu-late { color: var(--danger); font-weight: 600; }
.fu-actions { display: flex; gap: .3rem; align-items: center; margin: 0; }
.fu-spark { display: grid; place-items: center; width: 24px; height: 24px; color: var(--violet); }
.fu-spark .icon { width: 16px; height: 16px; }
.fu-suggested.is-warn .fu-spark { color: var(--danger); }
.fu-group.is-late { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.fu-group.is-late h2 { color: var(--danger); }
.quick-dates { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: -.4rem 0 1rem; }

/* People and work on the client page */
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.person { display: flex; gap: .7rem; align-items: flex-start; }
.person strong { font-weight: 600; font-size: .9rem; }
.person > div > a { color: inherit; }
.person-ways { display: flex; flex-wrap: wrap; gap: .1rem .8rem; font-size: .8rem; margin-top: .15rem; }
.client-address { display: flex; gap: .5rem; align-items: flex-start; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--border-soft); font-size: .85rem; color: var(--text-2); }
.client-address .icon { width: 15px; height: 15px; color: var(--faint); margin-top: .15rem; flex: none; }
.client-address a { margin-left: auto; }
.client-notes { margin: .9rem 0 0; padding: .7rem .85rem; border-radius: var(--radius-sm); background: var(--warn-soft); font-size: .85rem; color: var(--text-2); }
.work-list { list-style: none; margin: 0; padding: 0; display: grid; }
.work-list a { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .5rem .25rem; border-bottom: 1px solid var(--border-soft); color: var(--text); font-size: .85rem; }
.work-list li:last-child a { border-bottom: 0; }
.work-list .icon { width: 16px; height: 16px; color: var(--faint); }
.work-amount { font-variant-numeric: tabular-nums; color: var(--text-2); }

/* Sidebar: follow-ups due, on the Clients button */
.side-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--danger-btn); color: #fff; font-size: .7rem; font-weight: 700; }
.sidebar-collapsed .side-button { position: relative; }
.sidebar-collapsed .side-badge { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; font-size: .62rem; padding: 0 4px; }

@media (max-width: 900px) {
  .client-grid { grid-template-columns: minmax(0, 1fr); }
  .client-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-facts > div:nth-child(2n) { border-right: 0; }
  .client-facts > div:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .client-head .actions { width: 100%; }
  .fu { grid-template-columns: 28px minmax(0, 1fr); }
  .fu-actions { grid-column: 2; }
  .composer-actions .muted { display: none; }
}

/* ============ Quotes › Templates and look ============ */
.look-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; border: 0; padding: 0; margin: 0 0 1.25rem; }
.look-card { position: relative; display: grid; gap: .35rem; padding: .8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.look-card:hover { border-color: var(--faint); }
.look-card input { position: absolute; opacity: 0; pointer-events: none; }
.look-card:has(input:checked) { border-color: var(--accent); box-shadow: var(--ring); }
.look-card:has(input:focus-visible) { box-shadow: var(--ring); }
.look-name { font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .4rem; }
.look-desc { color: var(--muted); font-size: .78rem; line-height: 1.45; }
.look-preview { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 550; margin-top: .15rem; }
.look-preview .icon { width: 14px; height: 14px; }
/* Miniature sheets: a drawn hint of each look, always on white paper */
.mini-sheet { display: grid; gap: 6px; aspect-ratio: 8.5 / 7; padding: 10px; margin-bottom: .35rem; background: #fff; border-radius: 3px; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); overflow: hidden; }
.mini-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 6px; border-bottom: 2px solid #0d0f14; }
.mini-logo { width: 14px; height: 14px; background: #0d0f14; }
.mini-title { width: 38%; height: 7px; background: #0d0f14; }
.mini-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.mini-facts i, .mini-rows i { display: block; height: 4px; background: #d5d8de; }
.mini-rows { display: grid; gap: 5px; padding-top: 4px; border-top: 1.5px solid #0d0f14; }
.mini-total { justify-self: end; width: 42%; height: 9px; border-top: 2px solid #0d0f14; border-bottom: 1px solid #0d0f14; }
.mini-soft { border-radius: 8px; }
.mini-soft .mini-head { border: 0; padding: 7px; border-radius: 7px; background: color-mix(in srgb, var(--brand) 12%, #fff); }
.mini-soft .mini-logo { border-radius: 50%; background: var(--brand); }
.mini-soft .mini-title { background: var(--brand); border-radius: 4px; }
.mini-soft .mini-facts i { height: 9px; border-radius: 4px; background: #eef0f3; }
.mini-soft .mini-rows { border: 0; }
.mini-soft .mini-rows i { height: 6px; border-radius: 4px; background: #f0f2f5; }
.mini-soft .mini-total { border: 0; height: 11px; border-radius: 6px; background: var(--brand); }
.mini-elegant .mini-head { flex-direction: column; gap: 4px; border-bottom: 3px double #1c1a17; }
.mini-elegant .mini-logo { border-radius: 50%; background: transparent; border: 1px solid var(--brand); }
.mini-elegant .mini-title { width: 50%; height: 4px; background: #1c1a17; }
.mini-elegant .mini-rows { border-top: 1px solid #1c1a17; }
.mini-elegant .mini-rows i { background: transparent; border-bottom: 1px dotted #b9b2a4; height: 3px; }
.mini-elegant .mini-total { border-top: 1px solid #1c1a17; border-bottom: 3px double #1c1a17; }
.mini-corporate .mini-head { margin: -10px -10px 0; padding: 9px 10px; background: #0b0d12; border: 0; box-shadow: inset 4px 0 0 var(--brand); }
.mini-corporate .mini-logo { background: var(--brand); }
.mini-corporate .mini-title { background: #fff; height: 9px; }
.mini-corporate .mini-facts { gap: 0; border: 1px solid #0b0d12; }
.mini-corporate .mini-facts i { height: 7px; background: #fff; border-right: 1px solid #0b0d12; }
.mini-corporate .mini-facts i:last-child { background: #0b0d12; }
.mini-corporate .mini-rows { gap: 0; border: 1px solid #0b0d12; border-top: 5px solid var(--brand); }
.mini-corporate .mini-rows i { height: 6px; background: #fff; border-bottom: 1px solid #b9bec8; }
.mini-corporate .mini-rows i:nth-child(even) { background: #f0f1f4; }
.mini-corporate .mini-total { border: 0; height: 11px; background: #0b0d12; box-shadow: inset 0 -2px 0 var(--brand); }
.look-colour { display: grid; gap: .5rem; margin-bottom: 1rem; }
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.swatch { width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.swatch:hover { transform: scale(1.08); }
.swatches input[type=color] { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.tpl-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem; }
.tpl-card { display: grid; gap: .75rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.tpl-top { display: flex; gap: .7rem; align-items: flex-start; }
.tpl-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); flex: none; }
.tpl-icon .icon { width: 17px; height: 17px; }
.tpl-main { display: grid; gap: .1rem; min-width: 0; }
.tpl-main strong { font-size: .95rem; }
.tpl-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0; }
.tpl-facts dt { font-size: .7rem; color: var(--muted); }
.tpl-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; font-size: .875rem; }
.tpl-actions { display: flex; gap: .4rem; align-items: center; }
.tpl-actions .icon-button { margin-left: auto; }
.tpl-lines { margin-top: 1rem; }
.tpl-lines h2 { font-size: 1rem; margin: 0 0 .3rem; }
.tpl-lines ul { list-style: none; margin: .75rem 0 0; padding: 0; }
.tpl-line { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--border-soft); font-size: .85rem; }
.tpl-line.tpl-section { font-weight: 650; color: var(--accent); }
.tpl-line.tpl-note { font-style: italic; color: var(--muted); }

/* ============ Payment plan (stages and deposits on an issued quote) ============ */
#payment-plan h2 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
#payment-plan h2 .badge .icon { width: 12px; height: 12px; }
.plan-meter { margin: .25rem 0 1.25rem; }
.plan-bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.plan-bar span { display: block; height: 100%; max-width: 100%; border-radius: 999px; background: var(--ok); transition: width .3s var(--ease); }
.plan-figures { display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; margin-top: .55rem; font-size: .85rem; color: var(--text-2); }
.plan-figures strong { color: var(--text); font-variant-numeric: tabular-nums; }
.plan-figures .muted { margin-left: auto; }
.plan-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.5rem; }
.plan-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .5rem; font-weight: 650; }
.plan-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: .75rem; }
.plan-table th { text-align: left; font-weight: 550; color: var(--muted); font-size: .75rem; padding: .35rem .4rem; border-bottom: 1px solid var(--border); }
.plan-table td { padding: .5rem .4rem; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.plan-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-table .row-actions { width: 34px; }
.stage-dot { display: inline-block; width: 8px; height: 8px; margin-right: .4rem; border-radius: 50%; background: var(--faint); vertical-align: middle; }
.stage-paid .stage-dot { background: var(--ok); }
.stage-partly .stage-dot { background: var(--warn); }
.plan-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.plan-form input, .plan-form select { height: 32px; padding: 0 .6rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background-color: var(--surface-2); color: var(--text); font-size: .8125rem; }
.plan-form input[name=name] { flex: 1 1 130px; }
.plan-form input.price { width: 6.5rem; text-align: right; }
.plan-form select { padding-right: 2rem; }
.plan-form .errorlist { width: 100%; }
.plan-deposits { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .1rem; }
.plan-deposits li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem 0; border-bottom: 1px solid var(--border-soft); font-size: .85rem; }
.plan-deposits li > span { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.plan-deposits .icon { width: 15px; height: 15px; color: var(--ok); }
.form-hint.is-error { color: var(--danger); }
@media (max-width: 900px) { .plan-grid { grid-template-columns: minmax(0, 1fr); } }

/* ============ Punch clock: My day (jobs today / punches) ============ */
/* Clear space under the punch-in form so the card below never rides up into it. */
.punch > form.form-card, .punch > .form-card, .punch > .punch-actions { margin-bottom: 1.25rem; }
.punch .my-day { margin-top: 1.25rem; position: relative; }
.day-tabs { display: flex; gap: .35rem; margin: 0 0 1rem; padding: 3px; border-radius: var(--radius); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.day-tabs [role=tab] { flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; height: 38px; border: 0; border-radius: calc(var(--radius) - 3px); background: transparent; color: var(--muted); font-weight: 550; font-size: .875rem; box-shadow: none; cursor: pointer; }
.day-tabs [role=tab] .icon { width: 16px; height: 16px; }
@media (max-width: 480px) {  /* three tabs must share a phone's width, in French too */
  .day-tabs [role=tab] { height: auto; min-height: 38px; padding: .3rem .35rem; gap: .3rem; font-size: .8125rem; white-space: normal; line-height: 1.2; text-align: center; }
  .day-tabs [role=tab] .icon { display: none; }
}
.day-tabs [role=tab][aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--border); }
.day-tabs .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); font-size: .72rem; color: var(--text-2); }
.day-jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.day-job { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.day-job.is-current { border-color: color-mix(in srgb, var(--ok) 55%, var(--border)); background: var(--ok-soft); }
.day-job-time { font-size: .78rem; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.day-job-main { display: grid; gap: .15rem; min-width: 0; }
.day-job-main strong { display: inline-flex; align-items: center; gap: .3rem; overflow-wrap: anywhere; }
.day-job-main a { display: inline-flex; align-items: center; gap: .3rem; }
.day-job-main .icon { width: 13px; height: 13px; flex: none; }
.day-job form { margin: 0; }
@media (max-width: 640px) {
  .day-job { grid-template-columns: minmax(0, 1fr) auto; }
  .day-job-time { grid-column: 1 / -1; }
}
.stats.stats-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .stats.stats-2 { grid-template-columns: minmax(0, 1fr); } }
/* Timesheet approvals */
.approvals tr.is-ready td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.approvals tr.is-approved td { color: var(--text-2); }
.approval-cell { min-width: 11rem; }
.approval-cell .badge .icon { width: 12px; height: 12px; }
.approval-cell > .muted { display: block; margin-top: .2rem; }
.reopen summary { cursor: pointer; color: var(--muted); margin-top: .25rem; }
.reopen-form { display: flex; gap: .35rem; margin-top: .4rem; }
.reopen-form input { flex: 1; min-width: 9rem; height: 30px; padding: 0 .55rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-size: .8rem; }

/* ============ Projects: project page, tasks, phases timeline, budgets, change orders ============ */
.project-facts > div { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.25rem; border-right: 1px solid var(--border); }
.project-facts > div:last-child { border-right: 0; }
.project-facts strong { font-size: 1.2rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.phase-block { margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border-soft); }
.phase-block:last-of-type { border-bottom: 0; }
.phase-head { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .7rem; margin-bottom: .35rem; }
.phase-head form { margin: 0; }
.phase-head strong { font-size: .95rem; }
.phase-tools { margin-left: auto; display: inline-flex; gap: .15rem; }
.phase-check { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border-radius: 6px; border: 1.5px solid var(--faint); background: transparent; color: transparent; box-shadow: none; cursor: pointer; }
.phase-check .icon { width: 13px; height: 13px; }
.phase-check:hover { border-color: var(--ok); color: var(--ok); background: transparent; }
.phase-block.is-done .phase-check { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.phase-block.is-done .phase-head strong { text-decoration: line-through; color: var(--muted); }
.phase-empty { padding: .4rem .25rem; }
.task-row.is-late .fu-note { color: var(--text); }
.task-notes { font-size: .8rem; color: var(--text-2); }
.inline-add { display: grid; gap: .45rem; margin-top: 1rem; padding: .8rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.inline-add-title { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; color: var(--text-2); }
.inline-add-title .icon { width: 14px; height: 14px; }
.inline-add-fields { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.inline-add-fields input, .inline-add-fields select, .expense-form input, .expense-form select, .co-line-form input { height: 34px; padding: 0 .6rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background-color: var(--surface-2); color: var(--text); font-size: .8125rem; }
.inline-add-fields select { padding-right: 2rem; max-width: 12rem; }
.inline-add-fields input[name=title], .inline-add-fields input[name=name] { flex: 1 1 200px; }
.inline-date { display: inline-flex; align-items: center; gap: .3rem; }
.budget-sum { margin: 0; display: grid; gap: .1rem; }
.budget-sum > div { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid var(--border-soft); font-size: .875rem; }
.budget-sum dt { color: var(--text-2); }
.budget-sum dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 550; }
.budget-profit { border-bottom: 0 !important; font-size: 1rem !important; }
.budget-profit dd { font-weight: 700; color: var(--ok); }
.budget-profit.is-negative dd { color: var(--danger); }
.budget-meter { margin: .75rem 0 .25rem; display: grid; gap: .35rem; }
.budget-meter .plan-bar span { background: var(--accent); }
.budget-meter.is-over .plan-bar span { background: var(--danger); }
.budget-meter.mini { margin: 0; grid-template-columns: 1fr auto; align-items: center; gap: .5rem; min-width: 8rem; }
.budget-meter.mini .plan-bar { height: 6px; }
.budget-hours { display: flex; align-items: center; gap: .35rem; margin: .75rem 0 0; }
.budget-hours .icon { width: 14px; height: 14px; }
.cat-list { list-style: none; margin: .75rem 0 0; padding: 0; font-size: .8rem; }
.cat-list li { display: flex; justify-content: space-between; padding: .25rem 0; color: var(--text-2); }
.expense-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; align-items: end; margin-bottom: 1.25rem; padding: .8rem; border-radius: var(--radius); background: var(--surface-2); }
.expense-form .composer-field input, .expense-form .composer-field select { width: 100%; }
.badge.co-approved { background: var(--ok-soft); color: var(--ok); }
.badge.co-declined { background: var(--danger-soft); color: var(--danger); }
.badge.co-draft { background: var(--warn-soft); color: var(--warn); }
.co-line-form input[name=description] { flex: 1 1 220px; }
/* Phases timeline */
.gantt-card { padding: .5rem 0; overflow-x: auto; }
.gantt { min-width: 760px; }
.gantt-row { display: grid; grid-template-columns: 14rem minmax(0, 1fr); align-items: center; min-height: 34px; border-bottom: 1px solid var(--border-soft); }
.gantt-label { display: flex; flex-direction: column; justify-content: center; gap: .05rem; padding: .35rem 1rem; font-size: .85rem; min-width: 0; }
.gantt-label strong a { color: inherit; }
.gantt-phase .gantt-label { padding-left: 2rem; flex-direction: row; align-items: center; gap: .3rem; color: var(--text-2); font-size: .8rem; }
.gantt-phase .gantt-label .icon { width: 13px; height: 13px; color: var(--ok); }
.gantt-track { position: relative; height: 100%; min-height: 34px; background-image: linear-gradient(to right, var(--border-soft) 1px, transparent 1px); background-size: calc(100% / var(--weeks)) 100%; }
.gantt-weeks { display: grid; grid-template-columns: repeat(var(--weeks), 1fr); background: none; }
.gantt-weeks span { padding: .45rem .4rem; font-size: .72rem; color: var(--muted); border-left: 1px solid var(--border-soft); }
.gantt-bar { position: absolute; top: 9px; height: 16px; border-radius: 5px; background: color-mix(in srgb, var(--accent) 55%, transparent); }
.gantt-bar.is-project { top: 8px; height: 18px; background: var(--accent); }
.gantt-phase.is-done .gantt-bar { background: color-mix(in srgb, var(--ok) 60%, transparent); }
.gantt-bar.cut-start { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.gantt-bar.cut-end { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: .7; z-index: 1; }
.gantt-undated { position: absolute; left: .75rem; top: 8px; }
.cal-phase { display: flex; align-items: center; gap: .3rem; font-size: .85rem; }
.cal-phase .icon { width: 13px; height: 13px; color: var(--ok); }
.cal-phase.is-done { color: var(--muted); }
@media (max-width: 900px) {
  .project-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-facts > div:nth-child(2n) { border-right: 0; }
  .project-facts > div:nth-child(n+3) { border-top: 1px solid var(--border); }
}
/* Catalogue assemblies */
.asm-search { border: 0; padding: 0 0 1rem; }
.tpl-card.is-inactive { opacity: .65; }
.tpl-main strong a { color: inherit; }
.asm-preview .asm-section td { font-weight: 700; color: var(--accent); border-bottom: 1px solid var(--border); }
.asm-preview .asm-total td { font-weight: 650; border-top: 1.5px solid var(--border-strong); border-bottom: 0; }
.picker-assembly .picker-name { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.picker-assembly .picker-name .icon { width: 15px; height: 15px; color: var(--accent); }
.plan-form select[name=item] { flex: 1 1 220px; }
.plan-form input.qty { width: 5.5rem; text-align: right; }

/* ============ Get started ============ */
.gs-hero { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1.75rem 2rem; margin-bottom: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  background: var(--surface); }
.gs-hello h1 { font-size: 1.75rem; letter-spacing: -.02em; margin: 0 0 .35rem; }
.gs-hello .subtitle { max-width: 52ch; margin: 0; }
.gs-ring { position: relative; width: 112px; height: 112px; flex: none; }
.gs-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gs-ring circle { fill: none; stroke-width: 10; }
.gs-ring-track { stroke: var(--surface-3); }
.gs-ring-fill { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: var(--p) 100; transition: stroke-dasharray .6s var(--ease); }
.gs-ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.gs-ring-label strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.gs-ring-label span { font-size: .72rem; color: var(--muted); }
.gs-next { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; margin-bottom: 1.5rem; border: 1px solid var(--accent-line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; transition: box-shadow .15s, transform .15s var(--ease); }
a.gs-next:hover { box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.gs-next.is-done { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.gs-next-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); flex: none; }
.gs-next.is-done .gs-next-icon { background: var(--ok-soft); color: var(--ok); }
.gs-next-text { display: grid; gap: .15rem; flex: 1; min-width: 0; }
.gs-next-text .eyebrow { margin: 0; }
.gs-next-text strong { font-size: 1.05rem; }
.gs-stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.gs-stage { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.gs-stage h2 { display: flex; align-items: center; gap: .55rem; font-size: .95rem; margin: 0 0 .75rem; }
.gs-stage-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); font-size: .75rem; font-weight: 700; color: var(--text-2); }
.gs-stage-num .icon { width: 14px; height: 14px; }
.gs-stage.is-done .gs-stage-num { background: var(--ok); color: var(--on-ok); }
.gs-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.gs-steps a { display: flex; align-items: flex-start; gap: .65rem; padding: .6rem; border-radius: var(--radius); color: var(--text); text-decoration: none; transition: background .15s; }
.gs-steps a:hover { background: var(--hover); text-decoration: none; }
.gs-steps .is-next a { background: var(--accent-soft); }
.gs-step-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); flex: none; }
.gs-step-icon .icon { width: 15px; height: 15px; }
.gs-steps .is-done .gs-step-icon { background: var(--ok-soft); color: var(--ok); }
.gs-steps .is-done strong { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.gs-step-text { display: grid; gap: .1rem; flex: 1; min-width: 0; }
.gs-step-text strong { font-size: .875rem; font-weight: 600; }
.gs-step-time { white-space: nowrap; padding-top: .15rem; }
.gs-group-label { margin: 1rem 0 .5rem; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.gs-tour { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem; }
.gs-feature { display: grid; gap: .7rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .15s; }
.gs-feature:hover { border-color: var(--border-strong); }
.gs-feature-main { display: flex; gap: .75rem; align-items: flex-start; color: var(--text); text-decoration: none; }
.gs-feature-main:hover { text-decoration: none; }
.gs-feature-main > span:last-child { display: grid; gap: .15rem; }
.gs-feature-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
.gs-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.gs-chip { padding: .2rem .6rem; border-radius: 999px; border: 1px solid var(--border); font-size: .75rem; color: var(--text-2); text-decoration: none; }
.gs-chip:hover { border-color: var(--accent-line); color: var(--text); text-decoration: none; }
.gs-tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.gs-tip { display: flex; gap: .7rem; padding: .9rem 1rem; border-radius: var(--radius-lg); background: var(--surface-2); border: 1px dashed var(--border-strong); }
.gs-tip > div { display: grid; gap: .15rem; }
.gs-tip strong { font-size: .875rem; }
.gs-tip-icon { color: var(--violet); flex: none; }
@media (max-width: 1000px) { .gs-stages { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .gs-hero { flex-direction: column-reverse; align-items: flex-start; padding: 1.25rem; }
  .gs-next { flex-wrap: wrap; }
  .gs-next .button { width: 100%; justify-content: center; }
}
/* Searchable item picker */
.item-picker { position: relative; flex: 1 1 260px; }
.item-picker-input { width: 100%; }
.item-picker.is-picked .item-picker-input { border-color: var(--accent-line); background-color: var(--accent-soft); }
.item-picker-results { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; overflow-y: auto; list-style: none; margin: 0; padding: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); }
.item-picker-results:empty { display: none; }
.item-picker-results:not(:empty) { border: 1px solid var(--border-strong); padding: .3rem; }
.item-picker-results button { display: flex; width: 100%; justify-content: space-between; gap: .75rem; align-items: center; padding: .5rem .6rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); box-shadow: none; text-align: left; font-weight: 450; cursor: pointer; }
.item-picker-results button:hover, .item-picker-results button:focus-visible { background: var(--hover); }
.item-picker-empty { padding: .5rem .6rem; }

/* ============ Site search (top bar) ============ */
.site-search { position: relative; flex: 0 1 380px; margin-left: auto; }
.site-search > .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.site-search input { width: 100%; height: 34px; padding: 0 2.2rem 0 2.1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font-size: .8125rem; transition: border-color .15s, box-shadow .15s, background .15s; }
.site-search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
.site-search-key { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); padding: 0 .35rem; border: 1px solid var(--border-strong); border-radius: 4px; font: 600 .68rem/1.4 inherit; color: var(--muted); }
.site-search input:focus ~ .site-search-key { display: none; }
.site-search-results { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0; max-height: min(70vh, 520px); overflow-y: auto; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
.site-search-results:not(:empty) { border: 1px solid var(--border-strong); padding: .4rem; }
.site-search + .right { margin-left: .5rem; }
.ss-group { margin: .5rem .5rem .25rem; font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ss-group:first-child { margin-top: .2rem; }
.ss-item { display: flex; gap: .65rem; align-items: flex-start; padding: .5rem .55rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.ss-item:hover, .ss-item:focus { background: var(--hover); text-decoration: none; outline: none; }
.ss-item:focus-visible { box-shadow: var(--ring); }
.ss-item > .icon { width: 16px; height: 16px; margin-top: .15rem; color: var(--muted); flex: none; }
.ss-item > span { display: grid; gap: .05rem; min-width: 0; }
.ss-item strong { font-size: .85rem; font-weight: 600; }
.ss-item .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-empty { padding: .6rem; margin: 0; }
@media (max-width: 760px) {
  .site-search { flex: 1 1 auto; }
  .site-search-key { display: none; }
}

/* ============ Help assistant (bottom left) ============ */
.help-widget { position: fixed; z-index: 70; right: 1.25rem; bottom: 1.25rem; }
.help-launcher { display: inline-flex; align-items: center; gap: .45rem; height: 44px; padding: 0 1.05rem 0 .9rem; border-radius: 999px; border: 0; background: var(--accent-btn); color: #fff; font-weight: 600; box-shadow: var(--shadow-lg); cursor: pointer; transition: transform .15s var(--ease), background .15s; }
.help-launcher:hover { background: var(--accent-btn-hover); transform: translateY(-1px); }
.help-launcher .icon { width: 18px; height: 18px; }
.help-launcher[aria-expanded="true"] { display: none; }
.help-panel { position: absolute; right: 0; bottom: 0; width: min(400px, calc(100vw - 2rem)); height: min(600px, calc(100vh - 6rem)); display: flex; flex-direction: column; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.help-panel[hidden] { display: none; }
.help-head { display: flex; align-items: center; gap: .6rem; padding: .8rem .8rem .8rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.help-head > div { flex: 1; display: grid; }
.help-head h2 { margin: 0; font-size: .95rem; }
.help-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-btn); color: #fff; flex: none; }
.help-avatar .icon { width: 16px; height: 16px; }
.help-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; }
.help-msg { max-width: 92%; padding: .65rem .85rem; border-radius: 14px; font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.help-msg p { margin: 0 0 .45rem; }
.help-msg p:last-child { margin-bottom: 0; }
.help-msg ul { margin: .2rem 0 .45rem; padding-left: 1.1rem; }
.help-msg.is-user { align-self: flex-end; background: var(--accent-btn); color: #fff; border-bottom-right-radius: 4px; }
.help-msg.is-bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.help-msg.is-note { border-style: dashed; color: var(--text-2); }
.help-intro { max-width: 100%; }
.help-chips { display: flex; flex-direction: column; gap: .35rem; margin-top: .6rem; }
.help-chips button { justify-content: flex-start; height: auto; min-height: 36px; white-space: normal; line-height: 1.35; text-align: left; padding: .5rem .75rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font-size: .8rem; font-weight: 500; box-shadow: none; cursor: pointer; }
.help-chips button:hover { border-color: var(--accent); }
.help-sources { margin-top: .6rem; padding-top: .55rem; border-top: 1px solid var(--border); }
.help-sources > span { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; }
.help-sources .icon { width: 13px; height: 13px; }
.help-sources ul { list-style: none; padding: 0; margin: .3rem 0 0; display: grid; gap: .2rem; }
.help-sources a { font-size: .8rem; }
.help-form { position: relative; display: flex; gap: .45rem; align-items: flex-end; padding: .7rem; border-top: 1px solid var(--border); }
.help-form textarea { flex: 1; min-height: 62px; line-height: 1.45; max-height: 120px; resize: none; padding: .55rem .75rem; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-2); color: var(--text); font: inherit; font-size: .875rem; }
.help-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.help-form button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 12px; flex: none; }
.help-form button .icon { width: 17px; height: 17px; }
.help-typing { position: absolute; top: -26px; left: 1rem; display: none; gap: 4px; padding: 6px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.help-typing.htmx-request { display: inline-flex; }
.help-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: help-dot 1s infinite ease-in-out; }
.help-typing span:nth-child(2) { animation-delay: .15s; }
.help-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes help-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.help-foot { margin: 0; padding: 0 .9rem .6rem; font-size: .7rem; }
@media (max-width: 900px) { .help-widget { right: 1rem; bottom: 1rem; } }
@media (prefers-reduced-motion: reduce) { .help-typing span { animation: none; } }

/* ============ Import: quote or invoice choice ============ */
.save-as { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .25rem 0 .25rem; }
.save-as .label { font-size: .85rem; font-weight: 550; color: var(--text-2); margin-right: .25rem; }
.save-as .muted { display: inline-flex; align-items: center; gap: .3rem; }
.save-as .muted .icon { width: 14px; height: 14px; }
.pick-chip { position: relative; cursor: pointer; }
.pick-chip input { position: absolute; opacity: 0; pointer-events: none; }
.pick-chip span { display: inline-flex; align-items: center; gap: .4rem; height: 32px; padding: 0 .8rem; border: 1px solid var(--border-strong); border-radius: 999px; font-size: .85rem; font-weight: 550; color: var(--text-2); background: var(--surface); }
.pick-chip span .icon { width: 15px; height: 15px; }
.pick-chip:has(input:checked) span { border-color: var(--accent); background: var(--accent-soft); color: var(--text); box-shadow: var(--ring); }
.pick-chip:has(input:focus-visible) span { outline: 2px solid var(--accent); outline-offset: 2px; }
.payment-choice { display: flex; flex-direction: column; gap: .5rem; margin-top: .75rem; }
.payment-choice legend { font-size: .85rem; font-weight: 550; margin-bottom: .4rem; }
.paid-amount { margin: -.15rem 0 .15rem 2rem; max-width: 220px; }

/* ============ Import: spreadsheets ============ */
.chip-list { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0 0 .6rem; padding: 0; }
.chip { display: inline-flex; align-items: center; gap: .2rem; height: 26px; padding: 0 .65rem; border-radius: 999px; font-size: .8rem; background: var(--surface-3); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); }
.chip.required { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.sheet-mapping { margin-bottom: 1.25rem; }
.sheet-mapping .section-title { margin-top: 0; }
.mapping-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: .25rem 1rem; margin: .75rem 0 1rem; }
.mapping-field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .75rem; }
.mapping-field label { font-size: .8125rem; font-weight: 550; }
.mapping-field.is-matched select { border-color: color-mix(in srgb, var(--ok) 45%, var(--border-strong)); }
.required-mark { color: var(--danger); }
.sheet-option { max-width: 560px; }
.sheet-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 0 0 1rem; }
.sum-card { display: flex; flex-direction: column; gap: .1rem; padding: .8rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.sum-card strong { font-size: 1.4rem; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text); }
.sum-card span { font-size: .8rem; color: var(--muted); }
.sum-card.add strong { color: var(--ok); }
.sum-card.update strong { color: var(--accent); }
.sum-card.problem strong { color: var(--danger); }
.sheet-table td { vertical-align: top; }
.sheet-row.skip td { color: var(--muted); }
.sheet-message { display: block; margin-top: .25rem; font-size: .75rem; color: var(--muted); }
.sheet-row.problem .sheet-message { color: var(--danger); }
.badge.sheet-add { background: var(--ok-soft); color: var(--ok); }
.badge.sheet-update { background: var(--accent-soft); color: var(--accent); }
.badge.sheet-problem { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 640px) { .sheet-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ============ Support ============ */
.support-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 1.5rem; align-items: start; }
.kind-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: .6rem; }
.kind-choice { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .55rem; padding: .85rem; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; font-weight: 550 !important; font-size: .85rem !important; color: var(--text) !important; transition: border-color .15s, box-shadow .15s; }
.kind-choice:hover { border-color: var(--faint); }
.kind-choice input { position: absolute; opacity: 0; pointer-events: none; }
.kind-choice:has(input:checked) { border-color: var(--accent); box-shadow: var(--ring); }
.kind-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.kind-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.kind-icon .icon { width: 17px; height: 17px; }
.side-card h2 { display: flex; align-items: center; gap: .45rem; font-size: .9rem; margin: 0 0 .4rem; }
.side-card h2 .icon { width: 16px; height: 16px; color: var(--accent); }
.side-card p { margin: 0 0 .75rem; }
.mini-requests { list-style: none; margin: 0 0 .75rem; padding: 0; display: flex; flex-direction: column; gap: .5rem; font-size: .85rem; }
.mini-requests li { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.mini-requests a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.support-new { background: var(--accent-soft); color: var(--accent); }
.badge.support-in_progress { background: var(--warn-soft); color: var(--warn); }
.badge.support-done { background: var(--ok-soft); color: var(--ok); }
.filter-tabs { margin-bottom: 1rem; }
.support-list .import-icon.kind-bug { background: var(--danger-soft); color: var(--danger); }
.support-list .import-icon.kind-idea { background: var(--warn-soft); color: var(--warn); }
.support-list .import-icon.kind-question { background: var(--accent-soft); color: var(--accent); }
.support-steps { display: flex; gap: .5rem; list-style: none; margin: 0 0 1.25rem; padding: 0; counter-reset: step; }
.support-steps li { flex: 1; position: relative; padding: .55rem .75rem; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: .8125rem; font-weight: 550; text-align: center; }
.support-steps li.passed { background: var(--ok-soft); color: var(--ok); }
.support-steps li.current { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); }
.support-message p:first-child { margin-top: 0; white-space: normal; }
.support-shot img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin-top: .5rem; }
@media (max-width: 900px) { .support-layout { grid-template-columns: 1fr; } }

/* ============ Sign-up, one question at a time (templates/accounts/signup.html) ============ */
.signup-step { border: 0; margin: 0; padding: 0; min-width: 0; }
.signup-step legend { padding: 0; margin: 0 0 1rem; font-family: "Fraunces", Georgia, serif; font-size: 1.35rem; font-weight: 560; line-height: 1.25; letter-spacing: -.01em; color: var(--text); }
/* Without JavaScript all questions show, one after another. */
.signup-steps:not(.is-stepped) .signup-step + .signup-step { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
/* With it, one at a time; the question already names the box, so a lone label is for screen readers. */
.signup-steps.is-stepped .signup-step:not(.is-current) { display: none; }
.signup-steps.is-stepped .signup-step.single .field > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.signup-step.is-current { animation: step-in .22s var(--ease) both; }
@keyframes step-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.step-progress { margin: 0 0 .5rem; font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.step-bar { height: 4px; margin: 0 0 1.75rem; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.step-bar span { display: block; height: 100%; width: 0; background: var(--accent-btn); border-radius: inherit; transition: width .25s var(--ease); }
.no-sidebar .narrow .step-actions { display: flex; gap: .6rem; }
.no-sidebar .narrow .step-actions button { flex: 1; width: auto; }
.no-sidebar .narrow .step-actions button[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .signup-step.is-current { animation: none; } .step-bar span { transition: none; } }

/* ============ Subscription (templates/billing/) ============ */
.billing-notice { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .6rem .9rem; margin: 0 0 1.25rem; border-radius: var(--radius); border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--text); font-size: .875rem; }
.billing-notice .icon { width: 16px; height: 16px; color: var(--accent); }
.billing-notice a { margin-left: auto; display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; }
.billing-notice a .icon { width: 14px; height: 14px; }
.billing-notice.billing-warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); }
.billing-notice.billing-warn .icon:first-child { color: var(--warn); }
.billing-status h2 { margin: 0 0 .35rem; font-size: 1.05rem; }
.billing-status p { margin: 0; color: var(--text-2); max-width: 70ch; }
.billing-status.billing-locked { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.billing-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1.25rem 0 1rem; }
.billing-plan { display: flex; flex-direction: column; padding: 1.4rem 1.4rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.billing-plan.is-recommended { border-color: var(--accent-line); }
.billing-plan.is-current { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok), var(--shadow-sm); }
.billing-plan-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.billing-plan h3 { margin: 0; font-size: 1.05rem; }
.billing-price { margin: .9rem 0 .2rem; }
.billing-price strong { font-size: 1.75rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.billing-price span { color: var(--muted); font-size: .875rem; }
.billing-plan ul { list-style: none; margin: .9rem 0 1.25rem; padding: 0; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.billing-plan li { display: flex; gap: .5rem; align-items: flex-start; font-size: .875rem; color: var(--text-2); }
.billing-plan li .icon { width: 15px; height: 15px; margin-top: 2px; color: var(--ok); flex: none; }
.billing-plan form, .billing-plan > button { margin: 0; }
.billing-plan button { width: 100%; }
.billing-plan .helptext { margin: .5rem 0 0; }
.billing-fine { max-width: 80ch; }
@media (max-width: 900px) { .billing-plans { grid-template-columns: minmax(0, 1fr); } }
