/* ASIM — clean, minimal business UI on top of Bootstrap 5 */
:root {
  --ink: #1d2125;
  --ink-2: #4a5159;
  --muted: #7b838c;
  --line: #e7e9ec;
  --line-2: #f0f2f4;
  --surface: #ffffff;
  --canvas: #fafbfb;
  /* Brand shades are overridden per company from Settings (templates/partials/_brand_css.html). */
  --brand: #FD8323;
  --brand-rgb: 253, 131, 35;
  --brand-600: var(--brand);
  --brand-700: #C94A10;
  --brand-50: #FFF4EA;
  --brand-100: #FFE3CC;
  --on-brand: #FFFFFF;
  --success: #067647;
  --success-bg: #ECFDF3;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --sidebar-w: 240px;
  --sidebar-collapsed-w: 68px;
  --sb-bg: #FFFFFF;
  --sb-text: #4A5159;
  --sb-icon: #4A5159;
  --sb-active-bg: var(--brand-50);    /* a soft tint of the brand color unless the company picks its own */
  --sb-active-text: var(--brand-700);

  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--surface);
  --bs-border-color: var(--line);
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: var(--brand-rgb);
  --bs-link-hover-color: var(--brand-700);
  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-focus-ring-color: rgba(var(--brand-rgb), .2);
}

body { font-size: .9375rem; background: var(--canvas); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { color: var(--ink); letter-spacing: -.01em; }
a { text-decoration: none; }
.text-muted, .form-text { color: var(--muted) !important; }
.tabular { font-variant-numeric: tabular-nums; }
[data-lucide] { width: 18px; height: 18px; stroke-width: 1.9; vertical-align: -3px; }
.icon-sm[data-lucide], svg.icon-sm { width: 15px; height: 15px; vertical-align: -2px; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--sb-bg); color: var(--sb-text);
  border: 1px solid color-mix(in srgb, var(--sb-text) 14%, var(--sb-bg)); border-radius: 16px;
  margin: 12px 0 12px 12px; height: calc(100vh - 24px); position: sticky; top: 12px; z-index: 1040;
  display: flex; flex-direction: column; padding: 14px 12px 12px;
  transition: width .18s ease, flex-basis .18s ease, padding .18s ease;
}

/* Workspace header: logo, name and tagline, opening a small menu. */
.ws { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid color-mix(in srgb, var(--sb-text) 14%, var(--sb-bg)); }
.ws-button {
  width: 100%; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 8px; border: 0; border-radius: 10px;
  background: transparent; color: var(--sb-text); text-align: left;
}
.ws-button:hover, .ws-button[aria-expanded="true"] { background: color-mix(in srgb, var(--sb-text) 7%, var(--sb-bg)); }
.ws-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ws-text { flex: 1; }
.ws-chevron[data-lucide], svg.ws-chevron { flex: 0 0 auto; margin-left: auto; color: color-mix(in srgb, var(--sb-text) 60%, var(--sb-bg)); }
.ws-menu { min-width: 216px; }
.brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-mark {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px; background: var(--brand); color: var(--on-brand);
  display: grid; place-items: center; font-weight: 700; font-size: .9rem; letter-spacing: .02em; overflow: hidden;
}
.asim-logo-mark { width: 32px; height: 32px; flex: 0 0 32px; display: block; object-fit: contain; }
/* The logo sits in the header row: its chosen size, but never taller than the row. */
.brand-logo { display: block; flex: 0 1 auto; min-width: 0; max-width: 100%; max-height: min(var(--logo-h, 40px), 40px); height: auto; object-fit: contain; object-position: left center; }
.ws-button:has(.brand-text) .brand-logo { max-width: 55%; }
.brand-name { font-weight: 700; line-height: 1.2; font-size: 1.05rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: .7rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: color-mix(in srgb, var(--sb-text) 65%, var(--sb-bg)); }
.sidebar-muted { color: color-mix(in srgb, var(--sb-text) 65%, var(--sb-bg)); }

/* Navigation */
.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.nav-side { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.nav-side a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--sb-text); font-weight: 500;
  white-space: nowrap;
}
.nav-side a [data-lucide], .nav-side a svg { flex: 0 0 18px; color: var(--sb-icon); }
.nav-side a:hover { background: color-mix(in srgb, var(--sb-text) 7%, var(--sb-bg)); color: var(--sb-text); }
.nav-side a:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.nav-side a.active { background: var(--sb-active-bg); color: var(--sb-active-text); font-weight: 600; }
.nav-side a.active [data-lucide], .nav-side a.active svg { color: var(--sb-active-text); }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-side a { position: relative; }
.nav-link .nav-badge-inline { display: inline-block; margin-left: 4px; vertical-align: 1px; }
.status-dot-warning { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; margin-left: 4px; vertical-align: 2px; }
.subscribers-aside { background: var(--line-2, #f4f5f7); border-radius: 12px; padding: 18px; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: #e5484d; color: #fff; font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Footer: Settings, then the signed-in person, then "Powered by". */
.sidebar-footer { margin-top: 12px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--sb-text) 14%, var(--sb-bg)); font-size: .85rem; }
.sidebar-footer .nav-side { font-size: .9375rem; margin-bottom: 8px; }
.profile-button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 10px;
  background: transparent; color: var(--sb-text); text-align: left; min-width: 0;
}
.profile-button:hover, .profile-button[aria-expanded="true"] { background: color-mix(in srgb, var(--sb-text) 7%, var(--sb-bg)); }
.profile-button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.profile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.profile-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-role { font-size: .75rem; color: color-mix(in srgb, var(--sb-text) 65%, var(--sb-bg)); }
.profile-more[data-lucide], svg.profile-more { flex: 0 0 auto; color: color-mix(in srgb, var(--sb-text) 60%, var(--sb-bg)); }
.profile-menu { min-width: 216px; }
.ws-menu .dropdown-item, .profile-menu .dropdown-item { display: flex; align-items: center; gap: 8px; }
.sidebar .avatar { width: 34px; height: 34px; flex: 0 0 34px; font-size: .78rem; background: color-mix(in srgb, var(--sb-text) 11%, var(--sb-bg)); color: var(--sb-text); }
.sidebar-powered { text-align: center; font-size: .72rem; padding-top: 8px; color: color-mix(in srgb, var(--sb-text) 60%, var(--sb-bg)); }
/* The sidebar's own text color, not the brand's: a brand color can disappear against a custom background. */
.sidebar-powered strong { color: var(--sb-text); font-weight: 700; }

/* Collapsed (desktop): 68px of icons. Labels become tooltips (see app.js). */
@media (min-width: 992px) {
  html.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); flex-basis: var(--sidebar-collapsed-w); padding: 14px 8px 12px; }
  html.sidebar-collapsed .sidebar .ws-text,
  html.sidebar-collapsed .sidebar .ws-chevron,
  html.sidebar-collapsed .sidebar .nav-label,
  html.sidebar-collapsed .sidebar .profile-text,
  html.sidebar-collapsed .sidebar .profile-more,
  html.sidebar-collapsed .sidebar .sidebar-powered { display: none; }
  html.sidebar-collapsed .sidebar .ws-button,
  html.sidebar-collapsed .sidebar .nav-side a,
  html.sidebar-collapsed .sidebar .profile-button { justify-content: center; padding-left: 0; padding-right: 0; }
  html.sidebar-collapsed .sidebar .nav-badge { position: absolute; top: 2px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; font-size: .62rem; line-height: 16px; }
  html.sidebar-collapsed .sidebar .brand-logo { max-width: 40px; max-height: 32px; object-position: center; }
}

/* Settings → Appearance */
.appearance-section + .appearance-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.theme-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 767.98px) { .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.theme-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease;
}
.theme-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.theme-card:has(.theme-radio:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .16); }
.theme-card:has(.theme-radio:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.theme-radio { position: absolute; opacity: 0; pointer-events: none; }
.theme-card:has(.theme-radio:checked)::after {
  content: ""; position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat;
}
/* A thumbnail of the sidebar in the theme's colors. */
.theme-swatch {
  display: grid; gap: 5px; align-content: start; height: 72px; padding: 9px 8px; border-radius: 8px; margin-bottom: 4px;
  background: var(--sw-bg); border: 1px solid color-mix(in srgb, var(--sw-text) 16%, var(--sw-bg));
}
.theme-swatch > span { display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--sw-text) 30%, var(--sw-bg)); }
.theme-swatch .sw-head { width: 55%; height: 8px; background: var(--sw-text); opacity: .85; margin-bottom: 3px; }
.theme-swatch .sw-pill { height: 12px; border-radius: 4px; background: var(--sw-active-bg); box-shadow: inset 3px 0 0 var(--sw-active-text); }
.theme-swatch .sw-short { width: 60%; }
.theme-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--ink); }
.theme-desc { font-size: .75rem; line-height: 1.35; color: var(--muted); }
.theme-options { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); }
/* `hidden` must beat Bootstrap's .row and friends, or a Light owner sees Custom's pickers. */
.theme-options [hidden] { display: none !important; }
.theme-options-part { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.primary-preview { display: flex; align-items: center; gap: 10px; margin-top: 12px; width: var(--sidebar-w); pointer-events: none; }

/* Settings → Appearance live preview */
.sidebar-preview { position: static !important; transform: none !important; margin: 0; height: 520px; width: var(--sidebar-w); box-shadow: var(--shadow); pointer-events: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--line-2); display: grid; place-items: center; font-weight: 600;
  color: var(--ink-2); font-size: .8rem; flex: 0 0 32px;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; background: rgba(250, 251, 251, .92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); padding: 12px 28px; display: flex; gap: 12px; align-items: center;
}
.search-box { position: relative; flex: 1; max-width: 460px; }
.search-box [data-lucide], .search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 38px; border-radius: 10px; background: var(--surface); }
.content { padding: 28px; max-width: 1320px; width: 100%; margin: 0 auto; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed; left: 0; top: 0; margin: 0; height: 100vh; height: 100dvh; border-width: 0 1px 0 0; border-radius: 0 16px 16px 0;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 10px 40px rgba(0,0,0,.12);
  }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 20, 25, .35); z-index: 1030; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 16px; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--muted); margin: 2px 0 0; }
.breadcrumb-lite { font-size: .8125rem; color: var(--muted); margin-bottom: 4px; }
.breadcrumb-lite a { color: var(--muted); }
.breadcrumb-lite a:hover { color: var(--ink); }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-header h2, .card-title-sm { font-size: 1rem; font-weight: 600; margin: 0; }
.card-body { padding: 20px; }
.section-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 6px; }

.stat-card { padding: 18px 20px; display: flex; gap: 14px; align-items: center; height: 100%; color: inherit; transition: border-color .15s; }
a.stat-card:hover { border-color: #cfd4d9; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); flex: 0 0 42px; }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.amber { background: #fff7e6; color: #b45309; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .85rem; }

/* ---------- Project page ---------- */
.project-stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; height: 100%; }
.project-stat .stat-value { font-size: 1.35rem; }
.project-hint { display: flex; align-items: center; gap: 5px; }
.project-hint[hidden] { display: none; }
.quote-earlier tr { background: var(--canvas); }
.quote-earlier td { font-size: .875rem; }

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn-sm { border-radius: 8px; }
.btn-primary {
  --bs-btn-color: var(--on-brand); --bs-btn-hover-color: var(--on-brand); --bs-btn-active-color: var(--on-brand);
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700);
  --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-light { --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--line-2); --bs-btn-hover-border-color: #d5dade; --bs-btn-color: var(--ink); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-700); }
.btn-icon { padding: 6px; width: 34px; height: 34px; }
.btn-lg-action { padding: 10px 18px; font-size: .95rem; }

/* ---------- Forms ---------- */
.form-control, .form-select { border-radius: 10px; border-color: var(--line); padding: .5rem .75rem; }
/* Keep room for the dropdown arrow, which the shared padding above would otherwise cover. */
.form-select { padding-right: 2.25rem; background-position: right .75rem center; }
.form-select-sm { padding: .3rem 2rem .3rem .6rem; background-position: right .5rem center; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .15); }
.form-control-sm, .form-select-sm { border-radius: 8px; }
.form-label { font-weight: 500; font-size: .85rem; color: var(--ink-2); margin-bottom: 5px; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: #b42318; font-size: .8125rem; }
.ts-wrapper.form-select { padding: 0 !important; border: 0; }
.ts-wrapper .ts-control, .ts-wrapper.form-select .ts-control, .ts-wrapper.single.input-active .ts-control { border: 1px solid var(--line) !important; border-radius: 10px !important; background: var(--surface) !important; min-height: 40px; padding: .45rem .75rem !important; }
.ts-wrapper.form-select.focus .ts-control, .ts-wrapper.focus .ts-control { border-color: var(--brand) !important; box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .15) !important; }
.ts-wrapper.form-select.invalid:not(.focus) .ts-control { border-color: var(--line) !important; box-shadow: none !important; }
select:disabled.form-select { background-color: var(--canvas); color: var(--muted); }
.ts-dropdown { border-radius: 10px; border-color: var(--line); box-shadow: 0 10px 30px rgba(16,24,40,.08); }
.ts-dropdown .active { background: var(--brand-50); color: var(--ink); }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: 12px 16px; border-bottom-color: var(--line-2); }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8faf9; }
.table tbody tr:last-child td { border-bottom: 0; }
tr.row-link { cursor: pointer; }
.doc-number { font-weight: 600; color: var(--ink); white-space: nowrap; }
.doc-number:hover { color: var(--brand); }
.cell-sub { font-size: .8rem; color: var(--muted); }

/* ---------- Status badges ---------- */
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-secondary { background: #f1f3f5; color: #59636e; }
.status-info { background: #eaf2fe; color: #1d5fc4; }
.status-success { background: var(--success-bg); color: var(--success); }
.status-danger { background: #fdecec; color: #b42318; }
.status-warning { background: #fff5e0; color: #a15c07; }
.status-dark { background: #eceef0; color: #30363d; text-decoration: line-through; }
.tag { display: inline-block; font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); }
.tag-green { background: var(--success-bg); color: var(--success); }
.tag-red { background: #fdecec; color: #b42318; }

/* ---------- Filters ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.filter-bar .form-control, .filter-bar .form-select { font-size: .875rem; }
.filter-bar .grow { flex: 1 1 220px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state [data-lucide], .empty-state svg { width: 36px; height: 36px; color: #c2c8ce; margin-bottom: 10px; }

/* ---------- Tabs ---------- */
.nav-underline { gap: 22px; border-bottom: 1px solid var(--line); padding: 0 20px; }
.nav-underline .nav-link { color: var(--muted); padding: 14px 0; font-weight: 500; border-bottom-width: 2px; }
.nav-underline .nav-link.active, .nav-underline .nav-link:hover { color: var(--ink); }
.nav-underline .nav-link.active { border-bottom-color: var(--brand); }
.count-pill { font-size: .7rem; background: var(--line-2); border-radius: 999px; padding: 1px 7px; margin-left: 4px; color: var(--ink-2); }

/* ---------- Document view ---------- */
.doc-meta dt { font-size: .75rem; color: var(--muted); font-weight: 500; }
.doc-meta dd { margin-bottom: 12px; white-space: pre-line; }
.totals { max-width: 360px; margin-left: auto; }
.totals-row { display: flex; justify-content: space-between; padding: 6px 0; font-variant-numeric: tabular-nums; }
.totals-row.grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-weight: 700; font-size: 1.15rem; }
.prewrap { white-space: pre-line; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.timeline li:last-child { border-bottom: 0; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; background: #d0d5da; flex: 0 0 10px; }
.timeline .dot.approved { background: var(--success); box-shadow: 0 0 0 4px var(--success-bg); }
.timeline li.current { font-weight: 600; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-variant-numeric: tabular-nums; }
.kv + .kv { border-top: 1px solid var(--line-2); }
.kv.strong { font-weight: 700; }
.internal-card { border-style: dashed; background: #fcfcfd; }
.internal-card .card-header { color: var(--ink-2); }

/* ---------- Builder ---------- */
.builder-table { table-layout: fixed; min-width: 760px; }
.builder-table td { vertical-align: top; padding: 8px 6px !important; }
.builder-table th { padding: 10px 6px !important; }
.builder-table .col-desc { width: auto; }
.builder-table .col-qty { width: 92px; }
.builder-table .col-unit { width: 96px; }
.builder-table .col-price { width: 124px; }
.builder-table .col-cost { width: 118px; }
.builder-table .col-amount { width: 120px; }
.builder-table .col-remove { width: 44px; }
.builder-table .amount-cell { padding-top: 16px !important; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.builder-table .form-control { padding: .45rem .6rem; }
.cost-col { display: none; }
.show-costs .cost-col { display: table-cell; }
.cost-col .form-control { background: #fbfbf4; border-style: dashed; }
.line-row.removed { display: none; }
/* Service picker for line item descriptions (static/js/builder.js) */
.service-menu {
  position: fixed; z-index: 1060; max-height: 288px; overflow-y: auto; padding: 4px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
}
.service-option {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer; color: var(--ink);
}
.service-option.active { background: var(--brand-50); }
.service-option-name { font-weight: 500; overflow-wrap: anywhere; }
.service-option-name mark { padding: 0; background: transparent; color: inherit; font-weight: 700; }
.service-option-meta { flex: 0 0 auto; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Disclaimers (templates/billing/_disclaimers.html, static/js/disclaimers.js) */
.disclaimer-list { list-style: none; margin: 0; padding: 0; }
.disclaimer-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.disclaimer-item:last-child { border-bottom: 0; }
.disclaimer-text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--muted); font-size: .82rem; white-space: pre-line;
}
.min-w-0 { min-width: 0; }
.disclaimer-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .85rem;
  border: 1px solid var(--line); color: var(--ink-2); background: var(--surface);
}
.filter-chip span { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.filter-chip:hover { border-color: #cfd4d9; color: var(--ink); }
.filter-chip.active { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); font-weight: 600; }
.filter-chip.active span { color: var(--brand-700); }
.disclaimer-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 0; margin: 0; }
.disclaimer-group-head { display: flex; align-items: center; gap: 8px; width: 100%; float: none; padding: 8px 14px; margin: 0; font-size: .95rem; }
.disclaimer-group-head .form-check-input { margin: 0; }
.disclaimer-option { display: flex; gap: 10px; align-items: flex-start; padding: 8px 14px 8px 36px; cursor: pointer; }
.disclaimer-option:hover { background: var(--canvas); }
.disclaimer-option .form-check-input { margin-top: 3px; flex: 0 0 auto; }
.sticky-actions {
  position: sticky; bottom: 0; background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border-top: 1px solid var(--line);
  padding: 12px 28px; margin: 24px -28px -28px; display: flex; justify-content: flex-end; gap: 10px; z-index: 10;
}
@media (max-width: 991.98px) { .sticky-actions { margin: 20px -16px -18px; padding: 12px 16px; } }

.pdf-frame { width: 100%; height: 78vh; border: 0; border-radius: 0 0 var(--radius) var(--radius); background: #525659; }
.modal-content { border-radius: var(--radius); border: 0; }
.alert { border-radius: var(--radius-sm); }

/* ---------- ASIM product identity (from static/img/logo.png) ---------- */
.asim-theme {
  --asim-navy: #0F2344;      /* the logo's deepest blue, for text */
  --asim-navy-2: #0A2959;
  --asim-blue: #345D9F;      /* the logo's blue faces */
  --asim-orange: #FD8323;
  --asim-orange-light: #FD9A1A;
  --asim-orange-deep: #FF6020;
  --asim-slate: var(--asim-blue);
  --brand: var(--asim-orange);
  --brand-rgb: 253, 131, 35;
  --brand-700: #E4580F;
  --brand-50: #FFF4EA;
  --brand-100: #FFE3CC;
  --on-brand: #FFFFFF;
  --ink: var(--asim-navy);
  --ink-2: #4B5566;
}

/* ---------- Sign-in & password reset (centered card) ---------- */
.auth-body { background: #fff; min-height: 100vh; display: flex; flex-direction: column; }
.auth-page { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 60px 16px 40px; }
.auth-card {
  width: 100%; max-width: 400px; background: #fff; border: 1px solid #e3e5e8; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(22, 28, 41, .08); padding: 36px 32px 30px;
}
.auth-card-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
.auth-card-logo img { width: 56px; height: 56px; object-fit: contain; }
.auth-card-title { font-size: 1.3rem; font-weight: 600; text-align: center; color: var(--asim-navy); margin: 0 0 26px; letter-spacing: -.01em; }
.auth-card-text { text-align: center; color: var(--ink-2); font-size: .92rem; margin: -12px 0 24px; }
.auth-tabs { display: flex; justify-content: center; margin: 0 0 28px; }
.auth-tab { padding: 0 24px 9px; font-size: 1rem; color: var(--asim-navy); border-bottom: 3px solid var(--asim-orange-deep); }
.auth-field { height: 44px; border-radius: 4px; border: 1px solid #8d9096; font-size: 1rem; padding: 0 10px; margin-bottom: 16px; }
.auth-field::placeholder { color: #6b6c72; }
.auth-field:focus { border-color: var(--asim-orange-deep); box-shadow: 0 0 0 3px rgba(255, 96, 32, .15); }
.auth-label-sm { display: block; font-size: .85rem; font-weight: 600; color: var(--asim-navy); margin-bottom: 6px; }
.auth-password { position: relative; }
.auth-password .auth-field { padding-right: 46px; }
.auth-eye { position: absolute; right: 4px; top: 22px; transform: translateY(-50%); border: 0; background: transparent; color: #6b6c72; padding: 8px; border-radius: 6px; line-height: 0; }
.auth-eye:hover, .auth-eye:focus-visible { color: var(--asim-navy); background: #f1f2f4; }
.auth-row { margin: 2px 0 20px; }
.auth-check .form-check-input { width: 20px; height: 20px; margin-top: 0; border-radius: 4px; border-color: #8d9096; }
.auth-check .form-check-input:checked { background-color: var(--asim-orange-deep); border-color: var(--asim-orange-deep); }
.auth-check .form-check-input:focus { box-shadow: 0 0 0 3px rgba(255, 96, 32, .2); border-color: var(--asim-orange-deep); }
.auth-check .form-check-label { color: #4b4c52; font-size: .92rem; margin-left: 6px; line-height: 20px; }
.auth-link { font-size: .88rem; font-weight: 500; color: var(--asim-orange-deep); }
.auth-link:hover { color: #C94A10; text-decoration: underline; }
.auth-submit {
  height: 40px; border-radius: 4px; font-weight: 600; font-size: 1rem; color: #fff; border: 0; gap: 8px;
  background: linear-gradient(90deg, var(--asim-orange-light), var(--asim-orange-deep));
  display: flex; align-items: center; justify-content: center;
}
.auth-submit:hover, .auth-submit:focus { background: linear-gradient(90deg, #F48A0F, #E8520F); color: #fff; }
.auth-google {
  height: 40px; border-radius: 4px; font-weight: 600; font-size: .95rem; color: var(--asim-navy); gap: 10px;
  background: #fff; border: 1px solid #8d9096; display: flex; align-items: center; justify-content: center;
}
.auth-google:hover, .auth-google:focus { background: #f6f7f8; border-color: var(--asim-navy); color: var(--asim-navy); }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: #6b6c72; font-size: .8rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid #e3e5e8; }
.auth-captcha { display: flex; justify-content: center; margin: 0 0 16px; min-height: 78px; }  /* the widget's height, so the form doesn't jump */
.auth-code { text-align: center; font-size: 1.35rem; letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.auth-plan { margin: 24px 0 0; padding: 18px; border: 1px solid #e3e5e8; border-radius: 12px; background: #fafbfc; }
.auth-plan-title { font-size: .95rem; font-weight: 700; margin: 0; color: var(--ink, #1d2125); }
.auth-plan-price { font-size: 1.15rem; font-weight: 800; color: var(--ink, #1d2125); white-space: nowrap; }
.auth-plan-price span { font-size: .78rem; font-weight: 500; color: #6b6c72; }
.auth-plan-text { font-size: .82rem; color: #6b6c72; margin: 6px 0 10px; line-height: 1.45; }
.auth-plan-steps { font-size: .8rem; color: #4a5159; margin: 0 0 14px; padding-left: 18px; line-height: 1.7; }
.auth-plan-button { background: #fff; border: 1px solid #d5d8dc; color: var(--ink, #1d2125); font-weight: 600; }
.auth-plan-button:hover, .auth-plan-button:focus { border-color: var(--asim-orange-deep); color: var(--asim-orange-deep); background: #fff; }
.auth-buy-button { display: flex; justify-content: center; min-height: 60px; }
.auth-fineprint { font-size: .8rem; color: #6b6c72; text-align: center; margin: 22px 0 0; padding-top: 20px; border-top: 1px solid #e3e5e8; line-height: 1.5; }
.auth-error { color: #b42318; font-size: .82rem; margin: -10px 0 14px; }
.auth-hint { color: #6b6c72; font-size: .8rem; margin: -10px 0 4px; }
.auth-field.is-invalid { border-color: #d92d20; }

/* ---------- First-run setup (wider card with steps) ---------- */
.auth-card.onboarding-card { max-width: 560px; }
.onboarding-steps { list-style: none; display: flex; justify-content: center; gap: 8px; padding: 0; margin: 0 0 24px; flex-wrap: wrap; }
.onboarding-steps li { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: #6b6c72; }
.onboarding-steps li + li::before { content: ""; width: 28px; height: 1px; background: #d5d8dc; margin-right: 4px; }
.onboarding-step-dot {
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  border: 1px solid #c4c8cd; font-weight: 600; font-size: .8rem; background: #fff;
}
.onboarding-steps li.current { color: var(--asim-navy); font-weight: 600; }
.onboarding-steps li.current .onboarding-step-dot { border-color: var(--asim-orange-deep); color: var(--asim-orange-deep); }
.onboarding-steps li.done .onboarding-step-dot { background: var(--asim-orange-deep); border-color: var(--asim-orange-deep); color: #fff; }
.onboarding-logo {
  min-height: 110px; border: 1px dashed #c4c8cd; border-radius: 8px; display: grid; place-items: center;
  padding: 12px; color: #6b6c72; font-weight: 600; background: #fafbfb; text-align: center;
}
.onboarding-logo img { max-height: 86px; max-width: 100%; object-fit: contain; }
.onboarding-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.onboarding-card .form-label { font-size: .85rem; font-weight: 600; color: var(--asim-navy); }
@media (max-width: 480px) {
  .onboarding-steps { flex-wrap: nowrap; gap: 4px; }
  .onboarding-steps li { font-size: .78rem; gap: 5px; }
  .onboarding-steps li + li::before { width: 10px; margin-right: 1px; }
}
.auth-footer { text-align: center; font-size: .8rem; color: #6b6c72; padding: 24px 16px 28px; display: grid; gap: 6px; }
@media (max-width: 480px) {
  .auth-page { padding-top: 24px; }
  .auth-card { border: 0; box-shadow: none; padding: 24px 8px; }
}

.notice { background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; font-size: .9rem; color: var(--ink-2); }

/* ---------- Collapsible side cards (static/js/app.js) ---------- */
.collapsible-card > .card-header { cursor: pointer; user-select: none; }
.collapsible-card > .card-header h2 { margin-right: auto; }
.card-collapse-toggle { border: 0; background: transparent; color: var(--muted); border-radius: 8px; width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 28px; margin-right: -6px; }
.card-collapse-toggle:hover, .card-collapse-toggle:focus-visible { background: var(--line-2); color: var(--ink); }
.card-collapse-toggle [data-lucide], .card-collapse-toggle svg { transition: transform .15s ease; }
.collapsible-card.is-collapsed > .card-header { border-bottom: 0; }
.collapsible-card.is-collapsed > :not(.card-header) { display: none !important; }
.collapsible-card.is-collapsed .card-collapse-toggle [data-lucide], .collapsible-card.is-collapsed .card-collapse-toggle svg { transform: rotate(-90deg); }
@media (prefers-reduced-motion: reduce) { .card-collapse-toggle svg { transition: none; } }

/* ---------- Profitability (internal) ---------- */
.profit-badge { display: inline-flex; align-items: center; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.profit-badge.sm { font-size: .62rem; padding: 0 6px; }
.profit-badge.on_target { background: var(--success-bg); color: var(--success); }
.profit-badge.below_target { background: #FEF0C7; color: #B54708; }
.profit-badge.below_minimum { background: #FEE4E2; color: #B42318; }
.profit-badge.loss { background: #B42318; color: #fff; }
.profit-hint { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: #FFFAEB; color: #7A4A06; font-size: .8rem; }
.line-margin { font-size: .68rem; font-weight: 600; margin-top: 3px; text-align: right; color: var(--muted); }
.line-margin.on_target { color: var(--success); }
.line-margin.below_target { color: #B54708; }
.line-margin.below_minimum, .line-margin.loss { color: #B42318; }

.pay-status { display: inline-block; margin-top: 2px; font-size: .68rem; font-weight: 600; padding: 0 7px; border-radius: 999px; }
.pay-status.paid { background: var(--success-bg); color: var(--success); }
.pay-status.due { background: #FEF0C7; color: #B54708; }
.pay-status.awaiting_customer { background: var(--line-2); color: var(--ink-2); }
.labor-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.labor-table th, .labor-table td { padding: 8px 6px; }

/* ---------- Messages dialog (templates/partials/_messages_modal.html) ---------- */
.message-modal .modal-dialog { max-width: 440px; }
.message-modal .modal-content { overflow: hidden; }
.message-modal-head { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 28px 4px; text-align: center; }
.message-modal-head .modal-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.message-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; }
.message-icon [data-lucide], .message-icon svg { width: 26px; height: 26px; }
.message-icon.success { background: var(--success-bg); color: var(--success); }
.message-icon.error { background: #FEE4E2; color: #B42318; }
.message-icon.warning { background: #FEF0C7; color: #B54708; }
.message-icon.info { background: var(--brand-50); color: var(--brand-700); }
.message-modal-body { padding: 8px 28px 4px; text-align: center; color: var(--ink-2); }
.message-text { margin: 0 0 8px; overflow-wrap: anywhere; }
.message-modal-body .message-text:only-child { font-size: .95rem; }
.message-modal-body:has(.message-text + .message-text) { text-align: left; }
.message-modal-body:has(.message-text + .message-text) .message-text { display: flex; gap: 8px; }
.message-modal-body .message-text [data-lucide], .message-modal-body .message-text svg { flex: 0 0 auto; margin-top: 3px; }
.message-success { color: var(--success); }
.message-error { color: #B42318; }
.message-warning { color: #B54708; }
.message-info { color: var(--brand-700); }
.message-modal-foot { display: flex; justify-content: center; padding: 14px 28px 24px; }
.message-icon.sm { width: 30px; height: 30px; flex: 0 0 30px; }
.message-icon.sm [data-lucide], .message-icon.sm svg { width: 17px; height: 17px; }
.app-toast { width: 380px; max-width: calc(100vw - 32px); padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(16, 24, 40, .14); background: var(--surface); }
.app-toast-text { color: var(--ink); font-size: .9rem; padding-top: 4px; overflow-wrap: anywhere; }
.app-toast-text + .app-toast-text { margin-top: 4px; }
.app-toast .btn-close { flex: 0 0 auto; font-size: .7rem; margin-top: 6px; }

/* ---------- Pagination (templates/partials/_pagination.html) ---------- */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager-card .pager { border-top: 0; }
.pager-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: .85rem; color: var(--muted); }
.pager-summary strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.pager-size .form-select { width: auto; min-width: 9rem; }
.pager .pagination { gap: 4px; }
.pager .page-link { min-width: 32px; text-align: center; border-radius: 8px !important; border-color: var(--line); color: var(--ink-2); }
.pager .page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pager .page-link:hover { background: var(--brand-50); color: var(--brand-700); }

.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---------- Schedule ---------- */
.icon-xs[data-lucide], svg.icon-xs { width: 12px; height: 12px; vertical-align: -1px; }
.crew-dots { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.crew-dot {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff;
  font-size: .62rem; font-weight: 700; letter-spacing: .02em; flex: 0 0 auto; box-shadow: 0 0 0 2px #fff;
}
.crew-dot.lg { width: 34px; height: 34px; font-size: .78rem; }
.crew-dot.lead { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ink); }
.unstaffed { font-size: .7rem; color: #b42318; font-weight: 600; }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day-col { border-right: 1px solid var(--line); min-height: 460px; display: flex; flex-direction: column; min-width: 0; }
.day-col:last-child { border-right: 0; }
.day-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 8px; border-bottom: 1px solid var(--line-2); }
.day-name { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.day-num { font-weight: 700; font-size: 1.05rem; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.is-today .day-num { background: var(--brand); color: var(--on-brand); }
.day-add { margin-left: auto; color: var(--muted); border-radius: 8px; padding: 2px 4px; opacity: .55; }
.day-add:hover { background: var(--brand-50); color: var(--brand); opacity: 1; }
.day-jobs { padding: 8px; display: grid; gap: 6px; align-content: start; }
.day-empty { font-size: .75rem; color: #b7bdc3; text-align: center; padding: 14px 0; }
.is-today .day-jobs { background: rgba(var(--brand-rgb), .025); flex: 1; }

.job-chip {
  display: grid; gap: 2px; padding: 7px 8px 7px 10px; border-radius: 9px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-left: 4px solid var(--chip-color, var(--brand)); font-size: .78rem; line-height: 1.25;
  transition: box-shadow .15s, transform .15s; min-width: 0;
}
.job-chip:hover { color: var(--ink); box-shadow: 0 4px 14px rgba(16, 24, 40, .08); transform: translateY(-1px); }
.job-chip-time { font-size: .68rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-chip-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.job-chip-sub { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-chip .crew-dots { margin-top: 3px; }
.job-chip.compact { padding: 5px 6px 5px 8px; font-size: .72rem; }
.job-chip.compact .crew-dot { width: 18px; height: 18px; font-size: .55rem; }
/* Job status: the card color changes as soon as a job is started, completed or cancelled. */
.job-chip-status { display: inline-flex; align-items: center; gap: 5px; justify-self: start; font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 999px; }
.job-chip.job-in_progress { background: #FFF4E0; border-color: #F6C77E; border-left-color: #D97706; }
.job-chip.job-in_progress .job-chip-status { background: #FDE3B5; color: #92400E; }
.job-chip.job-completed { background: #ECFDF3; border-color: #ABE3C3; border-left-color: #067647; }
.job-chip.job-completed .job-chip-status { background: #D1FADF; color: #05603A; }
.job-chip.job-cancelled { background: #F3F4F6; border-color: var(--line); border-left-color: #9AA1A9; color: var(--muted); }
.job-chip.job-cancelled .job-chip-title { text-decoration: line-through; }
.job-chip.job-cancelled .job-chip-status { background: #E5E7EB; color: #4B5563; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #D97706; animation: live-pulse 1.6s ease-in-out infinite; }
@keyframes live-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, .55); } 50% { box-shadow: 0 0 0 4px rgba(217, 119, 6, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.status-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.filter-chip .status-swatch { width: 8px; height: 8px; border-radius: 50%; }
.status-swatch.scheduled { background: var(--brand); }
.status-swatch.in_progress { background: #D97706; }
.status-swatch.completed { background: #067647; }
.status-swatch.cancelled { background: #9AA1A9; }
.day-jobs { max-height: 640px; overflow-y: auto; }

.team-board { table-layout: fixed; min-width: 980px; }
.team-board th { text-align: left; }
.team-board th.is-today { color: var(--brand); }
.team-board .member-col { width: 200px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.board-cell { vertical-align: top; position: relative; padding: 6px !important; border-left: 1px solid var(--line-2); }
.board-cell .job-chip + .job-chip { margin-top: 4px; }
.cell-add { display: block; text-align: center; color: var(--muted); border-radius: 6px; padding: 2px; margin-top: 4px; opacity: 0; }
.board-cell:hover .cell-add { opacity: 1; background: var(--brand-50); color: var(--brand); }
.unassigned-row td { background: #fff8f7; }
.individual-row td { background: var(--canvas); }

.crew-grid { display: grid; gap: 8px; max-height: 440px; overflow-y: auto; padding-right: 2px; }
.crew-choices { max-height: 260px; overflow-y: auto; }
.scroll-list { max-height: 420px; overflow-y: auto; padding-right: 2px; }
.crew-option { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; transition: border-color .15s, background .15s; }
.crew-option.selected { border-color: var(--brand); background: var(--brand-50); }
.crew-option.busy:not(.selected) { background: #fffdf7; }
.crew-check { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; margin: 0; }
.crew-check .form-check-input { margin: 0; flex: 0 0 auto; }
.busy-note { font-size: .72rem; color: #a15c07; font-weight: 600; }
.free-note { font-size: .72rem; color: var(--success); }
.lead-toggle { font-size: .75rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; margin: 0; }

@media (max-width: 991.98px) {
  .week-grid { grid-template-columns: 1fr; }
  .day-col { border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; }
  .day-empty { display: none; }
}

/* ---------- Teams ---------- */
.crew-tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--crew-color, var(--brand)) 12%, white); color: color-mix(in srgb, var(--crew-color, var(--brand)) 80%, black);
  border: 1px solid color-mix(in srgb, var(--crew-color, var(--brand)) 28%, white); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.crew-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--crew-color, var(--brand)); flex: 0 0 7px; }
.crew-tag.sm { font-size: .64rem; padding: 0 6px; justify-self: start; }
.crew-swatch { width: 12px; height: 12px; border-radius: 4px; background: var(--crew-color, var(--brand)); flex: 0 0 12px; }
.crew-swatch.lg { width: 30px; height: 30px; border-radius: 9px; flex-basis: 30px; }
.crew-card { border-top: 4px solid var(--crew-color, var(--brand)); }
.crew-choices { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.crew-choice { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; margin: 0; }
.crew-choice input { flex: 0 0 auto; accent-color: var(--brand); }
.crew-choice.selected { border-color: var(--crew-color, var(--brand)); background: color-mix(in srgb, var(--crew-color, var(--brand)) 8%, white); }
.member-pick-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.member-pick { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; margin: 0; }
.member-pick input { accent-color: var(--brand); }
.member-pick.selected { border-color: var(--brand); background: var(--brand-50); }
.card-tabs { border-bottom: 1px solid var(--line); padding: 0; }

/* ---------- Type-to-search pickers (partials/_search_select.html) ---------- */
.search-select { position: relative; }
.search-select > input[type="text"] { width: 100%; }
.search-select-clear {
  position: absolute; top: 50%; right: 30px; transform: translateY(-50%); border: 0; background: none; line-height: 1;
  font-size: 1.1rem; color: var(--muted); padding: 0 4px; cursor: pointer;
}
.search-select-clear:hover { color: var(--text); }
.search-select-menu {
  position: absolute; z-index: 1060; top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 28px rgba(16, 24, 40, .12); padding: 4px;
}
.search-select-option {
  display: block; width: 100%; text-align: left; border: 0; background: none; border-radius: 9px; padding: 7px 10px; cursor: pointer;
}
.search-select-option:hover, .search-select-option.is-active { background: var(--brand-50); }
.search-select-label { display: block; font-size: .86rem; color: var(--text); }
.search-select-sub { display: block; font-size: .74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-select-empty { padding: 10px; font-size: .82rem; color: var(--muted); }

/* Sign-in: split layout, brand showcase on the left and the form on the right */
.auth-split-body { background: #fff; }
.auth-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); min-height: 100vh; }
.auth-showcase {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px clamp(32px, 5vw, 80px); color: var(--asim-navy);
  background:
    radial-gradient(520px 420px at 8% 92%, rgba(253, 131, 35, .20), transparent 70%),
    radial-gradient(560px 460px at 88% 6%, rgba(37, 88, 196, .14), transparent 70%),
    linear-gradient(160deg, #fbfaf8 0%, #f3f6fb 100%);
}
.auth-showcase::before, .auth-showcase::after {
  content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(29, 46, 84, .08); pointer-events: none;
}
.auth-showcase::before { width: 520px; height: 520px; top: -260px; right: -120px; }
.auth-showcase::after { width: 640px; height: 640px; bottom: -380px; right: -200px; }
.auth-showcase-glow {
  position: absolute; inset: auto auto 18% 52%; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(253, 131, 35, .16), transparent 70%); pointer-events: none;
}
.auth-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--asim-navy); font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; text-decoration: none; position: relative; }
.auth-brand img { width: 36px; height: 36px; object-fit: contain; }
.auth-brand:hover { color: var(--asim-navy); }
.auth-showcase-body { position: relative; max-width: 560px; margin: 48px 0; }
.auth-eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--asim-orange-deep); margin: 0 0 12px; }
.auth-headline { font-size: clamp(2.3rem, 4.2vw, 3.6rem); font-weight: 800; line-height: 1.02; letter-spacing: -.035em; margin: 0 0 18px; color: #16213a; }
.auth-headline span {
  display: block; background: linear-gradient(90deg, #2558c4, #fd8323 70%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-lede { font-size: 1.02rem; line-height: 1.6; color: #4a5159; max-width: 470px; margin: 0; }
.auth-float { position: relative; height: 170px; margin-top: 36px; }
.auth-float-card {
  position: absolute; display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px; border-radius: 14px;
  background: rgba(255, 255, 255, .88); border: 1px solid rgba(29, 46, 84, .07); backdrop-filter: blur(6px);
  box-shadow: 0 12px 30px -12px rgba(22, 33, 58, .25); font-size: .85rem; white-space: nowrap;
}
.auth-float-card strong { display: block; color: #16213a; font-weight: 700; }
.auth-float-card small { display: block; color: #6b6c72; font-size: .75rem; }
.auth-float-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 34px; }
.auth-float-icon.green { background: #e7f6ee; color: #178a4c; }
.auth-float-icon.orange { background: #fff1e6; color: #e8520f; }
.auth-float-icon.blue { background: #e9f0fd; color: #2558c4; }
.auth-float-a { top: 0; left: 0; transform: rotate(-2deg); }
.auth-float-b { top: 58px; left: 42%; transform: rotate(1.5deg); }
.auth-float-c { top: 118px; left: 8%; transform: rotate(-.5deg); }
.auth-benefits { list-style: none; padding: 0; margin: 0; position: relative; display: grid; gap: 12px; }
.auth-benefits li { display: flex; align-items: center; gap: 10px; font-size: .9rem; font-weight: 600; color: #26324a; }
.auth-benefits li::before {
  content: ""; width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%; background: #fff1e6
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23e8520f' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center no-repeat;
}

.auth-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.auth-brand-text small { font-size: .68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #6b6c72; margin-top: 3px; }
.auth-showcase-foot { position: relative; display: grid; gap: 22px; }
.auth-domain { font-size: .8rem; font-weight: 700; color: #26324a; letter-spacing: .02em; text-decoration: none; opacity: .75; }
.auth-domain:hover { opacity: 1; color: var(--asim-orange-deep); }
.auth-panel-foot a { color: inherit; font-weight: 600; text-decoration: none; }
.auth-panel-foot a:hover { color: var(--asim-orange-deep); }
.auth-card-logo-stack { flex-direction: column; gap: 8px; }
.auth-lockup { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.auth-lockup-name { font-size: 1.05rem; font-weight: 800; color: var(--asim-navy); letter-spacing: -.01em; }
.auth-lockup-tag { font-size: .66rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #6b6c72; }
.auth-footer a { color: inherit; font-weight: 600; text-decoration: none; }
.auth-footer a:hover { color: var(--asim-orange-deep); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-panel-inner { width: 100%; max-width: 420px; }
.auth-brand-mobile { display: none; margin-bottom: 28px; }
.auth-panel-title { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; color: #16213a; margin: 0 0 6px; }
.auth-panel-text { color: #6b6c72; font-size: .95rem; margin: 0 0 26px; }
.auth-label { display: block; font-size: .85rem; font-weight: 600; color: #26324a; margin-bottom: 6px; }
.auth-split .auth-field { border-radius: 10px; border-color: #d5d8dc; }
.auth-split .auth-field:hover { border-color: #b9bdc3; }
.auth-split .auth-google { border-radius: 10px; }
.auth-split .auth-submit { border-radius: 10px; height: 48px; font-weight: 700; box-shadow: 0 10px 22px -12px rgba(232, 82, 15, .7); }
.auth-split .auth-row { margin: 0 0 20px; }
.auth-split .auth-plan { margin-top: 28px; border-radius: 14px; }
.auth-split .auth-plan-button { border-radius: 10px; }
.auth-panel-foot { text-align: center; font-size: .75rem; color: #8d9096; margin: 28px 0 0; }

@media (max-width: 991.98px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-showcase { display: none; }
  .auth-brand-mobile { display: inline-flex; }
  .auth-panel { align-items: flex-start; padding: 36px 16px; }
}

/* Landing page (asimcore.com/ for visitors): minimal on purpose */
.landing-body { background: #fff; color: #16213a; }
.landing-body > main { flex: 1; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; max-width: 1080px; width: 100%; margin: 0 auto; padding: 22px 20px; }
.landing-signin { border: 1px solid #d5d8dc; border-radius: 10px; font-weight: 600; color: #16213a; padding: 8px 18px; background: #fff; }
.landing-signin:hover, .landing-signin:focus { border-color: var(--asim-orange-deep); color: var(--asim-orange-deep); background: #fff; }
.landing-hero { max-width: 760px; margin: 0 auto; padding: 64px 20px 40px; text-align: center; }
.landing-hero .auth-eyebrow { margin-bottom: 16px; }
.landing-title { font-size: clamp(2.2rem, 5.4vw, 3.6rem); font-weight: 800; line-height: 1.04; letter-spacing: -.035em; margin: 0 0 18px; }
.landing-title span { background: linear-gradient(90deg, #2558c4, #fd8323 75%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing-lede { font-size: 1.08rem; line-height: 1.6; color: #4a5159; max-width: 560px; margin: 0 auto 28px; }
.landing-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.landing-cta { width: auto; padding: 0 28px; height: 48px; display: inline-flex; align-items: center; border-radius: 10px; font-weight: 700; }
.landing-ghost { height: 48px; display: inline-flex; align-items: center; padding: 0 24px; border-radius: 10px; font-weight: 600; color: #16213a; border: 1px solid #d5d8dc; background: #fff; }
.landing-ghost:hover, .landing-ghost:focus { border-color: #16213a; color: #16213a; background: #fff; }
.landing-plan-wrap { padding: 24px 20px 72px; display: flex; justify-content: center; }
.landing-plan { width: 100%; max-width: 400px; border: 1px solid #e3e5e8; border-radius: 18px; padding: 28px; background: #fff; box-shadow: 0 24px 48px -32px rgba(22, 33, 58, .35); }
.landing-plan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.landing-plan-head h2 { font-size: 1.1rem; font-weight: 800; margin: 0; }
.landing-plan-tag { font-size: .75rem; color: #6b6c72; }
.landing-price { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; margin: 14px 0 18px; }
.landing-price span { font-size: .95rem; font-weight: 500; color: #6b6c72; letter-spacing: 0; }
.landing-features { list-style: none; padding: 18px 0 0; margin: 0 0 24px; border-top: 1px solid #eef0f2; display: grid; gap: 10px; }
.landing-features li { display: flex; align-items: center; gap: 10px; font-size: .92rem; color: #26324a; }
.landing-features li::before {
  content: ""; width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%; background: #fff1e6
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23e8520f' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center no-repeat;
}
.landing-plan .auth-submit { height: 48px; border-radius: 10px; font-weight: 700; }
.landing-plan-note { font-size: .78rem; color: #6b6c72; text-align: center; margin: 12px 0 0; line-height: 1.5; }
.landing-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; max-width: 1080px; width: 100%; margin: 0 auto; padding: 22px 20px 28px; border-top: 1px solid #eef0f2; font-size: .8rem; color: #6b6c72; }
.landing-foot a { color: inherit; font-weight: 600; text-decoration: none; }
.landing-foot a:hover { color: var(--asim-orange-deep); }
@media (max-width: 575.98px) {
  .landing-nav .auth-brand-text small { display: none; }
  .landing-hero { padding-top: 36px; }
  .landing-foot { justify-content: center; text-align: center; }
}
