/* SheetCRM — standalone SaaS interface */
:root {
	--bg: #f5f4ef;
	--surface: #ffffff;
	--surface-2: #fbfaf6;
	--surface-3: #f1f1ea;
	--ink: #16211b;
	--ink-2: #3c473f;
	--muted: #6f7a72;
	--line: #e5e5dc;
	--line-strong: #d5d6ca;
	--brand: #2f6f4f;
	--brand-strong: #23533c;
	--brand-soft: #e6f0e9;
	--brand-tint: #f0f6f2;
	--accent: #d98247;
	--danger: #bb4b4b;
	--danger-soft: #fbecec;
	--warn: #b07d24;
	--ok: #2f7a52;
	--violet: #6f5bb5;
	--blue: #3767b3;
	--sidebar: #12211a;
	--sidebar-2: #182c22;
	--sidebar-ink: #e8efe9;
	--sidebar-muted: #94a79b;
	--radius: 14px;
	--radius-sm: 9px;
	--shadow: 0 1px 2px rgba(20, 32, 25, .05), 0 8px 24px -18px rgba(20, 32, 25, .35);
	--shadow-lg: 0 24px 64px -24px rgba(12, 24, 18, .35), 0 2px 6px rgba(12, 24, 18, .06);
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
	--sidebar-w: 252px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
	margin: 0;
	font-family: var(--font);
	font-size: 14px;
	line-height: 1.5;
	background: var(--bg);
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
::selection { background: #cfe3d7; }
:focus-visible { outline: 2px solid #79a58c; outline-offset: 2px; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; }
.boot-mark {
	width: 46px; height: 46px; border-radius: 13px;
	background: #2f6f4f url("mark.svg") center / contain no-repeat;
	animation: boot-pulse 1.4s ease-in-out infinite;
}
.boot-text { color: var(--muted); font-size: 13px; letter-spacing: .01em; }
@keyframes boot-pulse { 0%, 100% { transform: scale(1); opacity: 1 } 50% { transform: scale(.92); opacity: .7 } }

/* ---------------------------------------------------------------- Shell */
/* The dark column is painted on the shell itself. A sticky sidebar only ever
   covers one viewport, so on a long page the strip below it would show the page
   background; this keeps the column flush to the bottom of the document. */
.app {
	display: flex; min-height: 100vh;
	background: linear-gradient(to right, var(--sidebar) 0 var(--sidebar-w), var(--bg) var(--sidebar-w));
}
.sidebar {
	width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
	background: var(--sidebar); color: var(--sidebar-ink);
	display: flex; flex-direction: column; gap: 6px;
	position: sticky; top: 0; height: 100vh; padding: 18px 14px 14px;
	z-index: 40;
	/* A short window must not swallow the last nav item or the sign-out button:
	   the sidebar scrolls on its own instead of clipping them. */
	overflow-y: auto; overscroll-behavior: contain;
	scrollbar-width: thin; scrollbar-color: #2c4436 transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #2c4436; border-radius: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar > * { flex: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 14px; }
.brand-mark {
	width: 30px; height: 30px; border-radius: 9px; flex: none;
	background: #2f6f4f url("mark.svg") center / contain no-repeat;
}
.brand-name { font-weight: 650; letter-spacing: -.02em; font-size: 15.5px; color: #f4f8f5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-name span { color: #86b89c; font-weight: 500; }
.brand-logo { height: 26px; max-width: 128px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px; }

.brand-preview { display: flex; align-items: center; gap: 12px; }
.brand-preview-logo { height: 46px; max-width: 120px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line, #e2e5e2); background: #fff; padding: 4px; }
.brand-preview-mark { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand, #2f6f4f); color: #fff; font-weight: 650; font-size: 15px; letter-spacing: .02em; }

.ws-switch {
	display: flex; align-items: center; gap: 9px; width: 100%;
	background: var(--sidebar-2); color: var(--sidebar-ink);
	border: 1px solid #26392e; border-radius: 11px; padding: 9px 10px;
	text-align: left; transition: background .15s ease;
}
.ws-switch:hover { background: #20362a; }
.ws-avatar {
	width: 27px; height: 27px; border-radius: 8px; flex: none;
	background: #dcece1; color: #24503a; font-weight: 700; font-size: 11px;
	display: grid; place-content: center; letter-spacing: -.02em;
}
.ws-meta { min-width: 0; flex: 1; }
.ws-meta strong { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-meta small { display: block; font-size: 10.5px; color: var(--sidebar-muted); text-transform: capitalize; }
.ws-switch .chev { color: var(--sidebar-muted); }

/* Workspace switcher menu */
.ws-menu {
	background: var(--sidebar-2); border: 1px solid #2b4233; border-radius: 11px;
	padding: 5px; margin: 6px 0 2px; box-shadow: 0 16px 40px -20px #000;
}
.ws-menu-head { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: #6f8579; padding: 6px 9px 5px; }
.ws-menu-list { display: flex; flex-direction: column; gap: 1px; max-height: min(46vh, 320px); overflow-y: auto; scrollbar-width: thin; }
.ws-menu-list::-webkit-scrollbar { width: 8px; }
.ws-menu-list::-webkit-scrollbar-thumb { background: #2c4436; border-radius: 8px; }
.ws-menu-item {
	display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent;
	color: #e9f1eb; border-radius: 8px; padding: 7px 8px; text-align: left;
	font: inherit; font-size: 12px; cursor: pointer; transition: background .12s ease;
}
.ws-menu-item:hover { background: #22392b; }
.ws-menu-item.is-current { background: #294534; }
.ws-menu-item:focus-visible { outline: 2px solid #79a58c; outline-offset: -2px; }
.ws-menu-text { flex: 1; min-width: 0; }
.ws-menu-text strong { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-menu-text small { display: block; font-size: 10.5px; color: var(--sidebar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-menu-check { color: #8fd0a9; display: grid; place-content: center; flex: none; }
.ws-menu-sep { height: 1px; background: #2b4233; margin: 5px 2px; }
.ws-menu-new { color: #a9c6b3; padding-top: 8px; }
.ws-menu-plus { width: 27px; height: 27px; border-radius: 8px; display: grid; place-content: center; background: #22392b; color: #a9c6b3; flex: none; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.nav-group { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: #6f8579; padding: 16px 10px 6px; }
.nav-item {
	display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
	color: #c9d6cd; font-size: 13px; font-weight: 500; transition: background .14s ease, color .14s ease;
}
.nav-item:hover { background: #1d3327; color: #f1f7f2; text-decoration: none; }
.nav-item.active { background: #284634; color: #ffffff; }
.nav-item .ico { opacity: .78; flex: none; }
.nav-item.active .ico { opacity: 1; }
.nav-count {
	margin-left: auto; font-size: 10.5px; color: #a9bdaf; background: #20382a;
	padding: 1px 7px; border-radius: 20px; font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-count { background: #35604a; color: #e6f3ea; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 14px; }
.sidebar-tip {
	background: linear-gradient(155deg, #1e3a2a, #172b20); border: 1px solid #26402f;
	border-radius: 12px; padding: 12px; color: #b9cbbf; font-size: 11.5px; line-height: 1.45;
}
.sidebar-tip strong { display: block; color: #eaf4ed; font-size: 12px; margin-bottom: 3px; }
.sidebar-tip a { color: #9ecfb2; font-size: 11.5px; }
.user-card {
	display: flex; align-items: center; gap: 9px; border-top: 1px solid #22362a;
	padding: 12px 6px 2px;
}
.user-card .doc { min-width: 0; flex: 1; }
.user-card strong { display: block; color: #edf4ef; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card small { color: var(--sidebar-muted); font-size: 10.5px; text-transform: capitalize; }
.user-card .btn-logout {
	background: transparent; border: 0; color: #8ea496; padding: 4px; border-radius: 6px; line-height: 0;
}
.user-card .btn-logout:hover { color: #f0f6f1; background: #22382b; }

.avatar {
	width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft);
	color: var(--brand-strong); font-size: 10.5px; font-weight: 700; letter-spacing: -.02em;
	display: inline-grid; place-content: center; flex: none; border: 1px solid transparent;
}
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.avatar.lg { width: 38px; height: 38px; font-size: 12.5px; }
.avatar.stack { background: #fff; box-shadow: 0 0 0 2px var(--surface); }
.avatar[data-tone="1"] { background: #f2e3d3; color: #8a5322; }
.avatar[data-tone="2"] { background: #e3e6f4; color: #3f4d8f; }
.avatar[data-tone="3"] { background: #e2efe8; color: #2c6647; }
.avatar[data-tone="4"] { background: #f1e0e4; color: #8d3c4d; }
.avatar[data-tone="5"] { background: #e9e3f2; color: #5b4385; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
	height: 58px; flex: none; display: flex; align-items: center; gap: 14px;
	padding: 0 26px; border-bottom: 1px solid var(--line);
	background: rgba(255, 255, 255, .82); backdrop-filter: blur(10px);
	position: sticky; top: 0; z-index: 30;
}
.hamburger { display: none; background: transparent; border: 0; padding: 6px; color: var(--ink-2); border-radius: 8px; }
.hamburger:hover { background: var(--surface-3); }
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.crumbs strong { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { opacity: .55; }
.topbar-spacer { flex: 1; }
.global-search {
	display: flex; align-items: center; gap: 8px; width: 260px; max-width: 34vw;
	background: var(--surface-3); border: 1px solid transparent; border-radius: 9px;
	padding: 6px 10px; color: var(--muted); font-size: 12.5px; text-align: left;
	transition: background .15s ease, border-color .15s ease;
}
.global-search:hover { background: #ecece3; }
.global-search kbd {
	margin-left: auto; font-family: var(--font); font-size: 10px; color: #828c84;
	background: #fff; border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 5px;
}
.topbar .btn-new { white-space: nowrap; }

.content { padding: 24px 26px 56px; max-width: 1360px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; letter-spacing: -.03em; font-weight: 650; line-height: 1.2; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.page-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 6px; }

/* -------------------------------------------------------------- Buttons */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px;
	border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
	border-radius: 9px; padding: 7px 12px; font-size: 12.5px; font-weight: 560;
	line-height: 1.35; white-space: nowrap; transition: background .14s ease, border-color .14s ease, transform .1s ease, color .14s;
}
.btn:hover { background: var(--surface-2); border-color: #c6c8ba; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn .ico { flex: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(24, 60, 42, .25); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); }
.btn.soft:hover { background: #d9e9df; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--danger); border-color: #eccccc; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.icon { width: 32px; height: 32px; padding: 0; }
.btn.sm { padding: 5px 9px; font-size: 11.5px; border-radius: 8px; }
.btn.link { border: 0; background: none; padding: 0; color: var(--brand); font-weight: 600; font-size: 12.5px; }
.btn.link:hover { text-decoration: underline; }

/* --------------------------------------------------------------- Inputs */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.label { font-size: 11.5px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.label .req { color: var(--danger); }
.hint { font-size: 11.5px; color: var(--muted); }
.input, .select, textarea.input {
	width: 100%; background: #fff; border: 1px solid var(--line-strong); border-radius: 9px;
	padding: 8px 10px; font-size: 13px; color: var(--ink); transition: border-color .14s ease, box-shadow .14s ease;
}
.input:focus, .select:focus, textarea.input:focus {
	border-color: #8fb5a0; box-shadow: 0 0 0 3px rgba(47, 111, 79, .12); outline: none;
}
.input::placeholder { color: #a3aba4; }
textarea.input { min-height: 84px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236f7a72' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.input.sm, .select.sm { padding: 5px 8px; font-size: 12px; border-radius: 7px; }
.input.err, .select.err { border-color: #d9a3a3; }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { background: var(--danger-soft); color: #8f3535; border: 1px solid #efd2d2; padding: 9px 11px; border-radius: 9px; font-size: 12.5px; }
.plan-picks { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
.plan-pick { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fff; cursor: pointer; }
.plan-pick > span { display: flex; flex-direction: column; min-width: 0; }
.plan-pick strong { font-size: 12.5px; color: var(--ink); }
.plan-pick small { font-size: 10.5px; color: var(--muted); }
.plan-pick input { accent-color: var(--brand); margin: 0; flex: none; }
.plan-pick:has(input:checked) { border-color: #9dbfaa; background: var(--brand-tint); box-shadow: 0 0 0 2px rgba(47, 111, 79, .1); }
.plan-pick.is-disabled { opacity: .55; cursor: not-allowed; }
label.check, .check-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
label.check input, .check-label input { width: 15px; height: 15px; flex: none; margin: 0; accent-color: var(--brand); }
.radio-group { display: flex; flex-direction: column; gap: 6px; }
div.check-group { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.switch { position: relative; width: 34px; height: 19px; flex: none; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; background: #d7d9cf; border-radius: 20px; transition: background .16s ease; }
.switch span::after { content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; background: #fff; left: 2px; top: 2px; transition: transform .16s ease; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(15px); }

/* ---------------------------------------------------------------- Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.card-head h3 { font-size: 13.5px; font-weight: 620; letter-spacing: -.01em; }
.card-head .sub { font-size: 11.5px; color: var(--muted); }
.card-head .spacer { flex: 1; }
.card-body { padding: 14px 16px 16px; }
.card-foot { border-top: 1px solid var(--line); padding: 10px 16px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 15px; font-weight: 630; letter-spacing: -.02em; }
.section-head .spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ----------------------------------------------------------------- KPI */
.kpi { padding: 15px 16px; display: flex; flex-direction: column; gap: 6px; min-height: 108px; position: relative; overflow: hidden; }
.kpi-label { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; font-weight: 560; }
.kpi-value { font-size: 24px; font-weight: 650; letter-spacing: -.035em; line-height: 1.1; }
.kpi-foot { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: auto; }
.kpi-delta { color: var(--ok); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.kpi-delta.down { color: var(--danger); }
.spark { position: absolute; right: 12px; bottom: 10px; opacity: .85; height: 38px; }

/* -------------------------------------------------------------- Toolbar */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.toolbar .search-box { flex: 1 1 200px; min-width: 160px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 5px 9px; background: var(--surface-2); }
.toolbar .search-box input { border: 0; background: none; outline: none; flex: 1; font-size: 12.5px; min-width: 0; }
.toolbar .search-box .ico { color: var(--muted); }
/* Custom date window: two small date fields in one pill, so the pair reads as
   a single filter rather than two stray inputs. */
.date-range {
	display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px;
	border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
}
.date-range input[type="date"] {
	border: 0; background: none; padding: 2px 0; font-size: 12px; color: var(--ink);
	font-family: inherit; min-width: 116px;
}
.date-range input[type="date"]:focus { outline: none; }
.date-range .to { font-size: 11.5px; color: var(--muted); }
@media (max-width: 720px) {
	.date-range { width: 100%; justify-content: space-between; }
	.date-range input[type="date"] { min-width: 0; flex: 1; }
}
.filter-chip {
	display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong);
	background: var(--surface); border-radius: 20px; padding: 4px 10px; font-size: 11.5px; color: var(--ink-2);
}
.filter-chip:hover { background: var(--surface-2); }
.filter-chip.active { background: var(--brand-soft); border-color: #bcd5c6; color: var(--brand-strong); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 6px; padding: 4px 9px; font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20,32,25,.1); font-weight: 560; }
.seg button:hover:not(.active) { color: var(--ink-2); }

/* --------------------------------------------------------------- Tables */
.table-wrap { overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.data th {
	position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left;
	font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600;
	padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--ink-2); }
table.data th .sort-ind { color: var(--brand); margin-left: 3px; }
table.data th.check, table.data td.check { width: 40px; padding: 0; text-align: center; vertical-align: middle; }
table.data .row-check {
	display: flex; align-items: center; justify-content: center;
	width: 100%; min-height: 36px; padding-left: 6px; cursor: pointer;
}
table.data th.check .row-check { padding: 9px 0 9px 6px; min-height: 0; }
table.data .row-check input { width: 15px; height: 15px; margin: 0; flex: none; display: block; accent-color: var(--brand); cursor: pointer; }
table.data td { padding: 0; border-bottom: 1px solid #eeeee7; vertical-align: middle; }
table.data tbody tr:hover td { background: #fbfbf6; }
table.data tbody tr.selected td { background: var(--brand-tint); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .cell { padding: 7px 10px; min-height: 38px; display: flex; align-items: center; gap: 7px; min-width: 0; }
table.data .cell.editable { cursor: text; border-radius: 5px; }
table.data .cell.editable:hover { background: #f2f2ea; }
table.data .cell .val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data td.money .cell { justify-content: flex-end; font-variant-numeric: tabular-nums; }
table.data .primary-cell { font-weight: 560; color: var(--ink); }
table.data .primary-cell .type-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
table.data .input.inline { border: 1px solid #9dbfaa; border-radius: 6px; padding: 4px 6px; font-size: 12.5px; width: 100%; box-shadow: 0 0 0 3px rgba(47,111,79,.1); }
table.data tbody tr .row-hover-actions { opacity: 0; transition: opacity .12s; }
table.data tbody tr:hover .row-hover-actions { opacity: 1; }
.pager { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.pager .spacer { flex: 1; }
.bulkbar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--brand-soft); border-bottom: 1px solid #cfe2d6; font-size: 12px; color: var(--brand-strong); flex-wrap: wrap; }

/* ---------------------------------------------------------------- Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 2px 8px; font-size: 11px; font-weight: 560; line-height: 1.55; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); border: 1px solid transparent; }
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.blue { background: #eaf1fb; color: #33599a; }
.pill.green { background: #e6f2ea; color: #2c6b49; }
.pill.amber { background: #fbf1dd; color: #916018; }
.pill.red { background: #fbeaea; color: #9c3b3b; }
.pill.violet { background: #efeaf9; color: #604a9a; }
.pill.slate { background: #eef0ec; color: #5b665e; }
.pill.outline { background: transparent; border-color: var(--line-strong); color: var(--muted); }
.type-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }

/* ---------------------------------------------------------------- Board */
.board { display: flex; gap: 12px; overflow-x: auto; padding: 14px 2px 20px; align-items: flex-start; min-height: 380px; }
.lane { flex: 0 0 268px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; max-height: 70vh; display: flex; flex-direction: column; }
.lane.drop-target { border-color: #9fc3ad; background: var(--brand-tint); }
.lane-head { display: flex; align-items: center; gap: 7px; padding: 10px 11px; border-bottom: 1px solid var(--line); }
.lane-head .title { font-size: 12px; font-weight: 620; display: flex; align-items: center; gap: 6px; }
.lane-count { font-size: 10.5px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 0 6px; }
.lane-sum { margin-left: auto; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lane-body { padding: 8px; display: flex; flex-direction: column; gap: 7px; overflow-y: auto; min-height: 60px; }
.mini-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; cursor: grab; box-shadow: 0 1px 1px rgba(20,32,25,.04); transition: box-shadow .14s, transform .14s; }
.mini-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.mini-card.dragging { opacity: .45; }
.mini-card .title { font-size: 12.5px; font-weight: 560; line-height: 1.35; }
.mini-card .meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 10.5px; color: var(--muted); flex-wrap: wrap; }
.mini-card .mini-amount { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; font-size: 11.5px; }
.lane-empty { font-size: 11px; color: var(--muted); text-align: center; padding: 14px 6px; border: 1px dashed var(--line-strong); border-radius: 9px; }

/* ------------------------------------------------------------- Calendar */
.cal-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cal-head h3 { font-size: 14px; font-weight: 620; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal-day { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px; display: flex; flex-direction: column; gap: 3px; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: #fafaf5; color: #a9b0a9; }
.cal-day.today { background: var(--brand-tint); }
.cal-date { font-size: 11px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 4px; }
.cal-day.today .cal-date span { background: var(--brand); color: #fff; border-radius: 50%; width: 19px; height: 19px; display: grid; place-content: center; font-size: 10.5px; }
.cal-day.other .cal-date { color: #a9b0a9; }
.cal-event { font-size: 10.5px; padding: 2px 5px; border-radius: 5px; background: #e6f0e9; color: #285c41; border-left: 2px solid #4f8b68; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; text-align: left; }
.cal-event.task { background: #f6ecdf; border-left-color: #c58a4a; color: #7c5424; }
.cal-event.deal { background: #e9eff9; border-left-color: #5279bb; color: #33528a; }

/* --------------------------------------------------------------- Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(16, 26, 20, .28); backdrop-filter: blur(1px); z-index: 50; animation: fade-in .16s ease; }
.drawer {
	position: fixed; top: 0; right: 0; height: 100vh; width: min(470px, 100%); background: var(--surface);
	z-index: 51; box-shadow: -18px 0 48px -30px rgba(10, 20, 14, .5); display: flex; flex-direction: column;
	animation: slide-in .2s cubic-bezier(.2,.8,.3,1);
}
.drawer-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 10px; }
.drawer-head h2 { font-size: 18px; font-weight: 640; letter-spacing: -.02em; line-height: 1.25; }
.drawer-head .sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 10px 18px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); }
.drawer-section { margin-bottom: 20px; }
.drawer-section h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 9px; font-weight: 650; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kv { min-width: 0; }
.kv .k { font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.kv .v { font-size: 12.5px; color: var(--ink); overflow-wrap: anywhere; }
.kv .v.empty { color: #b3baB3; }

/* ---------------------------------------------------------------- Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16, 26, 20, .32); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; animation: fade-in .15s ease; }
.modal { background: var(--surface); width: min(560px, 100%); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop-in .18s cubic-bezier(.2,.8,.3,1); border: 1px solid var(--line); display: flex; flex-direction: column; max-height: 88vh; }
.modal > .modal-head, .modal > .modal-foot { flex: 0 0 auto; }
.modal > .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; font-weight: 640; letter-spacing: -.02em; }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 16px 16px; }
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes slide-in { from { transform: translateX(24px); opacity: .6 } to { transform: none; opacity: 1 } }
@keyframes pop-in { from { transform: translateY(8px) scale(.99); opacity: 0 } to { transform: none; opacity: 1 } }

/* ----------------------------------------------------------------- Misc */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-art { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px; background: var(--brand-tint); display: grid; place-content: center; color: var(--brand); border: 1px solid #d6e6dc; }
.empty h3 { font-size: 15px; color: var(--ink); font-weight: 620; margin-bottom: 4px; letter-spacing: -.01em; }
.empty p { font-size: 12.5px; max-width: 380px; margin: 0 auto 14px; }
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: #1c2c22; color: #edf5ef; padding: 9px 13px; border-radius: 9px; font-size: 12.5px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; animation: pop-in .18s ease; max-width: 340px; }
.toast.error { background: #792c2c; }
.toast.success { background: #205b3f; }
.skeleton { background: linear-gradient(90deg, #eeece5 25%, #f6f4ee 37%, #eeece5 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 6px; height: 12px; }
@keyframes shimmer { from { background-position: 100% 0 } to { background-position: 0 0 } }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn:not(.primary) .spinner { border-color: #b9c6bd; border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg) } }
.banner { display: flex; align-items: center; gap: 10px; background: #fdf5e4; border: 1px solid #f0dfb8; color: #7c5a15; border-radius: 10px; padding: 8px 12px; font-size: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.banner.error { background: var(--danger-soft); border-color: #ecc9c9; color: #8c3535; }
.banner .spacer { flex: 1; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mobile-bar { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 1120px) {
	.grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
	.grid-2, .grid-3 { grid-template-columns: 1fr; }
	.content { padding: 18px 16px 48px; }
	.topbar { padding: 0 16px; height: 54px; }
	.global-search { width: auto; }
	.global-search span.label-text { display: none; }
	.drawer { width: 100%; }
}
@media (max-width: 780px) {
	:root { --sidebar-w: 268px; }
	/* The painted column belongs to the sticky desktop sidebar only. On a phone
	   the sidebar slides in over the page, so leaving the gradient on would put
	   a dark band down the left of every screen. */
	.app { background: var(--bg); }
	/* The workspace name shrinks to nothing at this width, which used to leave a
	   dangling "/" in front of the page title. Show the page name alone. */
	.crumbs > strong, .crumbs .sep { display: none; }
	.crumbs > span:last-child { color: var(--ink); font-weight: 600; }
	.sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 60px rgba(0,0,0,.3); }
	.sidebar.open { transform: none; }
	.nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(12, 22, 16, .4); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .2s; }
	.nav-backdrop.open { opacity: 1; pointer-events: auto; }
	.hamburger { display: inline-flex; }
	.mobile-bar {
		display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 35;
		background: rgba(255,255,255,.94); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
		padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
	}
	.mobile-bar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 9.5px; color: var(--muted); padding: 3px 2px; border-radius: 8px; }
	.mobile-bar a.active { color: var(--brand); }
	.mobile-bar a:hover { text-decoration: none; background: var(--surface-2); }
	.content { padding-bottom: 84px; }
	.page-head h1 { font-size: 21px; }
	.kpi { min-height: 96px; padding: 12px 13px; }
	.kpi-value { font-size: 21px; }
	
	/* Tables become cards on small screens. */
	table.data thead { display: none; }
	table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
	table.data tr { border: 1px solid var(--line); border-radius: 11px; margin: 8px; padding: 4px; background: #fff; }
	table.data tbody tr:hover td { background: transparent; }
	table.data td { border: 0; display: flex; align-items: center; gap: 8px; padding: 3px 8px; }
	table.data td.check { width: auto; padding: 3px 8px; }
	table.data td.check .row-check { justify-content: flex-start; min-height: 24px; padding-left: 0; }
	table.data td .cell { padding: 3px 0; min-height: 24px; flex: 1; }
	table.data td[data-label]::before { content: attr(data-label); font-size: 10.5px; color: var(--muted); width: 72px; flex: none; }
	table.data td.money .cell { justify-content: flex-start; }
	table.data td.primary-cell-td { font-size: 14px; }
	.table-wrap { border-radius: 0; overflow: visible; }
	.board { padding-bottom: 6px; }
	.lane { flex-basis: 84vw; }
	.kv-grid { grid-template-columns: 1fr; }
	.form-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ Dashboard */
.hello { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.hello h1 { font-size: 26px; letter-spacing: -.035em; font-weight: 650; }
.hello .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.hello .page-actions { margin-left: auto; }
.dash-split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.chart { padding: 2px 2px 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 86px 1fr 62px; gap: 8px; align-items: center; font-size: 11.5px; }
.bar-row .name { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 7px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--brand); min-width: 3px; }
.bar-row .amt { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.donut { flex: none; }
.donut-legend { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; min-width: 120px; flex: 1; }
.donut-legend .item { display: flex; align-items: center; gap: 6px; }
.donut-legend .item .spacer { flex: 1; }
.donut-legend .sw { width: 7px; height: 7px; border-radius: 2px; }
.donut-center { font-size: 20px; font-weight: 650; letter-spacing: -.03em; }
.donut-center tspan.small { font-size: 9px; fill: #8a938b; font-weight: 500; letter-spacing: .06em; }
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px dash var(--line); }
.feed-item { border-bottom: 1px solid #f0f0e8; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .body { min-width: 0; flex: 1; font-size: 12px; color: var(--ink-2); }
.feed-item .body .who { font-weight: 600; color: var(--ink); }
.feed-item time { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.task-line { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid #f0f0e8; }
.task-line:last-child { border-bottom: 0; }
.task-check { width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid #c3cbc3; background: #fff; flex: none; display: grid; place-content: center; padding: 0; }
.task-check:hover { border-color: var(--brand); }
.task-check.done { background: var(--brand); border-color: var(--brand); color: #fff; }
.task-line .title { font-size: 12.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-line .title.done { text-decoration: line-through; color: var(--muted); }
.task-line .due { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.task-line .due.overdue { color: var(--danger); font-weight: 600; }
.object-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.object-tile { padding: 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); text-align: left; display: flex; flex-direction: column; gap: 3px; transition: border-color .14s, transform .14s, box-shadow .14s; }
.object-tile:hover { border-color: #bdd2c3; box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.object-tile .ico { color: var(--brand); margin-bottom: 3px; }
.object-tile strong { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.object-tile small { color: var(--muted); font-size: 11px; }

/* ----------------------------------------------------------- Auth screen */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); background: var(--surface); }
.auth-art { background: linear-gradient(150deg, #15271d 0%, #1e3b2b 55%, #29543d 100%); color: #eaf2ec; padding: 42px 46px; display: flex; flex-direction: column; gap: 30px; position: relative; overflow: hidden; }
.auth-art::before { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(103, 168, 129, .22), transparent 65%); top: -140px; right: -80px; }
.auth-art::after { content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(216, 152, 90, .12), transparent 70%); bottom: -100px; left: -60px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.02em; font-size: 17px; position: relative; z-index: 1; }
.auth-pitch { margin-top: 4vh; max-width: 460px; position: relative; z-index: 1; }
.auth-pitch h1 { font-size: clamp(28px, 3vw, 38px); line-height: 1.12; letter-spacing: -.04em; font-weight: 650; }
.auth-pitch h1 em { font-style: normal; color: #9fd3b4; }
.auth-pitch p { color: #b9cbbf; margin-top: 14px; font-size: 14px; line-height: 1.6; max-width: 400px; }
.auth-points { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.auth-point { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: #c9dacd; }
.auth-point .tick { width: 18px; height: 18px; border-radius: 50%; background: rgba(159, 211, 180, .16); color: #9fd3b4; display: grid; place-content: center; flex: none; margin-top: 1px; }
.auth-sheet { margin-top: auto; position: relative; z-index: 1; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255,255,255,.1); border-radius: 13px; padding: 13px; backdrop-filter: blur(4px); }
.auth-sheet .sheet-row { display: grid; grid-template-columns: 2fr 1.4fr 1fr 1.2fr; gap: 6px; padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,.07); font-size: 11px; color: #c3d4c8; align-items: center; }
.auth-sheet .sheet-row:last-child { border-bottom: 0; }
.auth-sheet .sheet-head { color: #8fae9a; font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; }
.auth-sheet .sheet-pill { padding: 1px 6px; border-radius: 12px; font-size: 9.5px; background: rgba(255,255,255,.09); color: #d9e8de; width: fit-content; }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: min(410px, 100%); }
.auth-card .eyebrow { color: var(--brand); }
.auth-card h2 { font-size: 24px; letter-spacing: -.035em; font-weight: 650; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.auth-form { display: flex; flex-direction: column; gap: 13px; }
.auth-form .btn.primary { padding: 10px 14px; font-size: 13px; }
.auth-links { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; margin-top: 4px; flex-wrap: wrap; }
.auth-switch { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); text-align: center; }
.auth-note { font-size: 11.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; }
.auth-note a { word-break: break-all; }

/* --------------------------------------------------------------- Import */
.steps { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; margin-bottom: 16px; }
.step { display: inline-flex; align-items: center; gap: 6px; }
.step .n { width: 19px; height: 19px; border-radius: 50%; background: var(--surface-3); color: var(--muted); display: grid; place-content: center; font-size: 10px; font-weight: 650; }
.step.active { color: var(--ink); font-weight: 560; }
.step.active .n { background: var(--brand); color: #fff; }
.step.done .n { background: var(--brand-soft); color: var(--brand-strong); }
.step-sep { width: 16px; height: 1px; background: var(--line-strong); }
.dropzone { border: 1.5px dashed #c8d3c9; border-radius: 14px; padding: 34px 20px; text-align: center; background: var(--brand-tint); transition: border-color .14s, background .14s; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: #eaf3ed; }
.dropzone .ico { color: var(--brand); margin-bottom: 8px; }
.dropzone h3 { font-size: 14px; font-weight: 620; margin-bottom: 3px; }
.dropzone p { font-size: 12px; color: var(--muted); }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; margin: 16px 0; }
.or-line::before, .or-line::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.map-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.map-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--line); }
.map-table td { padding: 7px 8px; border-bottom: 1px solid #f0f0e8; vertical-align: middle; }
.map-table .sample { color: var(--muted); font-size: 11px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-table .arrow { color: #b4bdb4; }
.import-preview { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.import-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 12px; }
.result-num { font-size: 26px; font-weight: 650; letter-spacing: -.03em; }
.result-label { font-size: 11.5px; color: var(--muted); }

/* ----------------------------------------------------------------- Team */
.member-list { display: flex; flex-direction: column; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid #f0f0e8; }
.member-row:last-child { border-bottom: 0; }
.member-row .who { min-width: 0; flex: 1; }
.member-row .who strong { display: block; font-size: 12.5px; font-weight: 600; }
.member-row .who small { color: var(--muted); font-size: 11px; }
.member-row .role-select { width: 116px; }
.role-matrix { width: 100%; border-collapse: collapse; font-size: 12px; }
.role-matrix th, .role-matrix td { padding: 7px 9px; border-bottom: 1px solid #f0f0e8; text-align: center; }
.role-matrix td:first-child, .role-matrix th:first-child { text-align: left; }
.role-matrix th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.role-matrix .yes { color: var(--ok); }
.role-matrix .no { color: #c9cfc8; }

/* ------------------------------------------------------------- Settings */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 9px 12px; font-size: 12.5px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--ink); border-bottom-color: var(--brand); font-weight: 570; }
.tab:hover:not(.active) { color: var(--ink-2); }

/* Settings: a grouped sidebar rather than one long row of tabs. */
.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { display: grid; gap: 18px; position: sticky; top: 76px; }
.settings-group { display: grid; gap: 1px; }
.settings-group-label { font-size: 10px; font-weight: 620; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 0 10px 5px; }
.settings-link { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.settings-link:hover { background: #f5f7f1; color: var(--ink); }
.settings-link.active { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.settings-body { min-width: 0; }

@media (max-width: 900px) {
	/* Phones: the same groups run across, so the section still reads in order. */
	.settings-layout { grid-template-columns: 1fr; gap: 14px; }
	.settings-nav { position: static; display: flex; gap: 14px; overflow-x: auto; padding-bottom: 7px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
	.settings-nav::-webkit-scrollbar { display: none; }
	.settings-group { display: flex; align-items: center; gap: 2px; flex: none; }
	.settings-group-label { padding: 0 5px 0 0; white-space: nowrap; }
	.settings-link { padding: 6px 9px; }
}
.setting-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid #f0f0e8; }
.setting-row:last-child { border-bottom: 0; }
.setting-row .desc { flex: 1; min-width: 0; }
.setting-row .desc strong { font-size: 12.5px; font-weight: 600; display: block; }
.setting-row .desc small { color: var(--muted); font-size: 11.5px; }
/* A row that is itself a link to a document: no underline, the arrow hints. */
.setting-link { text-decoration: none; color: inherit; border-radius: 8px; padding-left: 6px; padding-right: 6px; margin: 0 -6px; }
.setting-link:hover { background: #f7f8f4; text-decoration: none; }
.setting-link:hover .desc strong { color: var(--brand); }
.field-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid #f0f0e8; }
.field-row:last-child { border-bottom: 0; }
.field-row .fname { flex: 1; min-width: 0; }
.field-row .fname strong { font-size: 12.5px; font-weight: 560; display: block; }
.field-row .fname small { color: var(--muted); font-size: 10.5px; }
.field-row .ftype { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; white-space: nowrap; }

/* Field sections: the headings a record form is built from. */
.field-section { margin-bottom: 14px; }
.field-section:last-child { margin-bottom: 0; }
.field-section-head { display: flex; align-items: center; gap: 8px; padding: 7px 0 5px; border-bottom: 1px solid var(--line); }
.field-section-head strong { font-size: 11px; font-weight: 620; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.field-section-head .grip { color: var(--muted); display: inline-flex; }
.field-row .grip { color: #c9c9bd; display: inline-flex; cursor: grab; }
.field-row[draggable="true"]:hover { background: #fafaf4; }
.field-row.dragging { opacity: .4; }
.field-row.drop-before { box-shadow: inset 0 2px 0 var(--brand); }
.field-row.drop-after { box-shadow: inset 0 -2px 0 var(--brand); }
/* Section wrappers stay out of the grid; hiding one hides its heading too. */
.form-block { display: contents; }
.form-section { display: flex; align-items: center; gap: 9px; margin: 10px 0 -2px; }
.form-section:first-child { margin-top: 0; }
.form-section span { font-size: 10.5px; font-weight: 620; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field-section.dragging { opacity: .5; }
.field-section.drop-before { box-shadow: inset 0 2px 0 var(--brand); }
.field-section.drop-after { box-shadow: inset 0 -2px 0 var(--brand); }
.field-section-head .grip { cursor: grab; }
.section-move { display: flex; gap: 0; }
.section-move .btn.icon { padding: 3px; color: var(--muted); }
.section-move .btn.icon:disabled { opacity: .3; }
.stage-picker { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 4px 0 2px; }
.stage-picker .check.tiny { font-size: 12px; }
.kv-group { grid-column: 1 / -1; margin: 6px 0 -4px; font-size: 10.5px; font-weight: 620; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kv-grid > .kv-group:first-child { margin-top: 0; }
.danger-zone { border-color: #efd2d2; }
.danger-zone .card-head h3 { color: var(--danger); }

/* ------------------------------------------------------- Command palette */
.palette-backdrop { position: fixed; inset: 0; background: rgba(14, 24, 18, .35); z-index: 70; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; animation: fade-in .14s ease; }
.palette { width: min(620px, 100%); background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 9px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.palette-input input { border: 0; outline: none; flex: 1; font-size: 14px; background: none; }
.palette-input kbd { font-family: var(--font); font-size: 10px; border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--muted); }
.palette-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.palette-group { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 9px 9px 4px; }
.palette-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 12.5px; }
.palette-item:hover, .palette-item.active { background: var(--surface-3); }
.palette-item .ico { color: var(--muted); }
.palette-item .spacer { flex: 1; }
.palette-item .pill { font-size: 10px; }
.palette-foot { display: flex; gap: 12px; padding: 7px 14px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 10.5px; color: var(--muted); }
.palette-foot kbd { font-family: var(--font); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; background: #fff; }

@media (max-width: 980px) {
	.auth { grid-template-columns: 1fr; }
	.auth-art { display: none; }
	.auth-side { min-height: 100vh; padding: 32px 20px; }
	.dash-split { grid-template-columns: 1fr; }
	.object-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.grid-kpi { grid-template-columns: 1fr 1fr; gap: 9px; }
	.kpi { min-height: 92px; }
	.kpi-value { font-size: 19px; }
	.import-options { grid-template-columns: 1fr; }
	.member-row .role-select { width: 96px; }
	.page-actions { width: 100%; margin-left: 0; }
	.hello .page-actions { width: auto; }
	.toolbar { padding: 9px; }
	.pager { justify-content: center; }
	.cal-day { min-height: 76px; padding: 3px; }
	.cal-event { font-size: 9px; }
}



/* ---------------------------------------------- reminders & profiles */
.bell-btn {
	position: relative;
	display: inline-grid;
	place-content: center;
	width: 34px;
	height: 34px;
	border-radius: 9px;
	border: 1px solid var(--line);
	background: var(--surface);
	color: var(--ink-2);
	cursor: pointer;
	flex: none;
}
.bell-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.bell-btn.has-due { border-color: #e3c9a4; background: #fdf7ee; color: var(--warn); }
.bell-btn.active { border-color: var(--brand); color: var(--brand); }
.bell-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	min-width: 16px;
	height: 16px;
	padding: 0 3px;
	border-radius: 9px;
	background: var(--danger);
	color: #fff;
	font-size: 9.5px;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
}
.bell-panel {
	position: fixed;
	top: 58px;
	right: 18px;
	width: 340px;
	max-width: calc(100vw - 24px);
	max-height: min(70vh, 520px);
	display: flex;
	flex-direction: column;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 14px;
	box-shadow: 0 24px 60px -28px rgba(16, 33, 24, .45);
	z-index: 60;
	overflow: hidden;
}
.bell-head { display: flex; align-items: center; gap: 6px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.bell-head strong { font-size: 12.5px; display: block; }
.bell-head .muted { font-size: 10.5px; }
.bell-head .link { border: 0; background: none; color: var(--brand-strong); padding: 0; cursor: pointer; font-size: 10.5px; text-decoration: underline; }
.bell-list { overflow-y: auto; padding: 4px; }
.bell-item { display: flex; align-items: flex-start; gap: 6px; padding: 7px 8px; border-radius: 10px; }
.bell-item:hover { background: var(--surface-2); }
.bell-item.overdue .bell-title::before { content: '●'; color: var(--danger); font-size: 7px; margin-right: 5px; vertical-align: 2px; }
.bell-item.unread { background: var(--brand-soft); }
.bell-item.unread .bell-title::before { content: '●'; color: var(--brand); font-size: 7px; margin-right: 5px; vertical-align: 2px; }
.bell-notes .bell-list { max-height: 190px; border-bottom: 1px solid var(--line); }
.bell-item[data-notice] { background: none; border: 0; width: 100%; text-align: left; cursor: pointer; font: inherit; }
.bell-item[data-notice].unread { background: var(--brand-soft); }
.bell-item[data-notice]:hover { background: var(--surface-2); }
.bell-open { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 0; cursor: pointer; }
.bell-title { display: block; font-size: 12.5px; font-weight: 550; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-meta { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.bell-actions { display: flex; gap: 2px; }
.bell-empty { padding: 22px 14px; text-align: center; color: var(--muted); font-size: 11.5px; }
.bell-empty p { margin: 6px 0 0; line-height: 1.5; }
.bell-foot { padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.bell-perm { padding: 8px 12px; font-size: 11px; color: var(--warn); background: #fdf7ee; border-bottom: 1px solid var(--line); }
.type-chip {
	margin-left: 6px;
	padding: 1px 6px;
	border-radius: 6px;
	background: var(--brand-soft);
	color: var(--brand-strong);
	font-size: 9.5px;
	font-weight: 600;
	letter-spacing: .02em;
}
.coupon-box {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px dashed var(--line, #e2e5e2);
}

.coupon-box .input.code,
input.code {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.invoice-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.invoice-row:last-child { border-bottom: 0; }
.invoice-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.invoice-main strong { font-size: 12px; }
.invoice-method { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invoice-amount { font-variant-numeric: tabular-nums; font-size: 12.5px; }
@media (max-width: 560px) { .invoice-method { display: none; } }

.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.profile-stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; }
.profile-stat span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.profile-stat strong { font-size: 13px; font-weight: 600; color: var(--ink); }
.profile-orders { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.profile-order {
	display: flex; align-items: center; gap: 7px; padding: 6px 8px;
	border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; text-align: left;
}
.profile-order:hover { background: var(--surface-2); border-color: var(--line); }
.profile-order .title { flex: 1; min-width: 0; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-line {
	display: flex; align-items: center; gap: 8px; width: 100%;
	border: 0; background: none; padding: 7px 8px; border-radius: 8px; cursor: pointer; text-align: left;
}
.customer-line:hover { background: var(--surface-2); }
.customer-line .cust-name { font-size: 12px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.source-row { display: flex; align-items: center; gap: 8px; padding: 5px 2px; border-bottom: 1px solid var(--line); }
.source-row:last-child { border-bottom: 0; }
.source-row .name { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.source-row .pct { font-size: 10.5px; font-weight: 600; color: var(--brand); }
@media (max-width: 720px) {
	.bell-panel { top: 54px; right: 8px; left: 8px; width: auto; }
}
.ref-chip {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 7px;
	border-radius: 999px;
	background: var(--brand-soft);
	color: var(--brand-strong);
	font-size: 11px;
	font-weight: 550;
	border: 1px solid #d3e5d9;
	cursor: pointer;
}
.ref-chip:hover { background: #d9ebdf; }

/* Tags, multi-select values and star ratings */
.tag-list { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; overflow: hidden; }
.tag {
	display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px;
	background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line);
	font-size: 10.5px; font-weight: 550; white-space: nowrap;
}
.rating-stars { color: #d9a441; letter-spacing: 1px; font-size: 12px; white-space: nowrap; }
.select[multiple] { padding: 6px 8px; min-height: 74px; background-image: none; }
