:root {
  --accent: #10b981;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 18px 45px rgba(15,23,42,.08);
}
html[data-theme="dark"] {
  --bg: #111317;
  --surface: #171b22;
  --surface-2: #1d232d;
  --text: #f8fafc;
  --muted: #a7b0bf;
  --line: #2b3441;
  --shadow: 0 18px 45px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
body { margin:0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
input, select, button { font: inherit; }
label { display:flex; flex-direction:column; gap:8px; color: var(--text); font-weight:650; font-size:14px; }
input, select { width:100%; padding:12px 13px; border:1px solid var(--line); border-radius:14px; background:var(--surface); color:var(--text); outline:none; }
input:focus, select:focus { border-color: var(--accent); box-shadow:0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
button { cursor:pointer; }
.muted { color: var(--muted); }
.eyebrow { color: var(--accent); font-weight:800; letter-spacing:.12em; text-transform:uppercase; font-size:12px; margin:0 0 8px; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; border:1px solid var(--line); background:var(--surface); color:var(--text); border-radius:14px; padding:11px 16px; font-weight:800; }
.btn-primary { background: var(--accent); color:#171717; border-color:var(--accent); }
.btn-secondary { background: var(--surface-2); }
.btn-block { width:100%; }
.btn-small { padding:7px 10px; border-radius:10px; font-size:13px; }
.alert { padding:13px 14px; border-radius:14px; margin:12px 0; border:1px solid var(--line); }
.alert-danger { background:#fff1f0; color:var(--danger); border-color:#ffd1cc; }
.alert-success { background:#ecfdf3; color:var(--success); border-color:#abefc6; }
.alert-warning { background:#fffbeb; color:#92400e; border-color:#fde68a; }
html[data-theme="dark"] .alert-danger { background:#351715; }
html[data-theme="dark"] .alert-success { background:#102b20; }
html[data-theme="dark"] .alert-warning { background:#2c2410; color:#fbbf24; }

.install-body, .login-body { min-height:100vh; display:grid; place-items:center; padding:22px; background: radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 20%, transparent), transparent 32%), var(--bg); }
.install-card { width:min(880px, 100%); background:var(--surface); padding:28px; border-radius:28px; box-shadow:var(--shadow); border:1px solid var(--line); }
.install-card h1, .install-card h2 { margin:0 0 10px; }
.brand-mark, .mini-mark { width:52px; height:52px; border-radius:18px; background:var(--accent); display:grid; place-items:center; color:#151515; font-size:26px; font-weight:900; }
.form-grid { display:grid; gap:16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-section h2 { margin-top:28px; }
.form-actions { margin-top:22px; }

.login-shell { width:min(1060px,100%); display:grid; grid-template-columns:1.1fr .9fr; min-height:640px; background:var(--surface); border:1px solid var(--line); border-radius:34px; overflow:hidden; box-shadow:var(--shadow); }
.login-hero { padding:36px; display:flex; flex-direction:column; justify-content:space-between; background:linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface-2)), var(--surface-2)); }
.brand-lockup { display:flex; align-items:center; gap:18px; }
.brand-lockup h1 { margin:0; font-size:34px; }
.brand-lockup p { color:var(--muted); max-width:430px; }
.login-logo { width:74px; height:74px; object-fit:contain; border-radius:18px; background:white; padding:8px; }
.hero-panel { border:1px solid var(--line); border-radius:24px; padding:20px; background:rgba(255,255,255,.42); display:flex; flex-direction:column; gap:8px; }
.login-card { padding:38px; display:flex; flex-direction:column; justify-content:center; gap:16px; }
.login-card h2 { font-size:32px; margin:0; }

.app-shell { display:flex; min-height:100vh; }
.sidebar { width:280px; flex:0 0 280px; background:#121417; color:#f8fafc; display:flex; flex-direction:column; padding:18px; position:sticky; top:0; height:100vh; }
.sidebar-brand { display:flex; align-items:center; gap:12px; padding:10px; margin-bottom:20px; }
.sidebar-brand img { width:46px; height:46px; object-fit:contain; border-radius:14px; background:white; padding:5px; }
.sidebar-brand b { display:block; }
.sidebar-brand small { color:#bac2cf; }
.sidebar nav { display:grid; gap:6px; }
.sidebar nav a { padding:12px 14px; border-radius:14px; color:#dce2ea; display:flex; justify-content:space-between; align-items:center; }
.sidebar nav a.active, .sidebar nav a:hover { background:rgba(255,255,255,.10); color:white; }
.sidebar nav a.disabled { color:#737b88; cursor:not-allowed; }
.sidebar nav small { color:#8992a0; }
.logout-link { margin-top:auto; padding:12px 14px; border-radius:14px; background:rgba(255,255,255,.08); }
.main-area { flex:1; min-width:0; }
.topbar { height:72px; display:flex; align-items:center; justify-content:space-between; padding:0 24px; border-bottom:1px solid var(--line); background:color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter:blur(8px); position:sticky; top:0; z-index:5; }
.topbar strong { display:block; }
.topbar span { color:var(--muted); font-size:13px; }
.hamburger { display:none; border:0; background:var(--surface-2); color:var(--text); border-radius:10px; padding:9px 11px; }
.user-chip { display:flex; align-items:flex-end; flex-direction:column; border:1px solid var(--line); border-radius:14px; padding:8px 12px; background:var(--surface); }
.user-chip b { color:var(--accent); font-size:12px; text-transform:uppercase; }
.page-content { padding:28px; }
.page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:22px; }
.page-head h1 { margin:0; font-size:34px; }
.stats-grid { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:16px; margin-bottom:18px; }
.stat-card, .panel { background:var(--surface); border:1px solid var(--line); border-radius:24px; padding:20px; box-shadow:var(--shadow); }
.stat-card { display:flex; flex-direction:column; gap:10px; }
.stat-card span { color:var(--muted); font-weight:700; }
.stat-card strong { font-size:30px; }
.stat-card small { color:var(--muted); }
.content-grid { display:grid; gap:18px; }
.two-col { grid-template-columns:1fr 1fr; }
.panel h2 { margin:0 0 16px; }
.timeline { display:grid; gap:12px; }
.timeline div { border-left:3px solid var(--line); padding-left:14px; display:grid; gap:4px; }
.timeline div.done { border-color:var(--accent); }
.timeline span, .role-list { color:var(--muted); }
.definition-list { display:grid; grid-template-columns:150px 1fr; gap:12px; }
.definition-list dt { color:var(--muted); }
.definition-list dd { margin:0; font-weight:750; }
.settings-logo { max-height:86px; max-width:220px; object-fit:contain; border:1px solid var(--line); border-radius:16px; padding:10px; background:white; }
.table-wrap { overflow:auto; }
table { width:100%; border-collapse:collapse; }
th, td { padding:13px 10px; border-bottom:1px solid var(--line); text-align:left; white-space:nowrap; }
th { color:var(--muted); font-size:13px; }
.pill { display:inline-flex; padding:5px 9px; border-radius:999px; background:color-mix(in srgb, var(--accent) 16%, transparent); color:var(--text); font-weight:800; }
.inline-form { display:inline; }

@media (max-width: 980px) {
  .login-shell { grid-template-columns:1fr; }
  .login-hero { min-height:320px; }
  .stats-grid, .two-col, .form-grid.two { grid-template-columns:1fr; }
  .sidebar { position:fixed; z-index:20; transform:translateX(-100%); transition:.2s ease; }
  .sidebar.open { transform:translateX(0); }
  .hamburger { display:inline-flex; }
  .page-content { padding:18px; }
  .topbar { padding:0 16px; }
  .page-head { flex-direction:column; }
}
@media (max-width: 560px) {
  .install-card, .login-card, .login-hero { padding:22px; }
  .brand-lockup h1, .page-head h1 { font-size:26px; }
  .user-chip { display:none; }
}

/* Patch 02 master data screens */
textarea { width:100%; padding:12px 13px; border:1px solid var(--line); border-radius:14px; background:var(--surface); color:var(--text); outline:none; resize:vertical; font:inherit; }
textarea:focus { border-color: var(--accent); box-shadow:0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
input:disabled, select:disabled, textarea:disabled { opacity:.72; cursor:not-allowed; }
.button-row { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.two-col.wide-left { grid-template-columns: minmax(0, 1.45fr) minmax(330px, .75fr); align-items:start; }
.panel-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:14px; }
.panel-head h2 { margin:0; }
.filter-row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.filter-row input { min-width:220px; }
.filter-row select { width:auto; min-width:132px; }
.action-cell { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.checkbox-line { flex-direction:row; align-items:center; font-weight:700; }
.checkbox-line input { width:auto; }
.form-section h3 { margin:22px 0 6px; font-size:16px; color:var(--muted); }
label small { color:var(--muted); font-weight:500; }
td small { color:var(--muted); }
@media (max-width: 1180px) { .two-col.wide-left { grid-template-columns:1fr; } }
@media (max-width: 760px) { .panel-head, .filter-row { align-items:stretch; flex-direction:column; } .filter-row input, .filter-row select { width:100%; min-width:0; } .action-cell { display:grid; } }

/* Patch 03/04 document engine */
.compact-select { min-width:110px; padding:7px 9px; border-radius:10px; }
.status-draft { background:rgba(107,114,128,.14); }
.status-sent { background:rgba(37,99,235,.14); }
.status-accepted { background:rgba(6,118,71,.16); }
.status-rejected { background:rgba(180,35,24,.14); }
.status-expired { background:rgba(146,64,14,.16); }
.status-converted { background:color-mix(in srgb, var(--accent) 22%, transparent); }
.status-partial { background:rgba(146,64,14,.16); }
.status-paid { background:rgba(6,118,71,.16); }
.status-overdue { background:rgba(180,35,24,.16); }
.status-void { background:rgba(107,114,128,.14); text-decoration:line-through; }

.quote-form { display:grid; gap:18px; }
.quote-lines-panel { overflow:hidden; }
.line-editor th, .line-editor td { vertical-align:top; white-space:normal; }
.line-editor textarea { min-width:240px; }
.line-editor input, .line-editor select, .line-editor textarea { min-width:90px; }
.line-editor .line-type { min-width:88px; }
.line-editor .catalog-select { min-width:180px; }
.mini-check { display:flex; align-items:center; gap:6px; flex-direction:row; font-size:12px; font-weight:800; padding-top:10px; }
.mini-check input { width:auto; }
.quote-total-preview { margin-top:14px; padding:12px 14px; border-radius:14px; background:var(--surface-2); color:var(--muted); font-weight:700; }
.sticky-actions { position:sticky; bottom:0; display:flex; gap:10px; background:color-mix(in srgb, var(--surface) 92%, transparent); border:1px solid var(--line); border-radius:18px; padding:12px; box-shadow:var(--shadow); z-index:4; }
.quote-status-strip { display:flex; gap:10px; flex-wrap:wrap; color:var(--muted); font-weight:700; }
.quote-status-strip span { border:1px solid var(--line); border-radius:999px; padding:7px 10px; background:var(--surface-2); }
.document-sheet { width:min(1040px, 100%); margin:0 auto 24px; background:var(--surface); color:var(--text); border:1px solid var(--line); border-radius:26px; padding:34px; box-shadow:var(--shadow); }
.document-top { display:flex; justify-content:space-between; gap:24px; align-items:flex-start; border-bottom:2px solid var(--line); padding-bottom:22px; }
.document-brand { display:flex; gap:16px; align-items:flex-start; }
.document-brand img { width:76px; max-height:76px; object-fit:contain; border-radius:16px; background:white; padding:8px; border:1px solid var(--line); }
.document-mark { width:68px; height:68px; display:grid; place-items:center; border-radius:18px; background:var(--accent); color:#111; font-size:34px; }
.document-brand h2 { margin:0 0 4px; }
.document-brand p, .document-meta-grid p, .document-notes p { margin:3px 0; color:var(--muted); }
.document-title-block { text-align:right; display:grid; gap:7px; justify-items:end; }
.document-title-block h1 { font-size:42px; margin:0; letter-spacing:.08em; }
.document-title-block strong { font-size:19px; }
.document-meta-grid { display:grid; grid-template-columns:1fr 1fr .85fr; gap:24px; margin:26px 0; }
.document-meta-grid h3, .document-notes h3 { margin:0 0 8px; color:var(--muted); font-size:13px; letter-spacing:.08em; text-transform:uppercase; }
.document-dates dl { display:grid; grid-template-columns:110px 1fr; gap:8px; margin:0; }
.document-dates dt { color:var(--muted); }
.document-dates dd { margin:0; font-weight:800; }
.document-intro { margin:20px 0; padding:16px; border-radius:18px; background:var(--surface-2); }
.document-intro h2 { margin:0 0 6px; }
.document-intro p { margin:0; color:var(--muted); }
.document-lines { margin-top:18px; }
.document-lines th { background:var(--surface-2); }
.document-lines td, .document-lines th { white-space:normal; vertical-align:top; }
.document-lines .text-line td { background:var(--surface-2); font-style:italic; color:var(--muted); }
.document-lines small { color:var(--muted); }
.document-bottom { display:grid; grid-template-columns:1fr 330px; gap:28px; margin-top:24px; align-items:start; }
.document-totals { border:1px solid var(--line); border-radius:20px; overflow:hidden; }
.document-totals div { display:flex; justify-content:space-between; gap:12px; padding:13px 15px; border-bottom:1px solid var(--line); }
.document-totals div:last-child { border-bottom:0; }
.document-totals span { color:var(--muted); font-weight:700; }
.document-totals .grand-total { background:var(--accent); color:#111; font-size:18px; }
.document-totals .grand-total span { color:#111; }
.print-body { background:#e7e9ee; padding:20px; }
.print-toolbar { width:min(1040px,100%); margin:0 auto 14px; display:flex; gap:10px; justify-content:flex-end; }
@media (max-width: 860px) {
  .document-top, .document-bottom { grid-template-columns:1fr; display:grid; }
  .document-title-block { text-align:left; justify-items:start; }
  .document-meta-grid { grid-template-columns:1fr; }
  .line-editor { min-width:980px; }
}
@media print {
  body, .print-body { background:white !important; padding:0 !important; }
  .no-print, .sidebar, .topbar { display:none !important; }
  .app-shell { display:block; }
  .main-area { width:100%; }
  .page-content { padding:0; }
  .document-sheet { width:100%; margin:0; border:0; box-shadow:none; border-radius:0; padding:18mm; color:#111; background:white; }
  .document-lines th { color:#111; }
  .document-brand p, .document-meta-grid p, .document-notes p, .document-dates dt { color:#444; }
  a { text-decoration:none; }
}
.line-editor tr.is-text-row input, .line-editor tr.is-text-row select { opacity:.55; }
/* Patch 05 proforma and recurring billing */
.status-cancelled { background:rgba(107,114,128,.14); text-decoration:line-through; }
.status-active { background:rgba(6,118,71,.16); }
.status-paused { background:rgba(146,64,14,.16); }
.status-ended { background:rgba(107,114,128,.14); }
.check-card { display:flex; gap:8px; align-items:center; padding:10px 12px; border:1px solid var(--line); border-radius:14px; background:var(--surface-2); font-weight:700; }
.form-toolbar { margin:0 0 14px; }
/* Patch 07 procurement */
.status-approved { background:rgba(37,99,235,.14); }
.status-received { background:rgba(6,118,71,.16); }

/* Patch 07.1 UI hotfix: fixed readable sidebar + independent sidebar scrolling */
html, body { min-height: 100%; }
.app-body { min-height: 100dvh; overflow-x: hidden; }
.app-shell { min-height: 100dvh; }

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  z-index: 30;
  background: #121417;
  isolation: isolate;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #121417;
  z-index: 0;
  pointer-events: none;
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar-brand { flex: 0 0 auto; }
.sidebar nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.35) transparent;
}
.sidebar nav::-webkit-scrollbar { width: 8px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 999px; }
.sidebar nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.38); }
.sidebar nav a,
.sidebar nav a:visited,
.logout-link,
.logout-link:visited { color: #dce2ea; }
.sidebar nav a.active,
.sidebar nav a:hover,
.logout-link:hover { color: #ffffff; }
.logout-link {
  flex: 0 0 auto;
  margin-top: 12px;
  background: rgba(255,255,255,.10);
}
.main-area {
  margin-left: 280px;
  width: calc(100% - 280px);
  min-height: 100dvh;
}
.page-content {
  min-height: calc(100dvh - 72px);
  padding-bottom: 72px;
}

@supports not (height: 100dvh) {
  .app-body, .app-shell, .main-area { min-height: 100vh; }
  .sidebar { height: 100vh; max-height: 100vh; }
  .page-content { min-height: calc(100vh - 72px); }
}

@media (max-width: 980px) {
  .sidebar {
    width: min(86vw, 280px);
    transform: translateX(-105%);
    transition: .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; width: 100%; }
  .app-shell { display: block; }
}

@media print {
  .main-area { margin-left: 0 !important; width: 100% !important; }
}
.details-box {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border, #e7dfd2);
  border-radius: 16px;
  background: rgba(255,255,255,.55);
}
.details-box summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 10px;
}
.compact-form { margin-top: 12px; }
.spaced-actions { margin-top: 18px; gap: 10px; flex-wrap: wrap; }


/* Patch 09 reporting helpers */
.link-list { display:grid; gap:10px; }
.link-list a { display:flex; justify-content:space-between; align-items:center; padding:12px 14px; border:1px solid var(--border); border-radius:14px; background:rgba(255,255,255,.55); text-decoration:none; color:var(--text); font-weight:700; }
.link-list a:hover { border-color:var(--accent); transform:translateY(-1px); }
.clean-list { margin:10px 0 0; padding-left:18px; color:var(--muted); }
.clean-list li { margin:6px 0; }
.pill-list { display:flex; flex-wrap:wrap; gap:8px; }
.compact-form label { font-weight:700; color:var(--text); }
.compact-form input, .compact-form select { margin-top:6px; }

/* Patch 10 CSV import centre */
.mapping-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:14px; }
.status-preview { background:rgba(37,99,235,.14); }
.status-rolled_back, .status-rolled-back { background:rgba(107,114,128,.14); text-decoration:line-through; }
@media (max-width: 820px) { .mapping-grid { grid-template-columns:1fr; } }

/* Patch 10.2 navigation and printable document polish */
.sidebar-nav { display:block; }
.nav-section { margin: 8px 0 12px; padding: 8px 0 0; border-top: 1px solid rgba(255,255,255,.08); }
.nav-section:first-of-type { border-top: 0; }
.nav-label { padding: 8px 14px 5px; color: #8f99a8; font-size: 11px; font-weight: 900; letter-spacing: .10em; text-transform: uppercase; }
.nav-section a { margin: 2px 0; padding-left: 22px !important; }
.nav-section.open .nav-label { color: var(--accent); }
.sidebar-brand span { min-width: 0; }
.sidebar-brand b { line-height: 1.1; word-break: break-word; }
.sidebar-brand small { display:block; margin-top:2px; }

.document-sheet {
  width: min(210mm, 100%);
  min-height: 292mm;
  padding: 18mm;
  border-radius: 10px;
  background: #fff;
  color: #151515;
}
.document-top {
  border-bottom: 0;
  padding-bottom: 28px;
  margin-bottom: 8px;
}
.document-brand { min-width: 42%; }
.document-brand img { width: 112px; max-height: 112px; border: 0; padding: 0; border-radius: 0; object-fit: contain; }
.document-mark { width: 78px; height: 78px; border-radius: 22px; }
.document-brand h2 { margin-top: 10px; font-size: 20px; }
.document-title-block h1 { font-size: 38px; letter-spacing: .18em; font-weight: 500; }
.document-title-block strong { font-size: 16px; }
.document-meta-grid { grid-template-columns: 1fr 1fr 0.95fr; gap: 28px; margin: 30px 0 34px; }
.document-meta-grid h3, .document-notes h3 { color: #3e5669; }
.document-lines { border-collapse: collapse; font-size: 12px; }
.document-lines th { background: #4f93b0; color: #fff; font-weight: 800; border-bottom: 0; }
.document-lines td { border-bottom: 1px solid #d9e3ea; }
.document-lines tbody tr:nth-child(odd) td { background: #e8f5f8; }
.document-lines .text-line td { background:#f3f7f9; color:#334155; }
.document-bottom { grid-template-columns: 1fr 290px; gap: 28px; }
.document-notes { background: #e8f5f8; padding: 14px 16px; }
.document-totals { border: 0; border-radius: 0; }
.document-totals div { border-bottom: 0; padding: 8px 0; }
.document-totals .grand-total { background: #4f93b0; color: #fff; padding: 12px 14px; }
.document-totals .grand-total span { color: #fff; }
.print-body { background: #eef0f4; }
.print-toolbar { width: min(210mm, 100%); }

@page { size: A4; margin: 8mm; }
@media print {
  html, body { width: 210mm; min-height: 297mm; }
  .document-sheet {
    width: 100% !important;
    min-height: auto !important;
    padding: 8mm !important;
    border: 0 !important;
    box-shadow: none !important;
    page-break-after: auto;
  }
  .document-top, .document-meta-grid, .document-lines, .document-bottom { page-break-inside: avoid; }
  .document-lines { font-size: 10.5px; }
  .document-title-block h1 { font-size: 30px; }
  .document-brand img { width: 92px; max-height: 92px; }
  .document-meta-grid { margin: 18px 0 22px; gap: 16px; }
  .document-bottom { grid-template-columns: 1fr 260px; gap: 18px; }
}

@media (max-width: 860px) {
  .document-sheet { min-height: auto; padding: 20px; }
  .document-bottom { grid-template-columns: 1fr; }
}

/* Patch 10.3 invoice workflow + A4 preview stability */
.print-hint { align-self:center; color:#5b6675; font-weight:700; margin-right:auto; }
.document-sheet { position:relative; overflow:hidden; }
.document-top, .document-meta-grid, .document-bottom { min-width:0; }
.document-meta-grid { grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(185px,.75fr); align-items:start; }
.document-meta-grid > div, .document-party, .document-dates { min-width:0; overflow-wrap:anywhere; word-break:normal; }
.document-party p { line-height:1.35; }
.document-dates dl { grid-template-columns:minmax(82px, 105px) minmax(0,1fr); }
.document-dates dd { overflow-wrap:anywhere; }
.document-stamp {
  margin-top: 8px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border: 3px solid currentColor;
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 20px;
  font-weight: 950;
  letter-spacing: .14em;
  transform: rotate(-8deg);
  text-transform: uppercase;
  background: rgba(255,255,255,.72);
}
.stamp-paid { color:#067647; }
.stamp-part-paid { color:#b45309; }
.stamp-overdue, .stamp-void { color:#b42318; }
input[type="checkbox"] { width:auto; }
#bulkInvoiceForm { margin: 0 0 12px; justify-content:flex-start; }
@media (max-width: 1100px) {
  .document-meta-grid { grid-template-columns:1fr; }
  .document-title-block { justify-items:start; text-align:left; }
}
@media print {
  .print-hint { display:none !important; }
  .document-stamp { background: transparent; }
  .document-meta-grid { grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(170px,.72fr) !important; }
  .document-sheet { overflow:visible !important; }
}


/* Patch 10.4 / 11.1 document hardening */
.document-sheet { max-width: 210mm; }
.document-meta-grid { overflow: visible; }
.document-party p { margin: 2px 0; overflow-wrap: break-word; word-break: normal; }
.document-dates { min-width: 0; }
.document-dates dl { width: 100%; }
.document-dates dt, .document-dates dd { min-width: 0; }
.document-title-block { min-width: 130px; }
.document-lines th:nth-child(1), .document-lines td:nth-child(1) { width: 28px; }
.document-lines th:nth-child(3), .document-lines td:nth-child(3) { width: 52px; text-align:right; }
.document-lines th:nth-child(4), .document-lines td:nth-child(4) { width: 56px; }
.document-lines th:nth-child(5), .document-lines td:nth-child(5),
.document-lines th:nth-child(8), .document-lines td:nth-child(8) { width: 94px; text-align:right; }
.document-lines th:nth-child(6), .document-lines td:nth-child(6),
.document-lines th:nth-child(7), .document-lines td:nth-child(7) { width: 56px; text-align:right; }
.document-intro:empty { display:none; }
@media print {
  @page { size: A4; margin: 7mm; }
  .document-sheet { padding: 7mm !important; width: 196mm !important; max-width: 196mm !important; }
  .document-title-block h1 { font-size: 28px !important; letter-spacing: .12em; }
  .document-meta-grid { grid-template-columns: 1fr 1fr 0.8fr !important; gap: 12px !important; font-size: 11px; }
  .document-dates dl { grid-template-columns: 75px 1fr !important; gap: 5px !important; }
  .document-lines { font-size: 9.8px !important; }
  .document-lines th, .document-lines td { padding: 6px 5px !important; }
  .document-bottom { grid-template-columns: 1fr 245px !important; gap: 12px !important; }
  .document-notes { padding: 10px 12px !important; }
}

/* Patch 13: professional quote/invoice document layout */
.pro-document {
  width: min(100%, 205mm);
  max-width: 205mm;
  margin: 0 auto 28px;
  padding: 22mm 18mm 18mm;
  background: #fff;
  color: #17202a;
  border: 1px solid #e8dcc8;
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(30, 41, 59, .12);
  position: relative;
  overflow: visible;
}
.pro-doc-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 24px;
  align-items: start;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--accent, #10b981);
}
.pro-doc-brand { display:flex; gap:16px; align-items:center; min-width:0; }
.pro-doc-brand img { width:82px; height:82px; object-fit:contain; border:0; border-radius:0; background:transparent; }
.pro-doc-brand .document-mark { width:64px; height:64px; border-radius:16px; }
.pro-doc-brand h2 { margin:0; font-size:23px; line-height:1.08; color:#1f2933; }
.pro-doc-brand p { margin:4px 0 0; color:#667085; }
.pro-doc-title { text-align:right; justify-self:end; }
.pro-doc-title p { margin:0 0 3px; font-size:12px; text-transform:uppercase; letter-spacing:.16em; color:#667085; font-weight:800; }
.pro-doc-title h1 { margin:0; font-size:38px; letter-spacing:.12em; line-height:1; color:#111827; }
.pro-doc-title .doc-number { margin:8px 0 8px; font-size:20px; font-weight:900; color:#344054; }
.pro-doc-meta {
  display:grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(210px,.8fr);
  gap:14px;
  margin:22px 0 20px;
}
.doc-card {
  border:1px solid #ece4d8;
  background:#fffdf8;
  border-radius:14px;
  padding:14px 16px;
  min-width:0;
}
.doc-card h3, .pro-doc-notes h3 {
  margin:0 0 8px;
  font-size:11px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:#8a5b13;
  font-weight:900;
}
.doc-card p { margin:3px 0; color:#475467; line-height:1.35; overflow-wrap:anywhere; }
.doc-card strong { color:#1f2933; }
.doc-card-details dl { display:grid; grid-template-columns: 92px minmax(0,1fr); gap:6px 8px; margin:0; font-size:13px; }
.doc-card-details dt { color:#667085; font-weight:700; }
.doc-card-details dd { margin:0; color:#1f2933; font-weight:800; overflow-wrap:anywhere; }
.pro-doc-intro {
  margin: 8px 0 18px;
  background:#f8fafc;
  border-left:4px solid var(--accent, #10b981);
  border-radius:12px;
  padding:13px 16px;
}
.pro-doc-intro h2 { margin:0 0 5px; font-size:17px; }
.pro-doc-intro p { margin:0; color:#475467; }
.pro-lines { width:100%; border-collapse:collapse; font-size:12px; margin-top:12px; }
.pro-lines th {
  background:#263445 !important;
  color:#fff !important;
  padding:9px 8px !important;
  font-weight:900;
  border:0 !important;
  white-space:nowrap;
}
.pro-lines td {
  padding:9px 8px !important;
  border-bottom:1px solid #e5e7eb !important;
  background:#fff !important;
  vertical-align:top;
}
.pro-lines tbody tr:nth-child(even) td { background:#fbfcfe !important; }
.pro-lines td:nth-child(1), .pro-lines th:nth-child(1) { width:30px; color:#667085; }
.pro-lines td:nth-child(3), .pro-lines th:nth-child(3),
.pro-lines td:nth-child(5), .pro-lines th:nth-child(5),
.pro-lines td:nth-child(6), .pro-lines th:nth-child(6),
.pro-lines td:nth-child(7), .pro-lines th:nth-child(7),
.pro-lines td:nth-child(8), .pro-lines th:nth-child(8) { text-align:right; }
.pro-doc-bottom { display:grid; grid-template-columns:minmax(0,1fr) 280px; gap:22px; margin-top:22px; align-items:start; }
.pro-doc-notes { color:#475467; font-size:12px; line-height:1.45; }
.pro-doc-notes p { margin:3px 0 10px; }
.pro-totals { border:1px solid #e7dac3; border-radius:14px; overflow:hidden; background:#fff; }
.pro-totals div { display:flex; justify-content:space-between; gap:14px; padding:10px 13px; border-bottom:1px solid #efe4d4; font-size:13px; }
.pro-totals div:last-child { border-bottom:0; }
.pro-totals span { color:#667085; font-weight:800; }
.pro-totals b { color:#111827; }
.pro-totals .grand-total { background:var(--accent, #10b981); color:#111827; font-size:15px; }
.pro-totals .grand-total span, .pro-totals .grand-total b { color:#111827; }
.pro-document .document-stamp {
  position:absolute;
  right:26mm;
  top:38mm;
  opacity:.16;
  z-index:2;
  pointer-events:none;
  font-size:28px;
  border-width:4px;
}
.print-toolbar { max-width:205mm; margin:0 auto 14px; display:flex; align-items:center; justify-content:flex-end; gap:10px; }
@media (max-width: 900px) {
  .pro-document { padding:22px; border-radius:16px; }
  .pro-doc-header, .pro-doc-meta, .pro-doc-bottom { grid-template-columns:1fr; }
  .pro-doc-title { text-align:left; justify-self:start; }
  .pro-lines { font-size:11px; }
  .pro-lines th, .pro-lines td { padding:7px 5px !important; }
}
@media print {
  @page { size:A4; margin:8mm; }
  html, body, .print-body { background:#fff !important; padding:0 !important; }
  .no-print, .print-toolbar { display:none !important; }
  .pro-document {
    width:194mm !important;
    max-width:194mm !important;
    min-height:auto !important;
    margin:0 !important;
    padding:8mm !important;
    border:0 !important;
    border-radius:0 !important;
    box-shadow:none !important;
  }
  .pro-doc-header { grid-template-columns: 1fr 220px !important; gap:14px !important; padding-bottom:12px !important; }
  .pro-doc-brand img { width:62px !important; height:62px !important; }
  .pro-doc-title h1 { font-size:30px !important; }
  .pro-doc-meta { grid-template-columns:1fr 1fr 0.82fr !important; gap:9px !important; margin:14px 0 !important; }
  .doc-card { padding:9px 10px !important; border-radius:9px !important; font-size:10.8px !important; }
  .doc-card-details dl { grid-template-columns:75px 1fr !important; font-size:10.8px !important; gap:4px 5px !important; }
  .pro-doc-intro { padding:8px 10px !important; margin:8px 0 10px !important; }
  .pro-lines { font-size:9.4px !important; page-break-inside:auto; }
  .pro-lines th, .pro-lines td { padding:5px 4px !important; }
  .pro-doc-bottom { grid-template-columns: 1fr 235px !important; gap:10px !important; margin-top:12px !important; }
  .pro-doc-notes { font-size:9.8px !important; }
  .pro-totals div { padding:6px 8px !important; font-size:10.4px !important; }
  .pro-totals .grand-total { font-size:11.2px !important; }
  .pro-document .document-stamp { top:31mm !important; right:18mm !important; font-size:22px !important; }
}

/* Patch 13.2: cleaner PayPod-inspired document spacing + banking details */
.refined-document {
  width: min(100%, 206mm);
  max-width: 206mm;
  padding: 20mm 18mm 16mm;
  border-radius: 14px;
}
.refined-doc-header {
  grid-template-columns: minmax(0, 1fr) 245px;
  gap: 32px;
  border-bottom: 0;
  padding-bottom: 18px;
  margin-bottom: 28px;
}
.refined-doc-brand {
  align-items: flex-start;
  gap: 20px;
}
.refined-doc-brand img {
  width: 118px;
  height: auto;
  max-height: 118px;
}
.refined-doc-brand .document-mark {
  width: 58px;
  height: 58px;
  font-size: 30px;
}
.refined-doc-brand h2 {
  font-size: 24px;
  line-height: 1.18;
  max-width: 430px;
}
.refined-doc-brand p {
  font-size: 13px;
  line-height: 1.35;
}
.refined-doc-title h1 {
  font-size: 38px;
  line-height: .98;
  letter-spacing: .18em;
  font-weight: 500;
}
.refined-doc-title .doc-number {
  font-size: 18px;
  margin: 10px 0 10px;
}
.doc-title-details {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 5px 10px;
  margin: 14px 0 0;
  font-size: 12.5px;
  text-align: left;
}
.doc-title-details dt {
  color: #667085;
  font-weight: 700;
}
.doc-title-details dd {
  margin: 0;
  color: #111827;
  font-weight: 850;
  overflow-wrap: anywhere;
}
.refined-doc-parties {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 74px;
  margin: 4px 0 34px;
  align-items: start;
}
.party-block {
  min-width: 0;
}
.party-block h3 {
  margin: 0 0 9px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #111827;
  font-weight: 900;
}
.party-block p {
  margin: 3px 0;
  color: #303846;
  font-size: 13.2px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.party-block p strong {
  color: #111827;
}
.refined-doc-intro {
  background: #f9fafb;
  border-left: 0;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0 0 20px;
}
.refined-lines {
  margin-top: 0;
}
.refined-lines th {
  background: #4f93b0 !important;
  padding: 10px 8px !important;
}
.refined-lines td {
  padding: 10px 8px !important;
  line-height: 1.35;
}
.refined-lines tbody tr:nth-child(even) td,
.refined-lines tbody tr:nth-child(odd) td {
  background: #fff !important;
}
.refined-lines tbody tr:nth-child(odd) td {
  background: #e9f6f9 !important;
}
.refined-doc-bottom {
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 26px;
}
.banking-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: #eef8fb;
  border: 1px solid #d6edf4;
  border-radius: 14px;
}
.banking-box h3 {
  margin-bottom: 10px;
}
.banking-box p {
  display: grid;
  grid-template-columns: 125px minmax(0, 1fr);
  gap: 10px;
  margin: 4px 0;
}
.banking-box span {
  color: #667085;
  font-weight: 800;
}
.banking-box strong {
  color: #111827;
  overflow-wrap: anywhere;
}
@media (max-width: 900px) {
  .refined-doc-header,
  .refined-doc-parties,
  .refined-doc-bottom { grid-template-columns: 1fr; gap: 18px; }
  .refined-doc-title { text-align: left; justify-self: start; }
  .doc-title-details { max-width: 320px; }
}
@media print {
  .refined-document {
    width: 194mm !important;
    max-width: 194mm !important;
    padding: 8mm !important;
  }
  .refined-doc-header {
    grid-template-columns: minmax(0, 1fr) 205px !important;
    gap: 18px !important;
    padding-bottom: 8px !important;
    margin-bottom: 18px !important;
  }
  .refined-doc-brand { gap: 12px !important; }
  .refined-doc-brand img {
    width: 72px !important;
    max-height: 72px !important;
  }
  .refined-doc-brand h2 {
    font-size: 17px !important;
    line-height: 1.18 !important;
  }
  .refined-doc-title h1 {
    font-size: 27px !important;
    letter-spacing: .15em !important;
  }
  .refined-doc-title .doc-number { font-size: 14px !important; margin: 6px 0 !important; }
  .doc-title-details {
    grid-template-columns: 70px 1fr !important;
    gap: 3px 6px !important;
    font-size: 9.8px !important;
    margin-top: 8px !important;
  }
  .refined-doc-parties {
    grid-template-columns: 1fr 1fr !important;
    gap: 28px !important;
    margin: 6px 0 18px !important;
  }
  .party-block h3 { font-size: 9.6px !important; margin-bottom: 5px !important; }
  .party-block p { font-size: 10.2px !important; line-height: 1.32 !important; margin: 2px 0 !important; }
  .refined-doc-intro { padding: 8px 10px !important; margin-bottom: 10px !important; }
  .refined-lines { font-size: 9.2px !important; }
  .refined-lines th, .refined-lines td { padding: 5px 4px !important; }
  .refined-doc-bottom {
    grid-template-columns: 1fr 235px !important;
    gap: 10px !important;
    margin-top: 12px !important;
  }
  .banking-box { padding: 8px 10px !important; border-radius: 8px !important; margin-top: 8px !important; }
  .banking-box p { grid-template-columns: 86px 1fr !important; gap: 5px !important; margin: 2px 0 !important; }
  .banking-box span, .banking-box strong { font-size: 9.6px !important; }
}

/* Patch 13.3 — Company wallpapers and theme uploads */
body.login-body.has-login-wallpaper,
body.app-body.has-app-wallpaper { position: relative; overflow-x: hidden; }
body.login-body.has-login-wallpaper::before,
body.app-body.has-app-wallpaper::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-position: center;
}
body.login-body.has-login-wallpaper::before {
  background-image: linear-gradient(135deg, rgba(246,243,237,.82), rgba(246,243,237,.72)), var(--login-wallpaper-image);
  background-size: cover, var(--login-wallpaper-size, cover);
  background-repeat: no-repeat, var(--login-wallpaper-repeat, no-repeat);
  opacity: var(--login-wallpaper-opacity, .35);
}
body.app-body.has-app-wallpaper::before {
  background-image: var(--app-wallpaper-image);
  background-size: var(--app-wallpaper-size, cover);
  background-repeat: var(--app-wallpaper-repeat, no-repeat);
  opacity: var(--app-wallpaper-opacity, .14);
}
body.login-body.has-login-wallpaper .login-shell,
body.app-body.has-app-wallpaper .app-shell { position: relative; z-index: 1; }
body.app-body.has-app-wallpaper .main-area {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 82%, transparent), color-mix(in srgb, var(--bg) 74%, transparent));
  backdrop-filter: blur(1px);
}
body.app-body.has-app-wallpaper .topbar {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}
.wallpaper-settings-grid { align-items: start; }
.wallpaper-setting-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-2);
}
.wallpaper-setting-card h3 { margin: 0; }
.wallpaper-preview {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  min-height: 150px;
  display: grid;
  place-items: center;
}
.wallpaper-preview img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
}

/* Patch 13.5 — Dashboard breathing room + global quick-create popup */
.app-shell,
.main-area,
.page-content {
  min-width: 0;
}
.main-area,
.page-content {
  max-width: 100%;
  overflow-x: hidden;
}
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
.dashboard-page {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}
.dashboard-page .panel,
.dashboard-page .stat-card {
  min-width: 0;
}
.dashboard-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.dashboard-hero > div:first-child {
  min-width: 260px;
  flex: 1 1 520px;
}
.dashboard-hero h1 {
  margin: 0 0 10px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.dashboard-hero-actions {
  display: flex;
  flex: 0 1 auto;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}
.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 16px;
}
.dashboard-kpi {
  overflow: hidden;
}
.dashboard-kpi strong,
.dashboard-kpi small,
.dashboard-kpi span {
  overflow-wrap: anywhere;
}
.dashboard-main-grid,
.dashboard-stack-grid,
.dashboard-recent-grid,
.dashboard-lower-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  width: 100%;
}
@media (min-width: 1580px) {
  .dashboard-main-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, .7fr);
  }
  .dashboard-stack-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  }
  .dashboard-lower-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, .75fr);
  }
}
.dashboard-readiness {
  display: grid;
  grid-template-columns: minmax(110px, .75fr) minmax(0, 1fr);
  gap: 10px 14px;
}
.dashboard-readiness dt,
.dashboard-readiness dd {
  min-width: 0;
  overflow-wrap: anywhere;
}
.dashboard-readiness dd {
  text-align: right;
}
.dashboard-table {
  width: 100%;
  table-layout: auto;
}
.dashboard-table th,
.dashboard-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: middle;
}
.dashboard-table .dash-client {
  min-width: 190px;
  max-width: 360px;
}
.dashboard-table .dash-date {
  min-width: 105px;
}
.dashboard-table td:nth-last-child(-n+2),
.dashboard-table th:nth-last-child(-n+2) {
  text-align: right;
}
.dashboard-table .pill {
  white-space: nowrap;
}
.stack-item,
.attention-item,
.status-row {
  min-width: 0;
}
.stack-item div,
.attention-item div,
.status-row div {
  min-width: 0;
}
.stack-item small,
.attention-item p,
.status-row small {
  overflow-wrap: anywhere;
}
.mini-chart {
  overflow: hidden;
}
.chart-row {
  min-width: 0;
}
.chart-bars {
  min-width: 0;
}
.chart-bars .bar em {
  white-space: nowrap;
}

.quick-create-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
}
.quick-create-modal.is-open {
  display: block;
}
.quick-create-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, .52);
  backdrop-filter: blur(4px);
}
.quick-create-card {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 28px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  margin: 18px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 28px 80px rgba(0,0,0,.24);
  padding: 22px;
}
.quick-create-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.quick-create-head h2 {
  margin: 0 0 6px;
  font-size: 26px;
}
.quick-create-close {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}
.quick-create-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.quick-create-tile {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 18px;
  padding: 16px;
  transition: .18s ease;
}
.quick-create-tile:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 14px 28px rgba(31,36,40,.09);
}
.quick-create-tile b {
  font-size: 16px;
}
.quick-create-tile span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
body.quick-create-open {
  overflow: hidden;
}

@media (max-width: 760px) {
  .topbar-actions .btn {
    display: none;
  }
  .dashboard-hero-actions {
    justify-content: stretch;
    width: 100%;
  }
  .dashboard-hero-actions .btn {
    flex: 1 1 180px;
  }
  .dashboard-readiness {
    grid-template-columns: 1fr;
  }
  .dashboard-readiness dd {
    text-align: left;
  }
  .quick-create-card {
    margin: 10px auto;
    width: calc(100% - 20px);
    border-radius: 22px;
    padding: 18px;
  }
  .quick-create-head {
    align-items: flex-start;
  }
}

/* Patch 13.6 — Dashboard QA Fix: chart rendering, text spacing and email activity layout */
.dashboard-page {
  --dash-card-gap: 16px;
}
.dashboard-kpi strong {
  display: block;
  font-size: clamp(24px, 2.1vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.dashboard-kpi small {
  line-height: 1.35;
}
.dashboard-page .panel-head.compact-head {
  align-items: flex-start;
  gap: 14px;
}
.dashboard-page .panel-head.compact-head .btn {
  flex: 0 0 auto;
}
.attention-list,
.stack-list,
.status-breakdown {
  display: grid;
  gap: 10px;
}
.attention-item,
.stack-item,
.status-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-2));
  text-decoration: none;
  color: var(--text);
}
.attention-item:hover,
.stack-item:hover,
.status-row:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}
.attention-item b,
.stack-item b,
.status-row b {
  display: block;
  line-height: 1.25;
}
.attention-item p,
.stack-item small,
.status-row small {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.35;
}
.attention-item > span,
.stack-item > strong,
.stack-item > .pill {
  flex: 0 0 auto;
  white-space: nowrap;
}
.status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 38%);
  align-items: center;
}
.status-row > span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.status-row > span i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.mini-chart {
  display: grid;
  gap: 13px;
  margin-top: 4px;
  overflow: visible;
}
.chart-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.chart-row > span {
  font-weight: 900;
  color: var(--muted);
}
.chart-bars {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.chart-bars .bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 52px;
  max-width: 100%;
  height: 20px;
  border-radius: 999px;
  padding: 0 8px;
  overflow: visible;
}
.chart-bars .bar.income {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 74%, #fff), var(--accent));
}
.chart-bars .bar.expense {
  height: 16px;
  background: #d5dae2;
}
.chart-bars .bar em {
  position: relative;
  z-index: 1;
  display: inline-block;
  font-style: normal;
  font-weight: 950;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  color: #0f172a;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 800;
}
.chart-legend span {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
}
.legend-income { background: var(--accent); }
.legend-expense { background: #d5dae2; }
.email-activity-item {
  align-items: center;
}
.email-activity-main {
  min-width: 0;
}
.email-activity-main small {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  overflow-wrap: anywhere;
}
.email-activity-main small span {
  min-width: 0;
}
.email-error {
  color: #b42318 !important;
}
.dashboard-table {
  border-collapse: collapse;
}
.dashboard-table th,
.dashboard-table td {
  padding: 12px 10px;
  line-height: 1.35;
}
.dashboard-table td,
.dashboard-table th {
  max-width: 300px;
}
.dashboard-table .dash-client {
  max-width: 320px;
}
.dashboard-table a {
  white-space: nowrap;
}
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 1080px) {
  .dashboard-kpis { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .status-row { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 760px) {
  .attention-item,
  .stack-item {
    display: grid;
    grid-template-columns: 1fr;
  }
  .attention-item > span,
  .stack-item > strong,
  .stack-item > .pill {
    justify-self: start;
  }
  .chart-row {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
  }
}
