:root {
  color-scheme: light;
  --ink: #2a1a16;
  --muted: #4b5666;
  --soft: #6b7685;
  --line: #e9edf2;
  --canvas: #fff8f1;
  --white: #fff;
  --brand: #c40000;
  --accent: #db4a15;
  --accent-dark: #c64110;
  --heading: #522018;
  --nav-active: #64261d;
  --navy: #3e1812;
  --navy-2: #542119;
  --green: #e4572e;
  --green-dark: #c4421d;
  --green-pale: #fdeee6;
  --orange: #f28c28;
  --orange-pale: #fff1e0;
  --red: #cf5e62;
  --red-pale: #fff0f0;
  --shadow: 0 6px 22px rgba(67,26,20, .045);
  font-family: "DM Sans", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 340px; color: var(--ink); background: var(--canvas); font-size: 16px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; display: flex; flex-direction: column; width: 280px; padding: 25px 15px 13px; color: #cad3de; background: var(--navy); }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 0 24px 5px; color: white; text-decoration: none; }
.brand-mark { display: grid; width: 37px; height: 37px; place-items: center; border-radius: 11px; color: #3c1812; background: #ffd249; font: 800 22px Manrope, sans-serif; transform: skew(-5deg); }
.brand-copy, .dealer-copy, .profile-copy { display: grid; gap: 3px; }
.brand-copy strong { font: 800 21px Manrope, sans-serif; letter-spacing: -.9px; }
.brand-copy small { color: #b4c0cd; font-size: 12px; font-weight: 700; letter-spacing: 1.4px; }
.dealer-switcher { display: flex; align-items: center; gap: 10px; min-height: 57px; padding: 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; background: rgba(255,255,255,.055); }
.dealer-avatar, .profile-avatar, .topbar-avatar { display: grid; flex: 0 0 auto; width: 34px; height: 34px; place-items: center; border-radius: 8px; color: #b44015; background: #f4dac7; font-size: 14px; font-weight: 700; }
.dealer-copy { flex: 1; min-width: 0; }
.dealer-copy strong, .profile-copy strong { overflow: hidden; color: #f1f4f7; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.dealer-copy small, .profile-copy small { color: #b4bfcc; font-size: 14px; }
.switcher-dots { color: #5a6066; letter-spacing: 2px; }
.main-nav { flex: 1; overflow-y: auto; padding: 20px 0 10px; scrollbar-width: thin; scrollbar-color: #405267 transparent; }
.nav-heading { margin: 0 0 8px 10px; color: #a0afc0; font-size: 13px; font-weight: 700; letter-spacing: 1.25px; }
.nav-heading-spaced { margin-top: 21px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 38px; margin: 2px 0; padding: 0 11px; border: 0; border-radius: 6px; color: #aeb9c7; background: transparent; text-align: left; font-size: 15px; cursor: pointer; transition: color .16s, background .16s; }
.nav-item:hover { color: white; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; background: var(--nav-active); font-weight: 600; }
.nav-item.active .nav-icon { color: #ffd558; }
.nav-icon { width: 16px; color: #92a1b2; font-size: 18px; text-align: center; }
.nav-count { margin-left: auto; color: #ffd65c; font-size: 14px; }
.sidebar-bottom { flex: 0 0 auto; }
.help-card { padding: 12px 12px 11px; border: 1px solid rgba(255,255,255,.075); border-radius: 8px; background: rgba(255,255,255,.04); }
.help-icon { display: grid; width: 23px; height: 23px; margin-bottom: 8px; place-items: center; border-radius: 6px; color: #ffd558; background: rgba(255,213,88,.12); }
.help-card strong { color: #edf2f7; font-size: 14px; }
.help-card p { margin: 4px 0 9px; color: #c3cdd9; font-size: 14px; }
.help-card a { color: #ffd558; font-size: 14px; font-weight: 600; text-decoration: none; }
.help-card a span { margin-left: 2px; }
.profile-button { display: flex; align-items: center; gap: 9px; width: 100%; margin-top: 12px; padding: 11px 3px 3px; border: 0; border-top: 1px solid rgba(255,255,255,.09); background: transparent; text-align: left; }
.profile-avatar { color: #792f23; background: #d8e4f3; }
.profile-copy { flex: 1; }
.profile-menu { color: #aab6c4; letter-spacing: 2px; }
.main-content { display: flex; min-height: 100vh; flex-direction: column; margin-left: 280px; }
.topbar { position: sticky; z-index: 5; top: 0; display: flex; height: 65px; flex: 0 0 auto; align-items: center; justify-content: space-between; padding: 0 36px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.breadcrumb { display: flex; align-items: center; gap: 11px; color: #383d45; font-size: 14px; }
.breadcrumb strong { color: #324153; font-weight: 600; }
.breadcrumb-separator { color: #c8ced6; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.today-label { color: #353b43; font-size: 14px; }
.icon-button { position: relative; display: grid; width: 31px; height: 31px; place-items: center; border: 0; border-radius: 7px; color: #363d45; background: transparent; font-size: 21px; cursor: pointer; }
.icon-button:hover { background: #f1f4f6; }
.notification-button i { position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border: 1px solid white; border-radius: 50%; background: #e99a48; }
.topbar-divider { width: 1px; height: 23px; background: var(--line); }
.topbar-avatar { width: 30px; height: 30px; border-radius: 50%; font-size: 14px; }
.mobile-menu { display: none; padding: 5px; border: 0; background: transparent; cursor: pointer; }
.page-content { width: 100%; max-width: 1470px; flex: 1; margin: 0 auto; padding: 32px 36px 25px; }
.page-footer { display: flex; justify-content: space-between; padding: 13px 36px 16px; border-top: 1px solid var(--line); color: #353b43; font-size: 14px; }
.footer-dot { padding: 0 4px; color: #c0c6ce; }
.privacy-lock { margin-left: 2px; color: #af725f; }
.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.eyebrow { margin: 0 0 7px; color: #373e46; font-size: 13px; font-weight: 700; letter-spacing: 1.35px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; color: #401812; font: 700 24px Manrope, sans-serif; letter-spacing: -.8px; }
.page-intro > div > p:last-child { margin: 0; color: #31383f; font-size: 15px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 13px; border: 1px solid transparent; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .16s, transform .16s; }
.button:active { transform: translateY(1px); }
.button-primary { color: white; background: var(--accent); box-shadow: 0 2px 5px rgba(136,45,17,.15); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { border-color: #e5e9ee; color: #2c333b; background: white; }
.button-secondary:hover { background: #f7f9fa; }
.button-small { min-height: 29px; padding: 0 9px; font-size: 14px; }
.button-link { padding: 0; border: 0; color: var(--accent); background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; }
.overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; }
.metric-card { position: relative; min-height: 112px; padding: 15px 15px 13px; border: 1px solid #edf0f3; border-radius: 8px; background: white; box-shadow: var(--shadow); }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: #31383f; font-size: 14px; font-weight: 500; }
.metric-icon { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 7px; color: #d54a18; background: #f8efe8; font-size: 16px; }
.metric-icon.orange { color: #c58238; background: #fff4e7; }
.metric-icon.blue { color: #6485ba; background: #eef3fc; }
.metric-icon.red { color: #c96b6b; background: #fff0ef; }
.metric-value { margin: 9px 0 3px; color: #4e1e17; font: 700 23px Manrope, sans-serif; letter-spacing: -.7px; }
.metric-foot { color: #383d45; font-size: 13px; }
.metric-foot .positive { color: #e14d17; font-weight: 600; }
.dashboard-row { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(250px,.8fr); gap: 14px; margin-top: 14px; }
.panel { min-width: 0; border: 1px solid #edf0f3; border-radius: 8px; background: white; box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 17px 0; }
.panel-heading h2 { margin: 0 0 4px; color: var(--heading); font: 700 16px Manrope, sans-serif; letter-spacing: -.2px; }
.panel-heading p { margin: 0; color: #353b43; font-size: 14px; }
.period-select { padding: 6px 8px; border: 1px solid #e9edf1; border-radius: 5px; color: #3b434b; background: white; font-size: 13px; }
.chart-wrap { height: 207px; padding: 7px 13px 0; }
.chart-wrap svg { width: 100%; height: 100%; overflow: visible; }
.chart-label { fill: #667281; font: 13px "DM Sans", sans-serif; }
.chart-grid { stroke: #edf0f3; stroke-dasharray: 3 4; }
.chart-area { fill: url(#chart-fill); }
.chart-line { fill: none; stroke: #ec5b27; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.4; }
.chart-point { fill: white; stroke: #ec5b27; stroke-width: 2; }
.lower-row { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(260px,.8fr); gap: 14px; margin-top: 14px; }
.table-wrap { width: 100%; overflow-x: auto; }
.compact-table { width: 100%; border-collapse: collapse; text-align: left; }
.compact-table th { padding: 11px 14px 9px; border-bottom: 1px solid #f0f2f5; color: #353b43; font-size: 13px; font-weight: 500; white-space: nowrap; }
.compact-table td { padding: 11px 14px; border-bottom: 1px solid #f3f5f7; color: #374354; font-size: 14px; white-space: nowrap; }
.compact-table tr:last-child td { border-bottom: 0; }
.cell-primary { color: var(--heading) !important; font-weight: 600; }
.customer-cell { display: flex; align-items: center; gap: 8px; }
.mini-avatar { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 7px; color: #44719b; background: #ecf3fa; font-size: 13px; font-weight: 600; }
.mini-avatar.v2 { color: #957443; background: #fbf3e6; }
.mini-avatar.v3 { color: #7870a3; background: #f0eef9; }
.mini-avatar.v4 { color: #875546; background: #f7efe8; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 20px; color: #8a6200; background: #fff3c4; font-size: 13px; font-weight: 600; }
.status::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.status.pending, .status.due, .status.scheduled, .status.expiring, .status.expiring-soon,
.status.finance-pending, .status.rto-pending, .status.insurance-pending, .status.pdi-pending,
.status.test-drive, .status.upcoming { color: #ba7c32; background: #fff4e5; }
.status.overdue, .status.low-stock, .status.out-of-stock, .status.cancelled, .status.lost, .status.expired { color: #c15a5c; background: #fff0ef; }
.status.draft, .status.inactive { color: #3e464f; background: #f0f2f5; }
.activity-list { padding: 3px 16px 9px; }
.activity-item { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid #f0f2f5; }
.activity-item:last-child { border: 0; }
.activity-icon { display: grid; width: 27px; height: 27px; flex: 0 0 auto; place-items: center; border-radius: 7px; color: #824431; background: #f7efe9; }
.activity-icon.orange { color: #bb8038; background: #fff3e4; }
.activity-icon.blue { color: #6584ad; background: #edf2fa; }
.activity-copy { min-width: 0; }
.activity-copy strong { display: block; margin: 1px 0 3px; color: #242b33; font-size: 14px; font-weight: 600; }
.activity-copy p { margin: 0; color: #353b43; font-size: 13px; }
.activity-time { margin-left: auto; color: #383d45; font-size: 13px; white-space: nowrap; }
.section-gap { margin-top: 15px; }
.list-toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid #edf0f3; }
.search-wrap { position: relative; flex: 1; max-width: 310px; }
.search-icon { position: absolute; top: 50%; left: 10px; color: #353b43; font-size: 16px; transform: translateY(-50%); pointer-events: none; }
.search-input, .filter-select { width: 100%; height: 33px; padding: 0 10px; border: 1px solid #e8ecf0; border-radius: 5px; outline: none; color: #354355; background: white; font-size: 14px; }
.search-input { padding-left: 29px; }
.search-input:focus, .filter-select:focus, .form-control:focus { border-color: #bc6f58; box-shadow: 0 0 0 3px rgba(164,53,19,.09); }
.filter-select { width: auto; min-width: 115px; }
.toolbar-spacer { flex: 1; }
.record-count { color: #353b43; font-size: 14px; white-space: nowrap; }
.table-main { width: 100%; border-collapse: collapse; text-align: left; }
.table-main th { padding: 11px 15px; border-bottom: 1px solid #edf0f3; color: #31383f; font-size: 13px; font-weight: 600; white-space: nowrap; }
.table-main td { padding: 12px 15px; border-bottom: 1px solid #f0f2f5; color: #374354; font-size: 14px; white-space: nowrap; }
.table-main tr:last-child td { border-bottom: 0; }
.row-action { padding: 4px 6px; border: 0; border-radius: 4px; color: #d34917; background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; }
.row-action:hover { background: #f9f2ec; }
.empty-state { padding: 34px 15px; color: #353b43; text-align: center; font-size: 14px; }
.empty-state strong { display: block; margin-bottom: 5px; color: #252c36; font-size: 15px; }
.notice-banner { display: flex; align-items: center; gap: 11px; margin: 0 0 15px; padding: 12px 14px; border: 1px solid #f3e9e1; border-radius: 7px; color: #43322d; background: #f9f3ef; font-size: 14px; }
.migration-notice { justify-content: space-between; border-color: #f1dfbd; color: #806b4b; background: #fff8eb; }
.migration-notice > span:nth-child(2) { flex: 1; }
.notice-banner strong { color: #733b2a; }
.notice-icon { display: grid; width: 25px; height: 25px; flex: 0 0 auto; place-items: center; border-radius: 6px; color: #d34a1a; background: #f4e7dd; }
.upload-card { display: grid; min-height: 260px; place-items: center; padding: 30px; border: 1px dashed #cbd6de; border-radius: 8px; background: rgba(255,255,255,.65); text-align: center; }
.upload-icon { display: grid; width: 48px; height: 48px; margin: 0 auto 12px; place-items: center; border-radius: 13px; color: var(--accent); background: #f8eee6; font-size: 20px; }
.upload-card h2 { margin: 0 0 6px; color: #572119; font: 700 17px Manrope, sans-serif; }
.upload-card p { max-width: 390px; margin: 0 auto 15px; color: #31383f; font-size: 14px; line-height: 1.6; }
.file-input { display: none; }
.upload-meta { margin-top: 12px; color: #383d45; font-size: 13px; }
.amort-layout { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(280px,.9fr); gap: 14px; }
.summary-strip { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 11px; margin-bottom: 14px; }
.summary-tile { padding: 14px; border: 1px solid #edf0f3; border-radius: 7px; background: white; }
.summary-tile span { display: block; margin-bottom: 7px; color: #31383f; font-size: 13px; }
.summary-tile strong { color: var(--heading); font: 700 19px Manrope,sans-serif; }
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 24px; min-height: 225px; padding: 16px; }
.donut { display: grid; width: 148px; height: 148px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: conic-gradient(#ec5822 0 58%, #ffd65c 58% 78%, #e9eef1 78% 100%); }
.donut-hole { display: grid; width: 103px; height: 103px; place-items: center; border-radius: 50%; background: white; text-align: center; }
.donut-hole strong { color: var(--heading); font: 700 21px Manrope,sans-serif; }
.donut-hole span { color: #353b43; font-size: 13px; }
.legend { display: grid; gap: 12px; }
.legend-item { display: flex; align-items: center; gap: 8px; color: #2d333c; font-size: 14px; }
.legend-item strong { display: block; margin-top: 3px; color: #394657; font-size: 14px; }
.legend-swatch { width: 8px; height: 8px; border-radius: 3px; background: #ec5822; }
.legend-swatch.second { background: #ffd65c; }
.legend-swatch.third { background: #e9eef1; }
.toast-region { position: fixed; z-index: 1000; inset: 0; margin: auto; width: max-content; max-width: min(92vw, 520px); height: max-content; padding: 0; border: 0; background: transparent; overflow: visible; display: grid; gap: 10px; pointer-events: none; }
.toast-region:not(:popover-open):not(:empty) { display: grid; }
.toast-region:empty { display: none; }
.toast { padding: 16px 22px; border: 1px solid #f1e1d5; border-left: 5px solid var(--brand, #b9382f); border-radius: 10px; color: #653122; background: white; box-shadow: 0 18px 50px rgba(45,23,20,.28); font-size: 16px; font-weight: 600; line-height: 1.4; text-align: center; animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
.record-dialog { width: min(540px, calc(100vw - 28px)); max-height: 90vh; padding: 0; overflow: auto; border: 1px solid #e9edf2; border-radius: 10px; box-shadow: 0 20px 70px rgba(59,23,17,.23); }
.record-dialog::backdrop { background: rgba(49,19,14,.38); backdrop-filter: blur(2px); }
.record-dialog form { padding: 22px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 19px; }
.dialog-heading .eyebrow { margin-bottom: 5px; }
.dialog-heading h2 { margin: 0; color: var(--heading); font: 700 21px Manrope,sans-serif; }
.dialog-close { width: 28px; height: 28px; border: 0; border-radius: 6px; color: #444b52; background: #f4f6f8; font-size: 20px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.settings-panel .panel-heading { padding-bottom: 15px; }
.settings-grid { padding: 0 17px 18px; }
.settings-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 17px 16px; border-top: 1px solid #edf0f3; }
.danger-action { color: #bb6460; }
.danger-action:hover { color: #a64441; background: #fff1ef; }
.settings-note .activity-list { padding-top: 8px; }
.form-field { display: grid; gap: 6px; min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { color: #2e363e; font-size: 14px; font-weight: 600; }
.form-control { width: 100%; min-height: 35px; padding: 8px 10px; border: 1px solid #e5e9ee; border-radius: 5px; outline: none; color: #334153; background: white; font-size: 14px; }
textarea.form-control { min-height: 70px; resize: vertical; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 14px; border-top: 1px solid #edf0f3; }
.muted { color: #51565c; }
.highlight-number { color: var(--accent); font-weight: 700; }
@media (min-width: 1600px) { .page-content { padding-right: 47px; padding-left: 47px; } }
@media (max-width: 1150px) {
  .sidebar { width: 260px; }
  .main-content { margin-left: 260px; }
  .topbar { padding: 0 24px; }
  .page-content { padding: 25px 24px 22px; }
  .overview-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .page-footer { padding-right: 24px; padding-left: 24px; }
}
@media (max-width: 780px) {
  .sidebar { width: 280px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 8px 0 26px rgba(47,18,14,.12); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { height: 58px; padding: 0 16px; }
  .mobile-menu { display: block; }
  .breadcrumb { margin-right: auto; margin-left: 8px; }
  .today-label, .topbar-divider { display: none; }
  .topbar-actions { gap: 9px; }
  .page-content { padding: 23px 16px 20px; }
  .dashboard-row, .lower-row, .amort-layout { grid-template-columns: 1fr; }
  .page-footer { gap: 7px; padding: 12px 16px; font-size: 13px; }
}
@media (max-width: 520px) {
  .overview-grid { gap: 9px; }
  .metric-card { min-height: 104px; padding: 12px; }
  .metric-value { font-size: 20px; }
  .page-intro { align-items: flex-start; flex-direction: column; margin-bottom: 17px; }
  .page-intro .button { align-self: flex-start; }
  h1 { font-size: 21px; }
  .page-footer { flex-direction: column; }
  .list-toolbar { flex-wrap: wrap; }
  .search-wrap { flex-basis: 100%; max-width: none; }
  .toolbar-spacer { display: none; }
  .summary-strip { grid-template-columns: 1fr; gap: 8px; }
  .summary-tile { padding: 11px; }
  .summary-tile strong { font-size: 17px; }
  .donut-wrap { flex-direction: column; gap: 17px; }
  .legend { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .record-dialog form { padding: 18px; }
  .settings-actions { align-items: flex-start; flex-direction: column; }
  .migration-notice { align-items: flex-start; flex-wrap: wrap; }
}

/* Login */
.login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px 16px; background: var(--canvas); }
.login-screen[hidden], .app-shell[hidden] { display: none; }
.login-card { width: 100%; max-width: 380px; padding: 28px; border: 1px solid #edf0f3; border-radius: 10px; background: white; box-shadow: var(--shadow); }
.login-card h1 { margin: 22px 0 4px; font: 800 22px Manrope, sans-serif; }
.login-sub { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand strong { display: block; font: 800 18px Manrope, sans-serif; }
.login-brand small { color: var(--soft); font-size: 12px; letter-spacing: 1px; }
.login-brand .brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: white; background: var(--green); font-weight: 800; }
#login-form { display: grid; gap: 14px; }
.login-error { margin: 0; padding: 8px 10px; border-radius: 5px; color: #c15a5c; background: var(--red-pale); font-size: 14px; }
.login-error[hidden] { display: none; }
.login-submit { justify-content: center; width: 100%; }
.login-demo { display: grid; gap: 4px; margin-top: 20px; padding: 12px; border-radius: 7px; color: #43322d; background: #f9f3ef; font-size: 14px; }
.login-demo code { padding: 1px 4px; border-radius: 3px; background: white; }
.login-demo small { color: var(--muted); }

/* Roles & user management */
.role-badge { padding: 4px 8px; border-radius: 20px; font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.role-badge.role-admin { color: #d04411; background: var(--green-pale); }
.role-badge.role-user { color: #2e363e; background: #eef1f5; }
.logout-button { border: 0; border-radius: 5px; color: #aab6c4; background: transparent; font-size: 18px; cursor: pointer; }
.logout-button:hover { color: white; background: rgba(255,255,255,.1); }
.user-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; align-items: end; padding: 16px 17px 18px; }
.role-select { width: auto; min-height: 30px; }
.status.active { color: #7c3520; background: #f8efe9; }

/* Notifications dropdown */
.notif-wrap { position: relative; }
.notif-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: 340px; max-width: calc(100vw - 32px); border: 1px solid #edf0f3; border-radius: 8px; background: white; box-shadow: 0 12px 32px rgba(67,26,20,.14); }
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid #f3f5f8; background: transparent; text-align: left; cursor: pointer; }
.notif-item:hover { background: #f8fafc; }
.notif-item .activity-copy { flex: 1; min-width: 0; }
.notif-item .activity-copy p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.notif-item .activity-time { font-size: 13px; }
.status.sign-in, .status.sign-out, .status.added, .status.restore, .status.backup, .status.converted, .status.printed, .status.message { color: #7c3520; background: #f8efe9; }
.status.edited, .status.user, .status.password, .status.imported { color: #ba7c32; background: #fff4e5; }
.status.deleted, .status.cleared { color: #c15a5c; background: #fff0ef; }
.sortable { cursor: pointer; user-select: none; } .sortable:hover { color: var(--green-dark); }

/* Global search */
.gsearch { position: relative; flex: 1; max-width: 340px; margin: 0 16px; }
.gsearch-input { width: 100%; height: 34px; padding: 0 12px; border: 1px solid #f1dfd2; border-radius: 17px; outline: none; color: var(--ink); background: white; font-size: 15px; }
.gsearch-input:focus { border-color: var(--green); }
.gsearch-panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: 420px; max-width: calc(100vw - 32px); max-height: 380px; overflow-y: auto; border: 1px solid #edf0f3; border-radius: 8px; background: white; box-shadow: 0 12px 32px rgba(27,43,60,.14); }
.gsearch-panel[hidden] { display: none; }
.gsearch-tag { flex: 0 0 74px; padding: 3px 6px; border-radius: 10px; color: var(--green-dark); background: var(--green-pale); font-size: 13px; font-weight: 700; text-align: center; }
@media (max-width: 760px) { .gsearch { display: none; } }

/* Kanban pipeline */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { min-height: 260px; padding: 10px; border: 1px solid #f1e1d5; border-radius: 8px; background: #fff3e8; }
.kanban-col.drag-over { outline: 2px dashed var(--green); background: #ffe9d6; }
.kanban-head { display: flex; justify-content: space-between; font-size: 15px; }
.kanban-head span { padding: 1px 8px; border-radius: 10px; color: white; background: var(--green); font-size: 14px; font-weight: 700; }
.kanban-sum { margin: 2px 0 10px; color: var(--muted); font-size: 14px; }
.kanban-card { display: grid; gap: 3px; margin-bottom: 8px; padding: 10px; border: 1px solid #f1dfd2; border-radius: 7px; background: white; box-shadow: var(--shadow); cursor: grab; font-size: 14px; }
.kanban-card strong { color: var(--ink); }
.kanban-card span { color: var(--muted); }
.kanban-late { color: var(--red); font-weight: 600; }
.kanban-move { display: flex; justify-content: space-between; }
.kanban-move button { padding: 1px 8px; border: 1px solid #f1dfd2; border-radius: 4px; color: var(--green-dark); background: transparent; cursor: pointer; }
.kanban-move button:disabled { opacity: .3; cursor: default; }
.kanban-empty { padding: 18px 6px; color: var(--soft); font-size: 14px; text-align: center; }

/* Calendar */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-legend { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); font-size: 14px; }
.cal-legend i { width: 9px; height: 9px; border-radius: 3px; }
.cal-legend .drive, .cal-event.drive { background: #ffe8d0; --edge: #f28c28; }
.cal-legend .service, .cal-event.service { background: #fff3c4; --edge: #e0b000; }
.cal-legend .delivery, .cal-event.delivery { background: #fde0da; --edge: #e4572e; }
.cal-legend .clash { background: #cf2e2e; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 8px; overflow-x: auto; }
.cal-day { min-height: 200px; padding: 8px; border: 1px solid #f1e1d5; border-radius: 8px; background: white; }
.cal-day.today { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.cal-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.cal-head span { color: var(--muted); }
.cal-event { margin-bottom: 5px; padding: 5px 6px; border-left: 3px solid var(--edge, #ccc); border-radius: 4px; color: #3a2a24; font-size: 14px; }
.cal-event.clash { border-left-color: #cf2e2e; font-weight: 700; }
.cal-empty { color: var(--soft); font-size: 14px; }

/* Reports bars, calculator, history */
.bar-list { display: grid; gap: 9px; padding: 14px 17px 17px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 80px; align-items: center; gap: 10px; font-size: 14px; }
.bar-label { overflow: hidden; color: #374354; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 9px; border-radius: 5px; background: #f6e9df; overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #f6b73c, #e4572e); }
.bar-value { color: var(--ink); font-weight: 600; text-align: right; }
.calc-result { display: grid; gap: 4px; margin: 14px 17px; padding: 18px; border-radius: 8px; color: white; background: linear-gradient(135deg, #e4572e, #f28c28); }
.calc-result span { font-size: 14px; opacity: .9; }
.calc-result strong { font: 800 28px Manrope, sans-serif; }
.history-strip { padding: 14px 17px 0; }

/* Dark mode */
html[data-theme="dark"] { color-scheme: dark; --ink: #f3e7e0; --muted: #b3a39b; --soft: #8d7f78; --line: #3a2a26; --canvas: #1c1311; --white: #271b18; --shadow: 0 6px 22px rgba(0,0,0,.35); --green-pale: #3b2018; --orange-pale: #3a2a18; --red-pale: #3b1c1c; }
html[data-theme="dark"] body { color: var(--ink); background: var(--canvas); }
html[data-theme="dark"] :is(.panel, .metric-card, .summary-tile, .login-card, .notif-panel, .gsearch-panel, .record-dialog, .cal-day, .kanban-card, .upload-card, .toast, .topbar, .page-footer) { border-color: #3a2a26; background: #271b18; color: var(--ink); }
html[data-theme="dark"] :is(.form-control, .search-input, .filter-select, .period-select, .gsearch-input, .button-secondary, .login-demo code) { border-color: #4a3732; background: #1f1512; color: var(--ink); }
html[data-theme="dark"] :is(.kanban-col) { border-color: #3a2a26; background: #231815; }
html[data-theme="dark"] .kanban-col.drag-over { background: #3b2218; }
html[data-theme="dark"] :is(h1, h2, .panel-heading h2, .cell-primary, .summary-tile strong, .metric-value, .donut-hole strong, .kanban-card strong, .bar-value, .login-card h1, .breadcrumb strong, .activity-copy strong, .dealer-copy strong) { color: var(--ink); }
html[data-theme="dark"] :is(.table-main td, .compact-table td, .bar-label, .cal-event, .breadcrumb, .page-intro > div > p:last-child) { color: #d4c4bc; border-color: #3a2a26; }
html[data-theme="dark"] :is(.table-main th, .compact-table th) { border-color: #3a2a26; color: #a8978f; }
html[data-theme="dark"] :is(.table-main td, .compact-table td, .notif-item, .notif-head, .list-toolbar, .panel-heading) { border-color: #3a2a26; }
html[data-theme="dark"] .notif-item:hover { background: #33241f; }
html[data-theme="dark"] .donut-hole { background: #271b18; }
html[data-theme="dark"] :is(.bar-track) { background: #3a2a26; }
html[data-theme="dark"] .notice-banner, html[data-theme="dark"] .login-demo { border-color: #4a3732; color: #d4c4bc; background: #2f211d; }
html[data-theme="dark"] .notice-banner strong { color: #ffb08a; }
html[data-theme="dark"] .row-action { border-color: #4a3732; color: #e9d8cf; background: transparent; }
html[data-theme="dark"] .cal-event { color: #2a1a16; }

/* Round 3 additions */
.stars { color: #f2a31b; letter-spacing: 1px; font-size: 15px; }
.range-field { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 14px; }
.range-field input { height: 30px; padding: 0 6px; border: 1px solid #e5e9ee; border-radius: 5px; color: var(--ink); background: white; font-size: 14px; }
.view-select { width: auto; min-width: 120px; }
.list-toolbar { flex-wrap: wrap; row-gap: 8px; }
.lang-select { height: 30px; padding: 0 6px; border: 1px solid #f1dfd2; border-radius: 6px; color: var(--ink); background: white; font-size: 14px; }
.task-check { border: 0; background: transparent; color: var(--green); font-size: 20px; line-height: 1; cursor: pointer; }
.task-check:hover { color: var(--green-dark); }
.target-input { width: 80px; min-height: 30px; }
.photo-row { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 17px; }
.photo { position: relative; margin: 0; }
.photo img { display: block; width: 190px; height: 130px; object-fit: cover; border-radius: 7px; border: 1px solid #f1dfd2; }
.photo-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%; color: white; background: rgba(0,0,0,.55); cursor: pointer; }
.detail-features { padding: 0 17px 10px; }
.detail-features textarea { resize: vertical; font-family: inherit; }
html[data-theme="dark"] :is(.range-field input, .lang-select) { border-color: #4a3732; background: #1f1512; color: var(--ink); }
html[data-theme="dark"] .photo img { border-color: #3a2a26; }
@media print {
  .sidebar, .topbar, .page-footer, .toast-region, .cal-toolbar, .button, .row-action { display: none !important; }
  .main-content { margin: 0 !important; }
  body { background: white; }
}

.brand-logo { width: 42px; height: 42px; object-fit: contain; flex: none; }
.login-brand .brand-logo { width: 48px; height: 48px; }
.brand { padding: 4px 8px; border-radius: 10px; background: #fff; margin: 0 0 20px; }
.brand-wordmark { display: block; width: 100%; max-width: 210px; height: auto; margin: 0 auto; }
.login-brand { justify-content: center; margin-bottom: 4px; }
.login-brand .brand-wordmark { max-width: 280px; }
.dealer-avatar.dealer-logo { background: #fff; padding: 3px; }
.dealer-avatar.dealer-logo img { width: 100%; height: 100%; object-fit: contain; }
.login-top { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 6px; }
.dealer-logo-top { width: 84px; height: 84px; object-fit: contain; }
.login-top .brand-wordmark { max-width: 280px; }
.login-partner { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; }
.login-partner img { width: 100%; max-width: 220px; height: auto; border-radius: 8px; }
.login-screen { background: linear-gradient(rgba(10,10,40,.35), rgba(10,10,40,.35)), url("assets/login-bg.svg") center / cover no-repeat; }
.login-card { box-shadow: 0 20px 60px rgba(0,0,20,.45); }
.login-screen { position: relative; }
.login-bg-brand { position: absolute; top: 28px; left: 36px; text-align: left; }
.login-bg-brand img { display: block; width: 300px; max-width: 60vw; height: auto; padding: 6px 14px; border-radius: 14px; background: #fff; box-shadow: 0 10px 30px rgba(0,0,20,.35); }
.login-bg-brand p { margin: 10px 4px 0; color: #fff; font-size: 16px; font-weight: 600; text-shadow: 0 2px 8px rgba(0,0,20,.6); }
@media (max-width: 700px) { .login-bg-brand { top: 14px; left: 14px; } .login-bg-brand img { width: 190px; } .login-bg-brand p { display: none; } .login-screen { padding-top: 90px; } }
.login-bg-brand p.powered { margin-top: 4px; font-size: 15px; font-weight: 700; letter-spacing: .4px; color: #ffc23d; }
.brand-plate { display: inline-flex; flex-direction: column; align-items: center; padding: 6px 18px 10px; border-radius: 14px; background: #fff; box-shadow: 0 10px 30px rgba(0,0,20,.35); }
.login-bg-brand .brand-plate img { padding: 0; border-radius: 0; background: none; box-shadow: none; }
.brand-plate .powered { margin-top: -4px; color: #e8801a; font-size: 15px; font-weight: 700; letter-spacing: .4px; }

/* Login v2: split layout */
.login-screen { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(360px,.85fr); align-items: stretch; padding: 0; background: linear-gradient(100deg, rgba(8,8,40,.82) 0%, rgba(8,8,40,.45) 55%, rgba(8,8,40,.2) 100%), url("assets/login-bg.svg") center / cover no-repeat; }
.login-screen[hidden] { display: none; }
.login-hero { display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 48px clamp(28px, 6vw, 90px); color: #fff; }
.login-hero h2 { max-width: 560px; margin: 8px 0 0; font: 800 clamp(28px, 3.4vw, 46px)/1.15 Manrope, sans-serif; letter-spacing: -1px; text-shadow: 0 3px 18px rgba(0,0,20,.5); }
.hero-sub { max-width: 500px; margin: 0; color: #dfe6ff; font-size: 18px; line-height: 1.55; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 0; padding: 0; list-style: none; }
.hero-chips li { padding: 9px 16px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; background: rgba(255,255,255,.12); backdrop-filter: blur(6px); font-size: 15px; font-weight: 600; }
.login-hero .brand-plate { align-self: flex-start; padding: 8px 22px 12px; }
.login-hero .brand-plate img { width: 280px; max-width: 100%; height: auto; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.login-card { max-width: 420px; padding: 32px 30px; border: 0; border-radius: 18px; box-shadow: 0 24px 70px rgba(0,0,20,.5); }
.login-top { margin-bottom: 8px; }
.dealer-logo-top { width: 76px; height: 76px; }
@media (max-width: 860px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 22px 8px; gap: 12px; }
  .login-hero h2 { font-size: 26px; }
  .hero-sub, .hero-chips { display: none; }
  .login-hero .brand-plate img { width: 200px; }
}
.login-hero { justify-content: flex-start; padding-top: 44px; gap: 14px; }
.login-hero h2 { max-width: 640px; font-size: clamp(26px, 3vw, 40px); }
.login-hero { justify-content: center; align-items: center; text-align: center; padding-top: 48px; gap: 22px; }
.login-hero .brand-plate { align-self: center; }
.login-hero .brand-plate img { width: 340px; }
.login-hero h2 { margin: 0 auto; }
.hero-chips { justify-content: center; }

/* Login v3: sign-in card centred, brand plate on top, chips at the bottom */
.login-screen { display: block; position: relative; min-height: 100vh; background: linear-gradient(rgba(8,8,40,.4), rgba(8,8,40,.4)), url("assets/login-bg.svg") center / cover no-repeat; }
.login-hero { display: contents; }
.login-hero h2 { display: none; }
.login-hero .brand-plate { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); padding: 4px 18px 8px; }
.login-hero .brand-plate img { width: 190px; }
.login-hero .brand-plate .powered { font-size: 13px; }
.login-hero .hero-chips { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); width: max-content; max-width: 94vw; }
.login-panel { min-height: 100vh; padding: 110px 16px 70px; }
@media (max-width: 860px) { .hero-chips { display: none; } .login-panel { padding: 100px 16px 30px; } }

/* Login v4: project info in the side space (wide screens) */
.hero-left, .hero-features { display: none; }
@media (min-width: 1200px) {
  .hero-chips { display: none; }
  .hero-left, .hero-features { display: block; position: absolute; top: 150px; width: min(430px, calc(50vw - 300px)); color: #fff; }
  .hero-left { left: clamp(28px, 4vw, 80px); }
  .login-hero .hero-left h2 { display: block; margin: 0 0 14px; text-align: left; font-size: clamp(26px, 2.4vw, 36px); }
  .hero-left p { margin: 0 0 22px; color: #dfe6ff; font-size: 17px; line-height: 1.6; text-shadow: 0 2px 10px rgba(0,0,20,.5); }
  .hero-stats { display: flex; gap: 12px; }
  .hero-stats div { flex: 1; padding: 12px 14px; border: 1px solid rgba(255,255,255,.25); border-radius: 12px; background: rgba(255,255,255,.1); backdrop-filter: blur(6px); }
  .hero-stats strong { display: block; color: #ffc23d; font: 800 24px Manrope, sans-serif; }
  .hero-stats span { font-size: 13px; color: #dfe6ff; }
  .hero-features { right: clamp(28px, 4vw, 80px); margin: 0; padding: 0; list-style: none; }
  .hero-features li { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; padding: 12px 16px; border: 1px solid rgba(255,255,255,.22); border-radius: 14px; background: rgba(255,255,255,.1); backdrop-filter: blur(6px); }
  .hero-features b { display: grid; flex: none; width: 44px; height: 44px; place-items: center; border-radius: 12px; background: #fff; font-size: 22px; }
  .hero-features strong { display: block; font-size: 16px; }
  .hero-features span { color: #dfe6ff; font-size: 13.5px; }
}
@media (min-width: 1200px) { .hero-left, .hero-features { text-align: left; } .hero-left p { text-align: left; } .hero-stats div { text-align: left; } }

/* Brand plate matches the sign-in card: same width, radius and shadow */
.login-hero .brand-plate { width: min(420px, calc(100vw - 32px)); flex-direction: row; justify-content: center; gap: 14px; padding: 8px 20px; border-radius: 18px; box-shadow: 0 24px 70px rgba(0,0,20,.5); }
.login-hero .brand-plate img { width: 170px; flex: none; }
.login-hero .brand-plate .powered { margin: 0; padding-left: 14px; border-left: 2px solid #e6e9f0; color: #5b6478; font-size: 13px; font-weight: 600; line-height: 1.3; letter-spacing: 0; }
.login-hero .brand-plate .powered b { display: block; color: #e8801a; font-size: 16px; font-weight: 800; }

/* Brand plate in the background's colours: navy-blue glass with the logo on a white chip */
.login-hero .brand-plate { background: linear-gradient(135deg, rgba(13,10,61,.88), rgba(10,75,255,.55)); border: 1px solid rgba(255,255,255,.3); backdrop-filter: blur(8px); gap: 16px; padding: 8px 16px; }
.login-hero .brand-plate img { width: 160px; padding: 2px 10px; border-radius: 12px; background: #fff; }
.login-hero .brand-plate .powered { border-left-color: rgba(255,255,255,.35); color: #dfe6ff; }
.login-hero .brand-plate .powered b { color: #ffc23d; }
.login-hero .brand-plate { background: none; border: 0; box-shadow: none; backdrop-filter: none; }
@media (min-width: 1200px) { .hero-left { top: 30px; } }
@media (min-width: 1200px) {
  .hero-left { top: 150px; }
  .login-hero .brand-plate { left: clamp(28px, 4vw, 80px); transform: none; width: auto; padding: 0; top: 28px; }
}
.footer-help { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer-help .help-icon { color: var(--accent); }
.footer-help strong { color: var(--ink); }
.footer-help a { color: var(--accent); font-weight: 600; text-decoration: none; }
.footer-help a:hover { text-decoration: underline; }

/* Bulk WhatsApp dialog */
.bulk-dialog { width: min(860px, calc(100vw - 24px)); }
.bulk-body { display: grid; gap: 12px; padding: 4px 22px 8px; }
.bulk-tabs { display: flex; gap: 8px; }
.bulk-tab { flex: 1; padding: 10px 12px; border: 1px solid #e5e9ee; border-radius: 8px; background: #fff; color: #2f353d; font-weight: 700; cursor: pointer; }
.bulk-tab small { font-weight: 500; color: #495056; }
.bulk-tab.active { border-color: var(--accent); background: #fff3ec; color: #b73a0d; }
.bulk-label { font-size: 13px; font-weight: 600; color: #2e363e; }
.bulk-api { padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.bulk-api.ok { background: #e8f7ee; color: #176b3a; }
.bulk-api.bad { background: #fdecea; color: #a12b2b; }
.bulk-api-fields { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.bulk-api-fields .form-field:first-child { flex: 1; min-width: 240px; }
.bulk-note { margin: 0; color: #353b43; font-size: 13px; line-height: 1.5; }
.bulk-table { max-height: 300px; overflow: auto; border: 1px solid #edf0f3; border-radius: 8px; }
.bulk-table td { white-space: normal; vertical-align: top; }
.bulk-msg { max-width: 360px; color: #374354; }
.bulk-invalid { opacity: .55; }
.bulk-status { display: inline-block; margin-right: 8px; padding: 3px 8px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.bulk-ok { background: #e8f7ee; color: #176b3a; } .bulk-bad { background: #fdecea; color: #a12b2b; } .bulk-wait { background: #fff3c4; color: #8a6200; }
.bulk-count { color: #353b43; font-size: 14px; }
.dialog-actions { display: flex; align-items: center; gap: 10px; padding: 12px 22px 18px; }
html[data-theme="dark"] .bulk-tab { background: #271b18; border-color: #4a3732; color: #d4c4bc; }
html[data-theme="dark"] .bulk-tab.active { background: #3b2218; color: #ffb08a; }
html[data-theme="dark"] .bulk-label, html[data-theme="dark"] .bulk-note, html[data-theme="dark"] .bulk-msg { color: #d4c4bc; }

body { font-weight: 500; }
.form-field label { font-weight: 700; color: #3a4656; }
.table-main th, .compact-table th { font-weight: 700; }
.table-main td, .compact-table td { color: #2f3b4b; font-weight: 500; }
.eyebrow, .metric-top, .metric-foot, .activity-copy p, .activity-time, .panel-heading p, .page-intro > div > p:last-child { font-weight: 500; }

/* Dark mode: text kept light after the light-mode contrast boost */
html[data-theme="dark"] .switcher-dots,
html[data-theme="dark"] .breadcrumb,
html[data-theme="dark"] .breadcrumb strong,
html[data-theme="dark"] .today-label,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .page-footer,
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .page-intro > div > p:last-child,
html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .metric-top,
html[data-theme="dark"] .metric-foot,
html[data-theme="dark"] .panel-heading p,
html[data-theme="dark"] .period-select,
html[data-theme="dark"] .compact-table th,
html[data-theme="dark"] .compact-table td,
html[data-theme="dark"] .activity-copy strong,
html[data-theme="dark"] .activity-copy p,
html[data-theme="dark"] .activity-time,
html[data-theme="dark"] .search-icon,
html[data-theme="dark"] .search-input, html[data-theme="dark"] .filter-select,
html[data-theme="dark"] .record-count,
html[data-theme="dark"] .table-main th,
html[data-theme="dark"] .table-main td,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .empty-state strong,
html[data-theme="dark"] .notice-banner,
html[data-theme="dark"] .upload-card p,
html[data-theme="dark"] .upload-meta,
html[data-theme="dark"] .summary-tile span,
html[data-theme="dark"] .donut-hole span,
html[data-theme="dark"] .legend-item,
html[data-theme="dark"] .legend-item strong,
html[data-theme="dark"] .dialog-close,
html[data-theme="dark"] .form-field label,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .login-demo,
html[data-theme="dark"] .bar-label,
html[data-theme="dark"] .table-main td, html[data-theme="dark"] .compact-table td { color: #d9cbc4; }
html[data-theme="dark"] .chart-label { fill: #cdbdb5; }
html[data-theme="dark"] .form-field label { color: #e6d8d0; }
html[data-theme="dark"] .table-main td, html[data-theme="dark"] .compact-table td { color: #e6d8d0; }

/* Letter preview dialog */
.letter-dialog { width: min(780px, calc(100vw - 24px)); }
.letter-body { padding: 4px 22px 8px; }
.letter-frame-wrap { height: 62vh; overflow: hidden; border: 1px solid #dfe4f0; border-radius: 8px; background: #e9ecf3; }
.letter-frame { width: 100%; height: 100%; border: 0; }

/* Neat dialog layout: fixed header and footer, only the middle scrolls */
.bulk-dialog, .letter-dialog { overflow: hidden; border: 0; border-radius: 16px; box-shadow: 0 30px 90px rgba(20,10,60,.4); }
.bulk-dialog[open], .letter-dialog[open] { display: flex; flex-direction: column; max-height: 90vh; }
.bulk-dialog .dialog-heading, .letter-dialog .dialog-heading { flex: none; align-items: center; margin: 0; padding: 18px 24px; border-bottom: 1px solid #e6e9f2; background: linear-gradient(90deg, #f4f6ff, #fff7ee); }
.bulk-dialog .dialog-heading h2, .letter-dialog .dialog-heading h2 { font-size: 21px; color: #0d0a3d; }
.bulk-dialog .dialog-close, .letter-dialog .dialog-close { width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 1px solid #dfe4f0; font-size: 22px; line-height: 1; }
.bulk-dialog .dialog-close:hover, .letter-dialog .dialog-close:hover { background: #f1f3fa; }
.bulk-body, .letter-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 24px; }
.bulk-body { gap: 14px; }
.bulk-dialog .dialog-actions, .letter-dialog .dialog-actions { flex: none; margin: 0; padding: 14px 24px; border-top: 1px solid #e6e9f2; background: #fafbff; }
.bulk-tab { padding: 12px 14px; border-radius: 10px; }
.bulk-table { max-height: none; overflow: visible; }
.bulk-table th { position: static; background: #f6f8fd; }
.bulk-table td, .bulk-table th { padding: 10px 12px; }
.bulk-dialog textarea.form-control { resize: vertical; min-height: 90px; line-height: 1.5; }
@media (max-width: 640px) {
  .bulk-dialog, .letter-dialog { width: calc(100vw - 16px); }
  .bulk-body, .letter-body, .bulk-dialog .dialog-heading, .letter-dialog .dialog-heading, .bulk-dialog .dialog-actions, .letter-dialog .dialog-actions { padding-left: 14px; padding-right: 14px; }
  .bulk-dialog .dialog-actions, .letter-dialog .dialog-actions { flex-wrap: wrap; }
}
html[data-theme="dark"] .bulk-dialog .dialog-heading, html[data-theme="dark"] .letter-dialog .dialog-heading { background: #2f211d; border-color: #3a2a26; }
html[data-theme="dark"] .bulk-dialog .dialog-heading h2, html[data-theme="dark"] .letter-dialog .dialog-heading h2 { color: #f3e7e0; }
html[data-theme="dark"] .bulk-dialog .dialog-actions, html[data-theme="dark"] .letter-dialog .dialog-actions { background: #231815; border-color: #3a2a26; }
html[data-theme="dark"] .bulk-table th { background: #2f211d; }
.letter-frame-wrap { max-height: 58vh; overflow: auto; border: 1px solid #dfe4f0; border-radius: 10px; background: #e9ecf3; padding: 10px; display: flex; justify-content: center; }
.letter-scaler { position: relative; flex: none; }
.letter-frame { position: absolute; left: 0; top: 0; border: 0; background: transparent; }

/* EMI tracker */
.emi-alert { border: 1px solid #f0b9b6; border-top: 4px solid #cf3b3b; background: #fff7f6; }
.emi-alert .panel-heading h2 { color: #a42727; }
.emi-badge { display: grid; min-width: 38px; height: 38px; place-items: center; border-radius: 50%; color: #fff; background: #cf3b3b; font: 800 17px Manrope, sans-serif; }
.emi-clear { margin: 14px 17px 17px; padding: 14px; border-radius: 10px; color: #176b3a; background: #e8f7ee; font-weight: 600; }
.emi-watch { padding: 6px 0 4px; border-top: 1px dashed #eec9c6; }
.emi-watch h3 { margin: 14px 17px 4px; color: #8a6200; font: 700 14px Manrope, sans-serif; }
.emi-row-flagged td { background: #ffe9e7; }
.emi-row-flagged td:first-child { box-shadow: inset 4px 0 0 #cf3b3b; }
.emi-row-late td { background: #fff6dc; }
.emi-strip { grid-template-columns: repeat(4, minmax(0,1fr)); margin: 14px 17px; }
.emi-strip small { display: block; margin-top: 4px; color: #566273; }
.emi-chart-wrap { padding: 0 17px 6px; }
.emi-chart { width: 100%; height: auto; }
.emi-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 4px 0 10px; color: #374354; font-size: 13px; }
.emi-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.emi-sched { max-height: 440px; overflow-y: auto; }
.emi-sched thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.nav-alert { min-width: 20px; padding: 1px 6px; border-radius: 10px; color: #fff !important; background: #cf3b3b; font-weight: 700; text-align: center; }
@media (max-width: 800px) { .emi-strip { grid-template-columns: 1fr 1fr; } }
html[data-theme="dark"] .emi-alert { border-color: #6a2b2b; background: #2b1717; }
html[data-theme="dark"] .emi-alert .panel-heading h2 { color: #ff9a96; }
html[data-theme="dark"] .emi-row-flagged td { background: #3d1f1f; }
html[data-theme="dark"] .emi-row-late td { background: #3a3018; }
html[data-theme="dark"] .emi-sched thead th { background: #271b18; }
html[data-theme="dark"] .emi-legend, html[data-theme="dark"] .emi-strip small { color: #d4c4bc; }
html[data-theme="dark"] .emi-chart line { stroke: #4a3732; }
.emi-alert { margin-bottom: 16px; }

/* Customer-wise EMI */
.emi-cust { border-left: 4px solid #0a4bff; }
.emi-cust-flagged { border-left-color: #cf3b3b; background: #fff7f6; }
.emi-loan { padding: 4px 0 10px; border-top: 1px solid #edf0f6; }
.emi-loan:first-of-type { border-top: 0; }
.emi-loan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 17px 0; }
.emi-loan-head small { color: #566273; }
.emi-sched-c { max-height: 300px; margin: 0 17px; border: 1px solid #edf0f6; border-radius: 8px; }
.emi-loan .emi-strip { margin: 12px 17px; }
html[data-theme="dark"] .emi-cust-flagged { background: #2b1717; }
html[data-theme="dark"] .emi-loan { border-color: #3a2a26; }
html[data-theme="dark"] .emi-loan-head small { color: #d4c4bc; }
.status.ok { color: #176b3a; background: #e3f6ea; }
.search-wrap { min-width: 220px; }
html[data-theme="dark"] .status.ok { color: #7fe0a6; background: #17301f; }
.emi-sched-c { width: auto; }

/* In-app confirm / prompt dialogs (replace browser pop-ups) */
.ui-dialog { width: min(440px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 90px rgba(20,10,60,.4); }
.ui-dialog::backdrop { background: rgba(30,14,50,.45); backdrop-filter: blur(3px); }
.ui-form { padding: 24px; }
.ui-head { display: flex; gap: 14px; align-items: flex-start; }
.ui-head h2 { margin: 0 0 6px; color: #0d0a3d; font: 800 20px Manrope, sans-serif; }
.ui-head p { margin: 0; color: #4b5666; font-size: 15px; line-height: 1.5; }
.ui-icon { display: grid; flex: none; width: 44px; height: 44px; place-items: center; border-radius: 50%; color: #0a4bff; background: #e8efff; font: 800 22px Manrope, sans-serif; }
.ui-icon.ui-danger { color: #cf3b3b; background: #fdeaea; }
.ui-fields { display: grid; gap: 14px; margin-top: 18px; }
.ui-field { display: grid; gap: 6px; }
.ui-field span { color: #3a4656; font-size: 14px; font-weight: 700; }
.ui-error { margin: 12px 0 0; padding: 9px 12px; border-radius: 8px; color: #a12b2b; background: #fdecea; font-size: 14px; font-weight: 600; }
.ui-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.button-danger { color: #fff; background: #cf3b3b; border-color: #cf3b3b; }
.button-danger:hover { background: #b32f2f; }
html[data-theme="dark"] .ui-dialog { background: #271b18; color: #f3e7e0; }
html[data-theme="dark"] .ui-head h2 { color: #f3e7e0; }
html[data-theme="dark"] .ui-head p, html[data-theme="dark"] .ui-field span { color: #d4c4bc; }
html[data-theme="dark"] .ui-icon { background: #1d2a52; color: #8fb0ff; }
html[data-theme="dark"] .ui-icon.ui-danger { background: #3b1c1c; color: #ff9a96; }

/* SV logo loader */
.sv-loader { width: fit-content; height: fit-content; max-width: none; max-height: none; padding: 0; border: 0; background: transparent; overflow: visible; }
.sv-loader::backdrop { background: rgba(255,248,241,.72); backdrop-filter: blur(5px); }
.sv-loader-card { display: grid; justify-items: center; gap: 18px; padding: 30px 44px; border-radius: 22px; background: #fff; box-shadow: 0 24px 70px rgba(30,14,80,.28); }
.sv-ring { position: relative; display: grid; width: 112px; height: 112px; place-items: center; }
.sv-ring span { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(10,75,255,0) 0deg, #0a4bff 150deg, #f7931e 300deg, rgba(247,147,30,0) 360deg); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px)); animation: sv-spin 1.1s linear infinite; }
.sv-ring img { width: 72px; height: 72px; object-fit: contain; animation: sv-pulse 1.4s ease-in-out infinite; }
.sv-loader-text { margin: 0; color: #0d0a3d; font: 700 16px Manrope, sans-serif; letter-spacing: .2px; }
@keyframes sv-spin { to { transform: rotate(360deg); } }
@keyframes sv-pulse { 0%, 100% { transform: scale(.94); opacity: .85; } 50% { transform: scale(1.04); opacity: 1; } }
html[data-theme="dark"] .sv-loader::backdrop { background: rgba(20,12,10,.7); }
html[data-theme="dark"] .sv-loader-card { background: #271b18; }
html[data-theme="dark"] .sv-loader-text { color: #f3e7e0; }
@media (prefers-reduced-motion: reduce) { .sv-ring span, .sv-ring img { animation-duration: 3s; } }
.emi-legend i.dash { width: 18px; height: 0; border-top: 3px dotted #a9bdf3; border-radius: 0; background: none; vertical-align: 3px; }
.emi-chart-wrap { padding: 6px 22px 8px; }
.emi-legend { gap: 16px; }

/* Account menu (top bar) */
.profile-wrap { position: relative; }
.profile-trigger { border: 0; cursor: pointer; transition: box-shadow .15s; }
.profile-trigger:hover, .profile-trigger[aria-expanded="true"] { box-shadow: 0 0 0 3px rgba(10,75,255,.18); }
.profile-menu { position: absolute; top: calc(100% + 10px); right: 0; z-index: 40; width: 280px; padding: 8px; border: 1px solid #e6e9f2; border-radius: 14px; background: #fff; box-shadow: 0 18px 50px rgba(20,10,60,.22); }
.profile-menu[hidden] { display: none; }
.profile-menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; border-bottom: 1px solid #edf0f6; margin-bottom: 6px; }
.profile-menu-head .topbar-avatar { width: 40px; height: 40px; font-size: 15px; }
.profile-menu-head strong { display: block; color: #0d0a3d; font-size: 15px; }
.profile-menu-head small { color: #566273; font-size: 13px; }
.profile-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 9px; color: #2a3445; background: transparent; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; }
.profile-item span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: #f2f5fb; font-size: 15px; }
.profile-item:hover { background: #f4f6ff; }
.profile-sep { height: 1px; margin: 6px 4px; background: #edf0f6; }
.profile-signout { color: #b32f2f; }
.profile-signout span { background: #fdeaea; }
.profile-signout:hover { background: #fff1f0; }
.forgot-link { display: block; margin: 12px auto 0; border: 0; color: #0a4bff; background: none; font-size: 14px; font-weight: 600; cursor: pointer; }
.forgot-link:hover { text-decoration: underline; }
html[data-theme="dark"] .profile-menu { border-color: #3a2a26; background: #271b18; }
html[data-theme="dark"] .profile-menu-head { border-color: #3a2a26; }
html[data-theme="dark"] .profile-menu-head strong { color: #f3e7e0; }
html[data-theme="dark"] .profile-menu-head small { color: #d4c4bc; }
html[data-theme="dark"] .profile-item { color: #eadfd8; }
html[data-theme="dark"] .profile-item span { background: #35261f; }
html[data-theme="dark"] .profile-item:hover { background: #33241f; }
html[data-theme="dark"] .profile-sep { background: #3a2a26; }
html[data-theme="dark"] .forgot-link { color: #8fb0ff; }
.profile-menu-head strong, .profile-menu-head small, .profile-item { letter-spacing: normal; text-transform: none; }

/* Lead pipeline at scale */
.kanban { grid-template-columns: repeat(var(--cols, 6), minmax(240px, 1fr)); align-items: start; }
.kanban-col { display: flex; flex-direction: column; max-height: calc(100vh - 330px); min-height: 300px; }
.kanban-head { align-items: center; }
.kh-title { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.kanban-cards { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 2px 4px 4px 0; scrollbar-width: thin; }
.kanban-card { gap: 4px; }
.kc-top { display: flex; align-items: center; gap: 8px; }
.kc-check { flex: none; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.kc-name { flex: 1; min-width: 0; padding: 0; border: 0; color: var(--ink); background: none; font: 700 15px "DM Sans", sans-serif; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-name:hover { color: var(--accent); text-decoration: underline; }
.kc-owner { display: grid; flex: none; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #0a4bff; background: #e8efff; font-size: 11px; font-weight: 800; }
.kc-veh { color: var(--ink); }
.kc-meta { font-size: 13px; }
.kc-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; }
.kc-due { padding: 2px 8px; border-radius: 10px; color: #4b5666; background: #f1f3f8; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.kc-due-late { color: #b32f2f; background: #fdeaea; }
.kc-due-today { color: #8a5a00; background: #fff0c9; }
.kc-due-soon { color: #176b3a; background: #e3f6ea; }
.kc-actions { display: flex; align-items: center; gap: 4px; }
.kc-actions button, .kc-icon { padding: 2px 7px; border: 1px solid #f1dfd2; border-radius: 6px; color: var(--green-dark); background: #fff; font-size: 13px; line-height: 1.5; text-decoration: none; cursor: pointer; }
.kc-actions button:disabled { opacity: .3; cursor: default; }
.kc-actions button:not(:disabled):hover, .kc-icon:hover { background: #fff3ec; }
.kanban-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(215,71,17,.2); background: #fffaf6; }
.kanban-more { width: 100%; margin: 2px 0 8px; padding: 9px; border: 1px dashed #e3b9a3; border-radius: 8px; color: #b73a0d; background: #fff; font-weight: 700; cursor: pointer; }
.kanban-more small { color: #566273; font-weight: 500; }
.pl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.pl-chip { padding: 8px 14px; border: 1px solid #e5e9ee; border-radius: 999px; color: #374354; background: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.pl-chip-late { color: #b32f2f; border-color: #f0b9b6; background: #fff4f3; }
.pl-chip-today { color: #8a5a00; border-color: #f2d58a; background: #fff8e6; }
.pl-chip.active { color: #fff; border-color: #0d0a3d; background: #0d0a3d; }
.pl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.pl-toolbar .search-wrap { flex: 1 1 240px; min-width: 220px; }
.pl-toolbar .filter-select { width: auto; min-width: 150px; }
.pl-check { display: flex; align-items: center; gap: 6px; color: #374354; font-size: 14px; font-weight: 600; cursor: pointer; }
.pl-bulk { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 14px; border: 1px solid #0d0a3d; border-radius: 12px; color: #fff; background: #0d0a3d; box-shadow: 0 10px 30px rgba(13,10,61,.3); }
.pl-bulk select { height: 34px; padding: 0 8px; border: 0; border-radius: 6px; color: #1c2333; background: #fff; font-size: 14px; }
.pl-bulk .button-secondary { color: #0d0a3d; background: #fff; }
.pl-bulk .button-link { color: #ffc23d; }
html[data-theme="dark"] .kc-name, html[data-theme="dark"] .kc-veh { color: #f3e7e0; }
html[data-theme="dark"] .kc-actions button, html[data-theme="dark"] .kc-icon, html[data-theme="dark"] .kanban-more, html[data-theme="dark"] .pl-chip { color: #eadfd8; background: #271b18; border-color: #4a3732; }
html[data-theme="dark"] .kc-due { color: #d4c4bc; background: #35261f; }
html[data-theme="dark"] .kanban-card.is-selected { background: #33241f; }
html[data-theme="dark"] .pl-check { color: #d4c4bc; }
html[data-theme="dark"] .pl-chip.active { color: #0d0a3d; background: #ffc23d; }
.kanban-card { min-width: 0; }
.kc-foot { display: flex; align-items: center; margin-top: 2px; }
.kc-actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; padding-top: 8px; border-top: 1px solid #f3e6dc; }
.kc-arrows, .kc-comm { display: flex; gap: 6px; }
.kc-icon { display: inline-grid; place-items: center; width: 34px; height: 30px; padding: 0 !important; }
.kc-comm .kc-icon:last-child { color: #1f9d55; }
.kc-comm .kc-icon:first-child { color: #0a4bff; }
.kc-arrows button { width: 34px; height: 30px; padding: 0 !important; }
html[data-theme="dark"] .kc-actions { border-color: #3a2a26; }

/* Save status in the top bar */
.sync-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.sync-pill i { font-style: normal; font-size: 11px; }
.sync-ok { color: #176b3a; background: #e3f6ea; }
.sync-busy { color: #8a5a00; background: #fff0c9; }
.sync-bad { color: #a12b2b; background: #fdeaea; }
.sync-busy i { display: inline-block; animation: sv-spin 1s linear infinite; }
html[data-theme="dark"] .sync-ok { color: #7fe0a6; background: #17301f; }
html[data-theme="dark"] .sync-busy { color: #ffd37a; background: #3a3018; }
html[data-theme="dark"] .sync-bad { color: #ff9a96; background: #3b1c1c; }
@media (max-width: 900px) { .sync-pill { display: none; } }

/* Letter preview v2 */
.letter-dialog { width: min(900px, calc(100vw - 24px)); }
.letter-dialog .dialog-heading h2 { margin: 0; }
.letter-sub { margin: 3px 0 0; color: #566273; font-size: 13.5px; }
.letter-body { display: flex; flex-direction: column; gap: 12px; padding: 14px 24px; overflow: hidden; }
.letter-stage { display: flex; justify-content: center; align-items: flex-start; height: min(68vh, 760px); overflow: auto; border-radius: 12px; background: radial-gradient(circle at 50% 0, #eef1fa, #dfe4f1); padding: 12px; }
.letter-scaler { position: relative; flex: none; box-shadow: 0 14px 40px rgba(20,24,70,.28), 0 2px 6px rgba(20,24,70,.15); background: #fff; }
.letter-frame { position: absolute; left: 0; top: 0; border: 0; background: #fff; }
.letter-pager { display: flex; align-items: center; justify-content: center; gap: 14px; }
.letter-count { min-width: 260px; text-align: center; color: #374354; font-size: 14px; font-weight: 600; }
html[data-theme="dark"] .letter-sub, html[data-theme="dark"] .letter-count { color: #d4c4bc; }
html[data-theme="dark"] .letter-stage { background: radial-gradient(circle at 50% 0, #2c2420, #1d1714); }

/* Letter preview: warm theme to match the SV-red letters */
.letter-dialog .dialog-heading { background: linear-gradient(90deg, #fff3f1, #fff); }
.letter-stage { background: radial-gradient(circle at 50% 0, #f4eeee, #e6dcdc); }
html[data-theme="dark"] .letter-dialog .dialog-heading { background: #2f211d; }
html[data-theme="dark"] .letter-stage { background: radial-gradient(circle at 50% 0, #2c2420, #1d1714); }

/* Customer ID under names + history finder */
.cust-wrap { display: grid; gap: 2px; }
.cid { margin-left: 34px; color: #7b6a6a; font-size: 12px; font-weight: 600; letter-spacing: .3px; }
.history-find { min-width: 280px; height: 36px; padding: 0 10px; }
html[data-theme="dark"] .cid { color: #c9b6ae; }
.cid.plain { margin-left: 0; }

/* ---- Vehicle sale desk ---- */
.sale-dialog { width: min(1020px, calc(100vw - 24px)); max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; }
.sale-dialog[open] { display: flex; }
.sale-form { display: flex; flex-direction: column; min-height: 0; max-height: 94vh; padding: 0 !important; }
.sale-form .dialog-heading { flex: none; margin: 0; padding: 16px 22px; border-bottom: 1px solid #edf0f3; background: linear-gradient(90deg, #fff4f2, #fff9f0); }
.sale-form .dialog-actions { flex: none; margin: 0; padding: 12px 22px; border-top: 1px solid #edf0f3; background: #fffdfb; }
.sale-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 22px 8px; }
.sale-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.sale-tile { padding: 11px 13px; border: 1px solid #edf0f3; border-left: 4px solid var(--brand); border-radius: 7px; background: #fff; }
.sale-tile span { display: block; margin-bottom: 4px; color: #3a424a; font-size: 12.5px; font-weight: 600; }
.sale-tile strong { color: #3b1711; font: 800 18px Manrope, sans-serif; }
.sale-tile.warn { border-left-color: #d97706; background: #fffaf0; }
.sale-tile.ok { border-left-color: #15803d; background: #f3fbf5; }
.sale-tile.bad strong { color: #b91c1c; }
.sale-sec { margin-bottom: 14px; padding: 14px 16px 16px; border: 1px solid #edf0f3; border-radius: 9px; background: #fff; }
.sale-sec h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin: 0 0 12px; color: var(--heading); font: 800 16px Manrope, sans-serif; }
.sale-sec h3 small { flex-basis: 100%; margin-left: 33px; color: #4b5560; font: 500 12.5px "DM Sans", sans-serif; }
.sale-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font: 800 12px Manrope, sans-serif; }
.sale-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-hint { color: #4b5560; font-size: 12.5px; }
.sale-locked { margin: 0; padding: 10px 12px; border-radius: 7px; background: #f6f7f9; color: #4b5560; font-size: 13.5px; }
.sale-table { margin-bottom: 10px; }
.sale-files { margin: 12px 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.sale-files li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 11px; border: 1px solid #edf0f3; border-radius: 7px; background: #fffdfb; }
.sale-files a { color: #8c0a0a; font-weight: 700; }
.sale-files small { color: #4b5560; }
.sale-files .muted { color: #4b5560; }
.sale-files .row-action { margin-left: auto; }
.sale-uploads, .sale-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.sale-uploads .button { cursor: pointer; }
.sale-status { display: inline-block; padding: 8px 12px; border-radius: 7px; font-weight: 700; font-size: 13.5px; }
.sale-status.ok { background: #e8f6ec; color: #14612f; }
.sale-status.warn { background: #fff3df; color: #8a4b00; }
.sale-rate { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sale-rate .form-control { flex: 1; min-width: 200px; }
.stars-input { display: flex; gap: 2px; }
.star-btn { border: 0; background: none; color: #c9ced4; font-size: 30px; line-height: 1; cursor: pointer; padding: 0 2px; }
.star-btn.on { color: #f59e0b; }
.star-btn:hover { transform: scale(1.12); }
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.chip-ok { background: #e8f6ec; color: #14612f; }
.chip-warn { background: #fff3df; color: #8a4b00; }
.amount-due { color: #b91c1c; font-weight: 800; }
.amount-clear { color: #14612f; font-weight: 700; }
@media (max-width: 760px) {
  .sale-grid3 { grid-template-columns: 1fr; }
  .sale-body { padding: 12px 12px 6px; }
  .sale-form .dialog-heading, .sale-form .dialog-actions { padding-left: 14px; padding-right: 14px; }
}
html[data-theme="dark"] :is(.sale-sec, .sale-tile, .sale-files li) { border-color: #3a2a26; background: #271b18; color: var(--ink); }
html[data-theme="dark"] :is(.sale-sec h3, .sale-tile strong, .sale-files a) { color: var(--ink); }
html[data-theme="dark"] :is(.sale-tile span, .field-hint, .sale-files small, .sale-locked) { color: #e6d8d0; }
html[data-theme="dark"] .sale-locked { background: #2f211d; }
html[data-theme="dark"] .sale-form .dialog-heading, html[data-theme="dark"] .sale-form .dialog-actions { background: #2f211d; border-color: #3a2a26; }

/* ---- Finance desk ---- */
.fin-photo { display: inline-flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; }
.fin-photo img { width: 120px; height: 150px; object-fit: cover; border: 2px solid var(--brand); border-radius: 8px; background: #f4f6f8; }
.fin-photo small { color: #4b5560; font-weight: 600; }
.sale-sec button[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- Daybook, reminders, backup status ---- */
.day-input { width: auto; }
.daybook-strip { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.mode-list { display: block; font-size: 14px !important; line-height: 1.5; }
.offsite-list { margin: 0; padding: 4px 22px 18px; list-style: none; display: grid; gap: 10px; }
.offsite-list li { color: #2e363e; font-size: 14px; line-height: 1.5; }
.offsite-list code { padding: 1px 5px; border-radius: 4px; background: #f4f6f8; font-size: 12.5px; word-break: break-all; }
html[data-theme="dark"] .offsite-list li { color: #e6d8d0; }
html[data-theme="dark"] .offsite-list code { background: #2f211d; }

/* ---- Branches ---- */
.branch-pill { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 6px 11px; border: 1px solid #f0cfc9; border-radius: 999px; background: #fff4f2; color: #7a0a0a; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.branch-pill select { max-width: 170px; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer; outline: none; }
.branch-pill.branch-none { background: #fff3df; border-color: #f2d49b; color: #8a4b00; }
.branch-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 8px 10px; border: 1px solid #edf0f3; border-radius: 8px; }
.branch-checks legend { padding: 0 6px; color: #2e363e; font-size: 13px; font-weight: 700; }
.branch-checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.ui-fields.branch-checks { flex-direction: column; flex-wrap: nowrap; }
.letter-branch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #3a4656; }
.letter-branch select { padding: 7px 10px; border: 1px solid #dfe4f0; border-radius: 8px; background: #fff; font: inherit; }
html[data-theme="dark"] .branch-pill { background: #2f211d; border-color: #3a2a26; color: #f3d9d2; }
html[data-theme="dark"] :is(.branch-checks legend, .letter-branch) { color: #e6d8d0; }
@media (max-width: 760px) { .branch-pill { max-width: 150px; } }

/* ---- Dashboard branch cards ---- */
.branch-strip { margin-bottom: 16px; }
.branch-strip-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.branch-strip-head h2 { margin: 0; color: var(--heading); font: 800 16px Manrope, sans-serif; }
.branch-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.branch-card { display: grid; gap: 6px; padding: 14px; border: 1px solid #edf0f3; border-left: 4px solid #d9c9c5; border-radius: 9px; background: #fff; text-align: left; font: inherit; color: inherit; cursor: pointer; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.branch-card:hover { transform: translateY(-2px); border-left-color: var(--brand); }
.branch-card.active { border-color: var(--brand); border-left-color: var(--brand); background: #fff6f4; }
.branch-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.branch-card-head strong { color: #3b1711; font: 800 15px Manrope, sans-serif; }
.branch-card-head em { padding: 2px 8px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; white-space: nowrap; }
.branch-card small { color: #4b5560; font-size: 12.5px; }
.branch-card-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 10px; margin-top: 4px; font-size: 12.5px; color: #3a424a; }
.branch-card-stats b { margin-right: 5px; color: #3b1711; font: 800 15px Manrope, sans-serif; }
.branch-card-val { padding-top: 6px; border-top: 1px dashed #e6dcd9; color: #14612f; font-weight: 700; font-size: 13px; }
html[data-theme="dark"] .branch-card { border-color: #3a2a26; background: #271b18; }
html[data-theme="dark"] .branch-card.active { background: #33201b; }
html[data-theme="dark"] :is(.branch-card-head strong, .branch-card-stats b, .branch-strip-head h2) { color: var(--ink); }
html[data-theme="dark"] :is(.branch-card small, .branch-card-stats) { color: #e6d8d0; }

/* ---- Page access picker ---- */
.page-access { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; }
.page-access .pa-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; padding: 8px 4px 2px; max-height: 240px; overflow: auto; }
.page-access .pa-mode { font-weight: 700; }
.page-access .pa-list[hidden] { display: none; }

.field-hint.cid-ok { color: #14612f; font-weight: 700; }
.field-hint.cid-bad { color: #b91c1c; font-weight: 700; }

/* ---- Colour themes (a showroom picks one; Crimson is the default defined in :root) ---- */
html[data-palette="ocean"] { --brand: #0b5cad; --accent: #1666c1; --accent-dark: #0f4f9f; --heading: #0d2f52; --nav-active: #1d507f; --navy: #0d2a4a; --navy-2: #143d68; --canvas: #f3f8fd; --green: #2b7bd1; --green-dark: #1b62b0; --green-pale: #e4effb; }
html[data-palette="emerald"] { --brand: #0f7b4f; --accent: #12905b; --accent-dark: #0c744a; --heading: #0c3b2a; --nav-active: #1a5c42; --navy: #0b3325; --navy-2: #11452f; --canvas: #f3faf6; --green: #1fa56f; --green-dark: #178a5b; --green-pale: #e3f6ec; }
html[data-palette="violet"] { --brand: #6a2fb5; --accent: #7c3aed; --accent-dark: #6527cc; --heading: #2e1760; --nav-active: #4a2590; --navy: #26124e; --navy-2: #371a6e; --canvas: #f8f5ff; --green: #8b5cf6; --green-dark: #6d3fd9; --green-pale: #efe8fe; }
html[data-palette="slate"] { --brand: #374151; --accent: #3b4a63; --accent-dark: #2d3a50; --heading: #1f2937; --nav-active: #3a475a; --navy: #1f2733; --navy-2: #2b3544; --canvas: #f6f7f9; --green: #4b5d7a; --green-dark: #3b4a63; --green-pale: #e9edf3; }

/* ---- Plans, showrooms, branding ---- */
.plan-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font: 800 12px Manrope, sans-serif; letter-spacing: .02em; white-space: nowrap; }
.plan-silver { background: #eceff3; color: #374151; border: 1px solid #cfd5dd; }
.plan-gold { background: #fff3cf; color: #7a5200; border: 1px solid #f0cf72; }
.plan-premium { background: #efe8fe; color: #4b21a8; border: 1px solid #cdb8f6; }
.usage { padding: 4px 22px 20px; }
.usage-bar { height: 10px; border-radius: 99px; background: #edf0f3; overflow: hidden; margin: 6px 0 6px; }
.usage-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.plan-list { padding: 4px 22px 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px 26px; }
.plan-features { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.plan-features li { font-size: 14px; color: #2e363e; }
.plan-features li.off { color: #8a929b; }
.plan-features li span { display: inline-block; width: 22px; }
.sr-group { margin: 8px 0 4px; }
.sr-group > b { color: var(--heading); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.sr-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 14px; margin-top: 6px; }
.sr-feature { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; font-weight: 600; }
.pm-table .pm-cell { text-align: center; width: 150px; }
.pm-table .pm-group td { background: #fbf4f1; font-weight: 800; color: var(--heading); text-transform: uppercase; font-size: 12px; letter-spacing: .06em; }
.pm-yes { color: #14612f; font-weight: 800; font-size: 17px; }
.pm-no { color: #b3bac2; }
.logo-row { display: flex; align-items: center; gap: 16px; }
.logo-row img { width: 84px; height: 84px; object-fit: contain; padding: 6px; border: 1px solid #e3e7ec; border-radius: 12px; background: #fff; }
.theme-row { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-swatch { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 2px solid #e3e7ec; border-radius: 10px; background: #fff; font: 700 13px "DM Sans", sans-serif; cursor: pointer; }
.theme-swatch .sw { display: inline-flex; border-radius: 6px; overflow: hidden; }
.theme-swatch .sw i { display: block; width: 14px; height: 24px; }
.theme-swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
html[data-theme="dark"] :is(.theme-swatch, .logo-row img) { background: #271b18; border-color: #3a2a26; color: var(--ink); }
html[data-theme="dark"] .plan-features li { color: #e6d8d0; }
html[data-theme="dark"] .plan-features li.off { color: #8f817a; }
html[data-theme="dark"] .pm-table .pm-group td { background: #2f211d; }

/* show/hide password button */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap > input { width: 100%; padding-right: 44px; }
.pw-eye { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #7a6a66; cursor: pointer; }
.pw-eye:hover, .pw-eye:focus-visible { color: var(--brand, #b9382f); background: rgba(0,0,0,.05); outline: none; }
html[data-theme="dark"] .pw-eye { color: #cdbcb7; }

/* login: supporting partner (LapupTech) and support contacts */
.partner-logo { flex: none; aspect-ratio: 580 / 520; border-radius: 8px; background: #fcfcfc url("assets/lapuptech.jpg") 50% 46.6% / 276% auto no-repeat; }
.partner-label { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.partner-contacts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; padding: 0; list-style: none; text-align: left; }
.partner-contacts a { display: flex; flex-direction: column; padding: 6px 9px; border-radius: 8px; color: inherit; text-decoration: none; }
.partner-contacts b { font-size: 13px; }
.partner-contacts span { font-size: 13px; font-weight: 700; letter-spacing: .3px; }
/* in the sign-in card (screens too narrow for the corner) */
.partner-inline { margin-top: 14px; text-align: center; }
.partner-inline .partner-logo { width: 100%; max-width: 200px; margin: 0 auto 10px; }
.partner-inline .partner-label { color: var(--muted, #6b7280); }
.partner-inline .partner-contacts a { border: 1px solid var(--line, #e5e7eb); }
.partner-inline .partner-contacts span { color: var(--brand, #b9382f); }
.partner-corner { display: none; }
@media (min-width: 1200px) {
  .partner-inline { display: none; }
  .partner-corner { display: flex; align-items: center; gap: 14px; position: absolute; top: 22px; right: clamp(28px, 4vw, 80px); width: min(430px, calc(50vw - 300px)); padding: 10px 14px; border: 1px solid rgba(255,255,255,.22); border-radius: 14px; background: rgba(255,255,255,.1); backdrop-filter: blur(6px); color: #fff; }
  .partner-corner .partner-logo { width: 104px; }
  .partner-corner .partner-info { flex: 1; min-width: 0; }
  .partner-corner .partner-label { color: #dfe6ff; }
  .partner-corner .partner-contact-title { margin-top: 2px; color: #ffc23d; }
  .partner-corner .partner-contacts a { padding: 3px 6px; background: rgba(255,255,255,.1); }
  .partner-corner .partner-contacts b { font-size: 12.5px; }
  .partner-corner .partner-contacts span { color: #ffc23d; font-size: 12.5px; }
}
@media (min-width: 1200px) { .hero-features { top: 186px; } .partner-corner { top: 18px; } }
