:root {
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --line: #e4e7ec;
  --line-soft: #edf1f6;
  --paper: #ffffff;
  --bg: #f4f7fb;
  --primary: #1746a2;
  --accent: #129c67;
  --sidebar: #0f172a;
  --secondary: #0f172a;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 18px 48px rgba(15,23,42,.065);
  --shadow-float: 0 28px 80px rgba(15,23,42,.18);
  --focus: 0 0 0 4px rgba(23,70,162,.16);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
a { text-decoration: none; }
.ui-icon { width: 20px; height: 20px; display: inline-block; flex: 0 0 auto; }
.btn { border: 1px solid transparent; border-radius: var(--radius-md); padding: 9px 14px; font-weight: 780; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink); background: #fff; transition: transform .14s ease, box-shadow .14s ease, opacity .14s ease, background-color .14s ease, border-color .14s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(15,23,42,.08); }
.btn:disabled { cursor: wait; opacity: .62; transform: none; }
.btn-sm { padding: 7px 10px; font-size: 13px; }
.btn-primary { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 96%, #fff 4%), var(--primary)); color: #fff; box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 22%, transparent); }
.btn-success { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 96%, #fff 4%), var(--accent)); color: #fff; }
.btn-dark { background: #101828; color: #fff; }
.btn-light { background: #f8fafc; color: #101828; border-color: #e4e7ec; }
.btn-outline-danger { border-color: #fda29b; color: #b42318; background: #fff; }
.form-control, .form-select { width: 100%; min-height: 42px; border: 1px solid #d0d5dd; border-radius: 8px; padding: 9px 12px; background: #fff; color: var(--ink); outline: none; transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease; }
.form-control:focus, .form-select:focus, .btn:focus-visible, a:focus-visible { box-shadow: var(--focus); border-color: var(--primary); outline: none; }
textarea.form-control { min-height: 96px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: start; }
.table-hover tr:hover td { background: #f8fafc; }
.text-end { text-align: end; }
.w-100 { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-error, .alert-danger { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.alert-success { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.alert-warning { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.alert-info { background: #eef4ff; color: #1746a2; border-color: #c7d7fe; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; background: linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%); }
.sidebar { background: linear-gradient(180deg, color-mix(in srgb, var(--sidebar) 96%, #fff 4%), #0b1220); color: #fff; padding: 24px 16px; box-shadow: 12px 0 40px rgba(15,23,42,.1); }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 34px; }
.brand.large { color: var(--ink); margin-bottom: 26px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius-md); background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 18px 40px rgba(18,156,103,.18); }
.brand-icon { width: 23px; height: 23px; }
.brand-logo { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: #fff; }
.brand small { display: block; color: #98a2b3; letter-spacing: 0; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a { position: relative; color: #d0d5dd; padding: 10px 11px; border-radius: var(--radius-md); display: flex; align-items: center; gap: 11px; font-weight: 720; transition: background-color .14s ease, color .14s ease, transform .14s ease; }
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 var(--accent); transform: translateX(1px); }
.rtl .sidebar nav a:hover, .rtl .sidebar nav a.active { box-shadow: inset -3px 0 0 var(--accent); }
.nav-icon { width: 32px; min-width: 32px; height: 32px; padding: 7px; border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius-md); display: inline-grid; place-items: center; color: #e5eefc; background: rgba(255,255,255,.07); }
.sidebar nav a.active .nav-icon, .sidebar nav a:hover .nav-icon { color: #fff; background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.18); }
.nav-group { color: #98a2b3; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 14px 14px 4px; }
.sidebar nav a.sub-link { font-size: 13px; padding: 8px 14px 8px 28px; color: #98a2b3; }
.rtl .sidebar nav a.sub-link { padding: 8px 28px 8px 14px; }
.sidebar-collapse-toggle {
  margin-inline-start: auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  color: #fff;
  background: rgba(255,255,255,.08);
  cursor: pointer;
}
.sidebar-search { margin: -18px 0 18px; }
.sidebar-search .form-control {
  min-height: 38px;
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: #fff;
}
.nav-badge {
  margin-inline-start: auto;
  min-width: 22px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #f97316;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}
body.sidebar-collapsed.app-shell { grid-template-columns: 92px 1fr; }
body.sidebar-collapsed .sidebar { padding-inline: 12px; }
body.sidebar-collapsed .brand div,
body.sidebar-collapsed .sidebar-search,
body.sidebar-collapsed .nav-group,
body.sidebar-collapsed .sidebar nav a:not(.active) .nav-badge,
body.sidebar-collapsed .sidebar nav a.sub-link { display: none; }
body.sidebar-collapsed .sidebar nav a {
  justify-content: center;
  font-size: 0;
  padding: 10px;
}
body.sidebar-collapsed .sidebar nav a .nav-icon { margin: 0; }
body.sidebar-collapsed .nav-badge {
  position: absolute;
  transform: translate(18px, -14px);
  margin: 0;
}
.main { min-width: 0; }
.topbar { min-height: 92px; padding: 22px 34px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid rgba(228,231,236,.8); background: rgba(255,255,255,.86); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 5; }
.topbar h1 { margin: 0; font-size: 28px; font-weight: 750; }
.eyebrow { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.top-actions, .action-row, .toolbar, .actions, .doc-actions { display: flex; align-items: center; gap: 10px; }
.global-search { position: relative; width: min(460px, 34vw); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.global-search kbd { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 8px 10px; color: var(--muted); background: #fff; font-size: 12px; white-space: nowrap; box-shadow: inset 0 -1px 0 rgba(15,23,42,.04); }
.global-search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 30; max-height: 420px; overflow-y: auto; background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-float); padding: 8px; }
.search-result-row { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; color: var(--ink); }
.search-result-row:hover { background: #f8fafc; }
.search-result-row .document-icon { width: 40px; height: 36px; font-size: 11px; }
.search-result-row small { display: block; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.search-empty { padding: 16px; color: var(--muted); }
.command-palette { position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center; padding-top: 10vh; background: rgba(15,23,42,.42); backdrop-filter: blur(5px); }
.command-palette[hidden] { display: none; }
.command-dialog { width: min(760px, calc(100vw - 28px)); background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: 0 30px 90px rgba(15,23,42,.28); overflow: hidden; }
.command-head { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line-soft); background: #fbfcfe; }
.command-results { padding: 8px; max-height: 58vh; overflow-y: auto; }
.content { padding: 30px 34px 64px; max-width: 1480px; width: 100%; }
.panel, .metric { background: rgba(255,255,255,.94); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.panel { padding: 24px; margin-bottom: 18px; }
.panel h2 { font-size: 18px; margin-bottom: 18px; }
.form-card { background: rgba(255,255,255,.96); border: 1px solid var(--line-soft); border-radius: 8px; box-shadow: 0 20px 55px rgba(15,23,42,.055); padding: 24px; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.card-header h2 { margin: 4px 0 0; font-size: 20px; }
.soft-divider { border: 0; border-top: 1px solid var(--line-soft); margin: 22px 0; }
.check-row { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.check-row input { width: 16px; height: 16px; }
.input-action { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.async-select { position: relative; display: grid; gap: 8px; min-width: 0; }
.async-select select { min-height: 38px; color: var(--muted); background: #f8fafc; }
.async-select-results { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; max-height: 280px; overflow: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-float); padding: 6px; }
.async-select-option { width: 100%; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: start; padding: 10px 11px; cursor: pointer; display: grid; gap: 3px; }
.async-select-option:hover, .async-select-option:focus-visible { background: #f2f6ff; outline: none; }
.async-select-option strong { font-size: 14px; }
.async-select-option small, .async-select-empty { color: var(--muted); font-size: 12px; }
.async-select-empty { padding: 10px 11px; }
.verify-result { display: block; min-height: 18px; margin-top: 6px; color: var(--muted); font-weight: 700; }
.verify-result.success { color: #067647; }
.verify-result.error { color: #b42318; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric { padding: 20px; }
.metric span { color: var(--muted); font-size: 13px; display: block; }
.metric strong { font-size: 28px; }
.metric.accent { background: #103d32; color: #fff; }
.metric.accent span { color: #bbf7d0; }
.dashboard-hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; padding: 30px; margin-bottom: 18px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 10%, transparent), transparent 32%), linear-gradient(135deg, #ffffff, #f7fbff); box-shadow: var(--shadow-card); }
.dashboard-hero h2 { margin: 4px 0 8px; font-size: 34px; line-height: 1.08; }
.dashboard-hero p { color: var(--muted); margin: 0; max-width: 620px; }
.quick-create { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card { position: relative; padding: 20px; min-height: 142px; background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden; transition: transform .14s ease, box-shadow .14s ease; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 24px 60px rgba(15,23,42,.09); }
.kpi-card::after { content: ""; position: absolute; inset: auto 18px 0 18px; height: 3px; border-radius: 999px 999px 0 0; background: var(--primary); opacity: .72; }
.kpi-card span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.kpi-card strong { display: block; margin-top: 12px; font-size: 28px; line-height: 1.1; }
.kpi-card small { display: block; margin-top: 10px; color: var(--muted); line-height: 1.45; }
.kpi-primary { background: #102033; color: #fff; }
.kpi-primary span, .kpi-primary small { color: #cbd5e1; }
.kpi-primary::after { background: var(--accent); }
.kpi-warning::after { background: #f79009; }
.kpi-danger::after { background: #d92d20; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr); gap: 18px; }
.quick-action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.quick-action-grid a { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); color: var(--ink); background: #f8fafc; transition: transform .14s ease, border-color .14s ease, background-color .14s ease, box-shadow .14s ease; }
.quick-action-grid a:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 28%, #d0d5dd); background: #fff; }
.action-icon { width: 42px; height: 38px; padding: 9px; display: grid; place-items: center; border-radius: var(--radius-md); background: #eef4ff; color: var(--primary); }
.summary-list { display: grid; gap: 12px; }
.summary-list div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.summary-list span { color: var(--muted); }
.summary-list strong, .activity-amount { font-weight: 850; color: var(--ink); }
.rich-activity { align-items: center; border-top-color: var(--line-soft); }
.rich-activity span:first-child { display: grid; gap: 3px; }
.rich-activity small { color: var(--muted); }
.notification-list { display: grid; gap: 10px; }
.notification-card { display: block; padding: 14px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fbfcfe; color: var(--ink); }
.notification-card strong, .notification-card small { display: block; }
.notification-card small { color: var(--muted); margin-top: 4px; }
.notification-card.danger { border-color: #fecdca; background: #fef3f2; }
.notification-card.warning { border-color: #fedf89; background: #fffaeb; }
.notification-card.success { border-color: #abefc6; background: #ecfdf3; }
.calendar-row { display: flex; justify-content: space-between; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line-soft); color: var(--ink); }
.calendar-row small { display: block; color: var(--muted); margin-top: 3px; }
.calendar-row.overdue strong:last-child { color: #b42318; }
.finance-summary { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.finance-summary span { color: var(--muted); }
.finance-summary strong { font-size: 24px; color: var(--primary); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.activity { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); color: var(--ink); }
.toolbar { justify-content: space-between; margin-bottom: 16px; }
.search-box { max-width: 420px; width: 100%; }
.responsive-table { overflow-x: auto; border-radius: 8px; }
.table-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.document-toolbar { align-items: stretch; gap: 14px; }
.document-toolbar .btn { min-height: 42px; }
.document-list-panel { padding: 8px 8px 18px; overflow: hidden; }
.document-table { border-collapse: separate; border-spacing: 0; }
.document-table thead th { padding: 15px 16px; color: #667085; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; background: #f8fafc; border-bottom: 1px solid var(--line-soft); }
.document-table td { padding: 17px 16px; vertical-align: middle; border-bottom: 1px solid var(--line-soft); }
.document-row { transition: background-color .14s ease, box-shadow .14s ease, transform .14s ease; }
.document-row:hover td { background: #fbfdff; }
.document-row:hover { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--primary) 42%, #fff); }
.rtl .document-row:hover { box-shadow: inset -3px 0 0 color-mix(in srgb, var(--primary) 42%, #fff); }
.doc-number { display: inline-block; color: var(--primary); font-weight: 850; font-size: 15px; margin-bottom: 4px; }
.document-row small, .date-stack span, .paid-stack small { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; }
.customer-name { display: block; color: var(--ink); font-weight: 800; margin-bottom: 4px; }
.date-stack { min-width: 160px; }
.financial-amount { font-weight: 900; color: var(--ink); white-space: nowrap; }
.paid-stack { display: grid; gap: 4px; }
.premium-empty { min-height: 340px; background: radial-gradient(circle at top, color-mix(in srgb, var(--primary) 8%, transparent), transparent 34%), linear-gradient(180deg, #fff, #f8fafc); border-radius: var(--radius-lg); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid label span { color: var(--muted); font-size: 13px; display: block; margin-bottom: 6px; }
.span-2 { grid-column: span 2; }
.inline { display: inline; }
.empty-state { min-height: 280px; display: grid; place-items: center; align-content: center; text-align: center; gap: 10px; color: var(--muted); padding: 30px; }
.empty-state strong { color: var(--ink); font-size: 22px; }
.pagination-bar { padding-top: 16px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.pagination-actions { display: flex; align-items: center; gap: 10px; }
.field-error { color: #b42318; display: block; margin-top: 6px; }
.is-invalid { border-color: #f04438; }
.customer-hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.customer-hero h2 { font-size: 30px; margin: 4px 0 6px; }
.customer-hero p, .muted { color: var(--muted); margin: 0; }
.customer-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.info-list dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 18px; margin: 0; }
.info-list dt { color: var(--muted); font-weight: 650; }
.info-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.badge.soft { background: #eef4ff; color: #1746a2; border: 1px solid #c7d7fe; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 6px 11px; font-size: 12px; font-weight: 850; border: 1px solid transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.32); white-space: nowrap; line-height: 1; }
.status-badge::before { content: ""; width: 14px; height: 14px; border-radius: 999px; background: currentColor; opacity: .13; box-shadow: inset 0 0 0 4px currentColor; }
.status-draft { background: #f8fafc; color: #475467; border-color: #d0d5dd; }
.status-sent { background: #eff6ff; color: #175cd3; border-color: #bfdbfe; }
.status-viewed { background: #f0f9ff; color: #026aa2; border-color: #b9e6fe; }
.status-accepted { background: #ecfdf3; color: #047857; border-color: #a7f3d0; }
.status-rejected, .status-cancelled, .status-expired { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.status-converted, .status-validated { background: #eef4ff; color: #3538cd; border-color: #c7d7fe; }
.payment-unpaid { background: #fff1f3; color: #c01048; border-color: #fecdd6; }
.payment-partial { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.payment-paid { background: #ecfdf3; color: #047857; border-color: #a7f3d0; }
.payment-overdue { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.payment-cancelled { background: #f2f4f7; color: #475467; border-color: #d0d5dd; }
.payment-archived { background: #f8fafc; color: #667085; border-color: #e4e7ec; }
.signature-unsigned { background: #f8fafc; color: #475467; border-color: #d0d5dd; }
.signature-pending_signature { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.signature-signed { background: #ecfdf3; color: #047857; border-color: #a7f3d0; }
.signature-declined_signature { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.quote-filters { display: grid; grid-template-columns: minmax(220px, 1fr) 190px; gap: 10px; max-width: 660px; }
.advanced-filters { display: grid; grid-template-columns: minmax(220px, 1fr) 160px 150px 150px 130px 130px; gap: 10px; max-width: 1040px; }
.toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.bulk-bar { position: sticky; top: 74px; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-bottom: 12px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(255,255,255,.96); box-shadow: var(--shadow-card); }
.bulk-bar[hidden] { display: none; }
.bulk-bar strong { margin-inline-end: auto; color: var(--ink); }
.bulk-bar .form-select { width: 220px; }
.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.quote-summary { position: sticky; top: 116px; border-color: color-mix(in srgb, var(--primary) 16%, var(--line-soft)); box-shadow: 0 24px 70px rgba(15,23,42,.08); }
.quote-summary h2 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 14px; }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.quote-builder-table { border-collapse: separate; border-spacing: 0 8px; }
.quote-builder-table th { white-space: nowrap; padding: 8px 10px; color: var(--muted); font-size: 11px; text-transform: uppercase; border: 0; }
.quote-builder-table td { padding: 8px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: #fff; }
.quote-builder-table td:first-child { border-left: 1px solid var(--line-soft); border-radius: 8px 0 0 8px; }
.quote-builder-table td:last-child { border-right: 1px solid var(--line-soft); border-radius: 0 8px 8px 0; }
.rtl .quote-builder-table td:first-child { border-left: 0; border-right: 1px solid var(--line-soft); border-radius: 0 8px 8px 0; }
.rtl .quote-builder-table td:last-child { border-right: 0; border-left: 1px solid var(--line-soft); border-radius: 8px 0 0 8px; }
.quote-builder-table input, .quote-builder-table select { min-width: 120px; border-color: #e6ebf2; background: #fbfcfe; }
.quote-builder-table td:first-child input { min-width: 280px; }
.quote-builder-table [data-line-total] { white-space: nowrap; font-weight: 900; color: var(--ink); }
.live-totals { max-width: none; margin: 0; }
.live-totals div { padding: 12px 0; }
.live-totals .grand { margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 22px; }
.live-totals .grand strong { color: var(--primary); }
.premium-builder { display: grid; gap: 18px; }
.builder-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 22px; padding: 26px 28px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 10%, transparent), transparent 34%), linear-gradient(135deg, #fff, #f7fbff); box-shadow: var(--shadow-card); }
.builder-hero h1 { margin: 3px 0 8px; font-size: clamp(30px, 4vw, 46px); line-height: 1; letter-spacing: 0; }
.builder-hero p { margin: 0; color: var(--muted); }
.builder-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.builder-workspace-grid { grid-template-columns: minmax(0, 1fr) 390px; }
.builder-workspace { display: grid; gap: 16px; min-width: 0; }
.builder-card { border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: rgba(255,255,255,.96); box-shadow: var(--shadow-card); overflow: hidden; }
.builder-card summary, .builder-card-header { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 17px 18px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(180deg, #fff, #fbfcfe); cursor: pointer; }
.builder-card summary::-webkit-details-marker { display: none; }
.builder-card summary strong, .builder-card-header strong { display: block; font-size: 16px; color: var(--ink); }
.builder-card summary small, .builder-card-header small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.35; }
.builder-card-icon { width: 42px; height: 42px; border-radius: var(--radius-md); display: grid; place-items: center; background: #eef4ff; color: var(--primary); box-shadow: inset 0 0 0 1px #dbe8ff; }
.builder-card-icon .ui-icon { width: 21px; height: 21px; }
.builder-card-body { padding: 18px; }
.builder-card-body .input-action { grid-template-columns: minmax(0, 1fr) auto; }
.builder-card textarea.form-control { min-height: 116px; resize: vertical; }
.premium-financial-sidebar { position: sticky; top: 112px; align-self: start; padding: 20px; border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--line-soft)); background: linear-gradient(180deg, #fff, #f8fbff); box-shadow: 0 28px 80px rgba(15,23,42,.1); }
.premium-financial-sidebar h2 { margin: 2px 0 14px; color: var(--ink); font-size: 18px; letter-spacing: 0; text-transform: none; }
.sidebar-kicker { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.financial-total-hero { padding: 18px; margin-bottom: 14px; border-radius: var(--radius-lg); background: linear-gradient(135deg, #101828, #1e3a5f); color: #fff; box-shadow: 0 20px 44px rgba(15,23,42,.2); }
.financial-total-hero span { display: block; color: #cbd5e1; font-size: 12px; font-weight: 800; }
.financial-total-hero strong { display: block; margin-top: 8px; color: #fff; font-size: clamp(24px, 2.6vw, 34px); line-height: 1.08; }
.premium-financial-sidebar .live-totals { padding: 2px 0; }
.premium-financial-sidebar .live-totals div { border-bottom-color: var(--line-soft); padding: 11px 0; }
.premium-financial-sidebar .live-totals span { color: var(--muted); }
.premium-financial-sidebar .live-totals strong { font-variant-numeric: tabular-nums; }
.premium-financial-sidebar .payment-state-row strong { display: inline-flex; align-items: center; border-radius: 999px; padding: 7px 10px; background: #eef4ff; color: var(--primary); font-size: 12px; }
.sidebar-actions { display: grid; gap: 9px; margin-top: 16px; }
.sidebar-actions .btn { width: 100%; }
.premium-line-items { overflow: visible; }
.premium-line-items .quote-builder-table { width: 100%; border-spacing: 0 12px; }
.premium-line-items .quote-builder-table thead th { padding: 0 10px 6px; border: 0; color: var(--muted); font-size: 10px; letter-spacing: .06em; }
.premium-line-items .quote-builder-table tr[data-line-row] { transition: transform .14s ease, box-shadow .14s ease; }
.premium-line-items .quote-builder-table tr[data-line-row]:hover { transform: translateY(-1px); }
.premium-line-items .quote-builder-table td { padding: 10px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: #fff; vertical-align: middle; box-shadow: 0 12px 34px rgba(15,23,42,.035); }
.premium-line-items .quote-builder-table td:first-child { border-left: 1px solid var(--line-soft); border-radius: 14px 0 0 14px; }
.premium-line-items .quote-builder-table td:last-child { border-right: 1px solid var(--line-soft); border-radius: 0 14px 14px 0; }
.rtl .premium-line-items .quote-builder-table td:first-child { border-left: 0; border-right: 1px solid var(--line-soft); border-radius: 0 14px 14px 0; }
.rtl .premium-line-items .quote-builder-table td:last-child { border-right: 0; border-left: 1px solid var(--line-soft); border-radius: 14px 0 0 14px; }
.premium-line-items .quote-builder-table input, .premium-line-items .quote-builder-table select { min-width: 104px; border-color: transparent; background: #f8fafc; font-weight: 720; }
.premium-line-items .quote-builder-table input:focus, .premium-line-items .quote-builder-table select:focus { background: #fff; }
.premium-line-items .quote-builder-table .line-description-input { min-width: 300px; background: #fff; font-weight: 800; }
.line-total-cell strong { display: inline-flex; align-items: center; justify-content: flex-end; min-width: 104px; color: var(--ink); font-weight: 950; font-variant-numeric: tabular-nums; }
.line-actions-cell { white-space: nowrap; }
.icon-only { width: 36px; height: 36px; padding: 0; }
.icon-only .ui-icon { width: 17px; height: 17px; }
.note-grid p { color: var(--muted); margin: 0; }
.timeline-placeholder { display: grid; gap: 12px; color: var(--muted); }
.line-table th, .line-preview th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.discount-cell { display: grid; grid-template-columns: 1fr 90px; gap: 8px; }
.doc-head, .doc-parties, .payment-box { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.doc-head h2 { margin: 0 0 8px; font-size: 30px; }
.doc-parties { padding: 22px; background: #f8fafc; border-radius: 8px; }
.totals { margin-left: auto; max-width: 360px; display: grid; gap: 8px; }
.rtl .totals { margin-left: 0; margin-right: auto; }
.totals div, .payment-box { padding: 10px 0; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.totals .grand { font-size: 20px; border-bottom: 0; }
.doc-notes { margin-top: 24px; color: var(--muted); }
.mini-form { display: grid; gap: 10px; }
.check { color: var(--muted); display: flex; gap: 8px; align-items: center; }
.signature-pad { width: 100%; height: 180px; border: 1px dashed #98a2b3; border-radius: 8px; background: #fff; touch-action: none; display: block; }
.signature-preview { width: 240px; min-height: 82px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 12px; background: #fff; }
.signature-preview img { max-width: 100%; height: auto; display: block; }
.attachment-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.attachment-row a { color: var(--ink); display: grid; gap: 2px; }
.attachment-row small, .empty-inline { color: var(--muted); }
.empty-inline { padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius-md); background: #f8fafc; }
.document-icon { width: 58px; height: 58px; padding: 15px; border-radius: var(--radius-lg); display: grid; place-items: center; background: #eef4ff; color: var(--primary); box-shadow: inset 0 0 0 1px #dbe8ff; }
.document-architecture { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.document-architecture span { border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; background: #fff; color: var(--muted); font-size: 12px; }
.workspace-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.28); backdrop-filter: blur(3px); z-index: 20; }
.workspace-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(590px, calc(100vw - 48px)); background: #fff; box-shadow: -28px 0 80px rgba(15,23,42,.22); z-index: 21; transform: translateX(104%); transition: transform .22s cubic-bezier(.2,.8,.2,1); overflow-y: auto; border-left: 1px solid var(--line-soft); }
.rtl .workspace-panel { right: auto; left: 0; transform: translateX(-104%); border-left: 0; border-right: 1px solid var(--line-soft); box-shadow: 28px 0 80px rgba(15,23,42,.22); }
.workspace-panel.open { transform: translateX(0); }
.workspace-panel-content { min-height: 100%; outline: none; }
.workspace-loading { padding: 28px; color: var(--muted); }
.workspace-panel-header { padding: 28px; border-bottom: 1px solid var(--line-soft); background: radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 10%, transparent), transparent 34%), linear-gradient(180deg, #f8fafc, #fff); position: relative; }
.workspace-close { position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; border-radius: var(--radius-md); border: 1px solid var(--line-soft); background: #fff; cursor: pointer; font-size: 22px; line-height: 1; color: var(--ink); box-shadow: 0 10px 24px rgba(15,23,42,.06); }
.rtl .workspace-close { right: auto; left: 18px; }
.workspace-panel-header h2 { margin: 6px 44px 10px 0; font-size: 28px; line-height: 1.12; }
.rtl .workspace-panel-header h2 { margin: 6px 0 10px 44px; }
.workspace-title-meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.workspace-title-meta strong { font-size: 22px; font-weight: 900; }
.workspace-panel-header p { margin: 12px 0 0; color: var(--muted); }
.workspace-section { padding: 24px 28px; border-bottom: 1px solid var(--line-soft); }
.workspace-section h3 { margin: 0 0 14px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.workspace-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.workspace-actions form { display: inline-flex; }
.email-modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; background: rgba(15,23,42,.42); backdrop-filter: blur(5px); }
.email-modal-backdrop[hidden] { display: none; }
.email-modal { width: min(720px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: 0 28px 90px rgba(15,23,42,.26); animation: modalIn .16s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
.email-modal-header { position: relative; padding: 22px 26px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(180deg, #f8fafc, #fff); }
.email-modal-header h3 { margin: 4px 44px 0 0; font-size: 22px; }
.rtl .email-modal-header h3 { margin: 4px 0 0 44px; }
.email-warning { margin: 16px 26px 0; padding: 12px 14px; border-radius: 8px; background: #fffaeb; color: #b54708; border: 1px solid #fedf89; }
.sender-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 18px 26px 0; }
.sender-preview div { padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fbfcfe; min-width: 0; }
.sender-preview span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.sender-preview strong { display: block; overflow-wrap: anywhere; font-size: 13px; }
.email-modal .email-compose { margin: 18px 26px 26px; }
.modal-open { overflow: hidden; }
.toast-stack { position: fixed; right: 22px; bottom: 22px; display: grid; gap: 10px; z-index: 80; max-width: min(360px, calc(100vw - 32px)); }
.rtl .toast-stack { right: auto; left: 22px; }
.toast { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line-soft); background: #fff; box-shadow: 0 18px 46px rgba(15,23,42,.18); color: var(--ink); font-weight: 750; }
.toast-info { border-color: #bfdbfe; color: #175cd3; background: #eff6ff; }
.toast-success { border-color: #abefc6; color: #067647; background: #ecfdf3; }
.toast-error { border-color: #fecdca; color: #b42318; background: #fef3f2; }
.pdf-preview-card a { display: flex; gap: 14px; align-items: center; color: var(--ink); padding: 14px; border: 1px solid var(--line-soft); background: #f8fafc; border-radius: var(--radius-lg); transition: background-color .14s ease, transform .14s ease, border-color .14s ease; }
.pdf-preview-card a:hover { background: #fff; transform: translateY(-1px); border-color: color-mix(in srgb, var(--primary) 24%, var(--line-soft)); }
.pdf-preview-card small, .relation-card small { display: block; color: var(--muted); margin-top: 4px; }
.workspace-financial-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.workspace-financial-grid div { padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: #fbfcfe; }
.workspace-financial-grid span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.workspace-financial-grid strong { font-size: 16px; font-weight: 900; }
.relation-card { display: block; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); color: var(--ink); background: #fff; margin-bottom: 10px; transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease; }
.relation-card:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--primary) 24%, var(--line-soft)); box-shadow: 0 12px 28px rgba(15,23,42,.06); }
.relation-card span { display: inline-block; color: var(--primary); font-size: 11px; font-weight: 850; margin-bottom: 6px; }
.timeline { display: grid; gap: 14px; }
.timeline-item { display: grid; grid-template-columns: 18px 1fr; gap: 10px; }
.timeline-item > span { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); margin-top: 4px; box-shadow: 0 0 0 4px #eef4ff; }
.timeline-item > span.timeline-email { background: #0e9384; box-shadow: 0 0 0 4px #ccfbef; }
.timeline-item > span.email_failed { background: #d92d20; box-shadow: 0 0 0 4px #fee4e2; }
.timeline-item strong { display: block; font-size: 14px; }
.timeline-item small { display: block; color: var(--muted); margin-top: 3px; }
.payment-form, .email-compose { padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: #f8fafc; margin-bottom: 14px; }
.compact-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
.payment-row { display: flex; justify-content: space-between; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line-soft); }
.payment-row strong { display: block; font-size: 16px; }
.payment-row small { display: block; color: var(--muted); margin-top: 3px; }
.payment-row > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.registry-lookup { padding: 14px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fbfcfe; }
.registry-results { display: grid; gap: 8px; margin-top: 10px; }
.registry-card { width: 100%; text-align: start; border: 1px solid var(--line-soft); border-radius: 8px; padding: 12px; background: #fff; color: var(--ink); cursor: pointer; }
.registry-card:hover { border-color: color-mix(in srgb, var(--primary) 32%, var(--line-soft)); box-shadow: 0 12px 28px rgba(15,23,42,.06); }
.registry-card strong { display: block; font-weight: 850; }
.registry-card small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.progress-track { width: 100%; height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress-track span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.settings-nav { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.settings-nav a { background: #fff; border: 1px solid var(--line); color: var(--ink); padding: 10px 14px; border-radius: 8px; }
.settings-nav a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.radio-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 10px; cursor: pointer; }
.radio-card input { margin-top: 4px; }
.radio-card strong { display: block; }
.radio-card small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.logo-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.logo-preview { width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; background: #f8fafc; overflow: hidden; font-weight: 800; color: var(--primary); }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.color-input { min-height: 48px; padding: 4px; }
.theme-preview { height: 180px; border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: 90px 1fr; overflow: hidden; background: #f8fafc; }
.theme-preview aside { background: var(--preview-sidebar); }
.theme-preview main { padding: 22px; display: grid; align-content: center; gap: 14px; }
.theme-preview span { display: block; width: 70%; height: 16px; border-radius: 8px; background: var(--preview-primary); }
.theme-preview strong { display: block; width: 46%; height: 12px; border-radius: 8px; background: #d0d5dd; }
.theme-preview button { width: 110px; border: 0; border-radius: 8px; padding: 10px; color: #fff; background: var(--preview-accent); }
.template-studio { overflow: hidden; }
.template-studio-grid { display: grid; grid-template-columns: minmax(360px, .86fr) minmax(0, 1.14fr); gap: 18px; align-items: start; }
.template-controls { display: grid; gap: 16px; }
.template-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.template-card { text-align: start; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 13px; background: #fff; color: var(--ink); cursor: pointer; display: grid; gap: 8px; transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease; }
.template-card:hover, .template-card.active { transform: translateY(-1px); border-color: color-mix(in srgb, var(--template-accent) 42%, var(--line-soft)); box-shadow: 0 16px 38px rgba(15,23,42,.08); }
.template-card.active { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--template-accent) 72%, #fff), 0 16px 38px rgba(15,23,42,.08); }
.template-card strong { font-size: 14px; }
.template-card small { color: var(--muted); line-height: 1.35; }
.template-thumb { height: 82px; border-radius: var(--radius-md); background: linear-gradient(180deg, #fff, #f8fafc); border: 1px solid var(--line-soft); padding: 10px; display: grid; gap: 7px; }
.template-thumb i, .template-thumb b, .template-thumb em, .template-thumb span { display: block; border-radius: 999px; }
.template-thumb i { width: 46%; height: 10px; background: var(--template-accent); }
.template-thumb b { width: 88%; height: 8px; background: #d0d5dd; }
.template-thumb em { width: 64%; height: 8px; background: #eaecf0; }
.template-control-panel { border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 16px; background: #fbfcfe; }
.template-control-panel h3 { margin: 0 0 14px; font-size: 14px; color: var(--ink); }
.preview-toggle { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.template-preview-shell { position: sticky; top: 112px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: #0f172a; padding: 12px; box-shadow: var(--shadow-card); }
.template-preview-toolbar { display: flex; justify-content: space-between; gap: 12px; color: #fff; padding: 4px 4px 12px; }
.template-preview-toolbar span { color: #cbd5e1; font-size: 12px; }
.template-preview-frame { width: 100%; height: 760px; border: 0; border-radius: var(--radius-md); background: #fff; transform-origin: top center; }
.template-designer { margin: 0; }
.designer-shell { min-height: calc(100vh - 180px); display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; direction: ltr; }
.rtl .designer-canvas, .rtl .designer-controls { direction: rtl; }
.designer-canvas { min-width: 0; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: #111827; box-shadow: var(--shadow-card); overflow: hidden; }
.designer-canvas-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; padding: 20px 22px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); }
.designer-canvas-head h2 { margin: 4px 0 6px; font-size: 24px; }
.designer-canvas-head p { margin: 0; color: #cbd5e1; }
.designer-top-controls { display: grid; gap: 10px; justify-items: end; }
.zoom-controls { display: inline-flex; gap: 6px; padding: 5px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(255,255,255,.08); }
.zoom-controls button { border: 0; border-radius: 999px; padding: 7px 10px; background: transparent; color: #cbd5e1; font-weight: 800; cursor: pointer; }
.zoom-controls button:hover, .zoom-controls button.active { background: #fff; color: #101828; }
.document-canvas-stage { height: calc(100vh - 250px); min-height: 720px; overflow: auto; padding: 22px; background: radial-gradient(circle at top, rgba(255,255,255,.08), transparent 34%), #1f2937; display: grid; place-items: start center; scrollbar-width: thin; }
.document-canvas-stage::-webkit-scrollbar { width: 10px; height: 10px; }
.document-canvas-stage::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 999px; }
.document-page-wrap { position: relative; width: 794px; height: 1123px; transition: width .16s ease, height .16s ease; }
.document-canvas-stage .template-preview-frame { position: absolute; inset: 0 auto auto 0; width: 794px; max-width: none; height: 1123px; min-height: 1123px; border-radius: 4px; box-shadow: 0 28px 80px rgba(0,0,0,.32); transform-origin: top left; transition: transform .16s ease; }
.rtl .document-canvas-stage .template-preview-frame { transform-origin: top right; left: auto; right: 0; }
.designer-controls { position: sticky; top: 112px; max-height: calc(100vh - 132px); overflow: auto; display: grid; gap: 12px; scrollbar-width: thin; }
.designer-save-bar, .designer-section { border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-card); }
.designer-save-bar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 14px; }
.designer-save-bar span { color: var(--muted); font-size: 12px; }
.designer-save-bar .btn { grid-column: span 2; }
.designer-section { padding: 0; overflow: hidden; }
.designer-section summary { cursor: pointer; padding: 14px 16px; font-weight: 850; border-bottom: 1px solid var(--line-soft); }
.designer-section[open] summary { background: #fbfcfe; }
.designer-section > .form-grid, .designer-section > .template-picker, .designer-section > .studio-logo-row { margin: 14px; }
.designer-section .studio-logo-row + .studio-logo-row { margin-top: 0; }
.designer-help { margin: 12px 14px 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.studio-logo-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fbfcfe; }
.studio-logo-row .logo-preview { width: 48px; height: 48px; }
.studio-logo-row .logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.real-thumbs { grid-template-columns: 1fr; }
.real-thumbs .template-card { grid-template-columns: 84px 1fr; align-items: center; padding: 10px; }
.rtl .real-thumbs .template-card { grid-template-columns: 1fr 84px; }
.real-thumbs .template-card small { grid-column: 2; }
.rtl .real-thumbs .template-card small { grid-column: 1; }
.real-thumbs .template-thumb { grid-row: span 2; height: 98px; position: relative; overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px rgba(15,23,42,.02); }
.template-thumb u { display: block; border-radius: 6px; background: color-mix(in srgb, var(--template-accent) 18%, #fff); }
.template-thumb-classic { border: 2px solid #cbd5e1; gap: 6px; }
.template-thumb-classic i { width: 68%; height: 8px; background: #334155; }
.template-thumb-classic b, .template-thumb-classic em, .template-thumb-classic span { width: 100%; height: 6px; background: #e2e8f0; }
.template-thumb-classic u { height: 24px; border: 1px solid #cbd5e1; background: #fff; }
.template-thumb-modern { background: linear-gradient(135deg, color-mix(in srgb, var(--template-accent) 14%, #fff), #fff); grid-template-columns: 36% 1fr; }
.template-thumb-modern i { grid-column: 1 / -1; width: 100%; height: 20px; border-radius: 7px; }
.template-thumb-modern b { height: 34px; border-radius: 9px; background: var(--template-accent); }
.template-thumb-modern em, .template-thumb-modern u, .template-thumb-modern span { height: 7px; width: 100%; background: #dbeafe; }
.template-thumb-minimal { border-color: #fff; gap: 11px; padding: 14px; }
.template-thumb-minimal i { width: 48%; height: 5px; background: #111827; }
.template-thumb-minimal b, .template-thumb-minimal em, .template-thumb-minimal span { height: 4px; background: #e5e7eb; }
.template-thumb-minimal u { height: 18px; background: transparent; border-top: 1px solid #cbd5e1; border-radius: 0; }
.template-thumb-corporate { grid-template-columns: 32px 1fr; gap: 6px; }
.template-thumb-corporate i { grid-column: 1 / -1; width: 100%; height: 22px; border-radius: 7px; background: #111827; }
.template-thumb-corporate:before { content: ""; grid-row: 2 / span 4; width: 28px; border-radius: 8px; background: color-mix(in srgb, var(--template-accent) 18%, #eef2ff); }
.template-thumb-corporate b, .template-thumb-corporate em, .template-thumb-corporate u, .template-thumb-corporate span { grid-column: 2; height: 7px; width: 100%; }
.template-thumb-compact { gap: 4px; padding: 8px; }
.template-thumb-compact i { height: 12px; width: 100%; background: #111827; border-radius: 5px; }
.template-thumb-compact b, .template-thumb-compact em, .template-thumb-compact u, .template-thumb-compact span { height: 5px; width: 100%; background: #d1d5db; }
.template-thumb-premium { background: radial-gradient(circle at top right, color-mix(in srgb, var(--template-accent) 24%, transparent), transparent 42%), #fff; }
.template-thumb-premium i { height: 10px; width: 100%; border-radius: 0; }
.template-thumb-premium b { height: 20px; width: 76%; background: #111827; border-radius: 8px; margin-left: auto; }
.template-thumb-premium em, .template-thumb-premium span { height: 7px; width: 78%; background: #e9d5ff; }
.template-thumb-premium u { height: 28px; box-shadow: 0 8px 22px rgba(15,23,42,.08); background: #fff; border: 1px solid color-mix(in srgb, var(--template-accent) 26%, #d0d5dd); }
.template-thumb-executive { grid-template-columns: 34px 1fr; gap: 6px; background: linear-gradient(135deg, #0f2742 0 34%, #fff 34%); }
.template-thumb-executive i { grid-column: 1 / -1; width: 100%; height: 18px; background: #123c69; }
.template-thumb-executive b { height: 44px; width: 30px; background: #d8e4f0; border-radius: 8px; }
.template-thumb-executive em, .template-thumb-executive u, .template-thumb-executive span { height: 6px; width: 100%; background: #dbe3ee; }
.template-thumb-atelier { background: #fffbf2; border-color: #f4dfbd; gap: 6px; }
.template-thumb-atelier i { width: 48px; height: 7px; background: #b45309; }
.template-thumb-atelier b, .template-thumb-atelier em { height: 8px; background: #fed7aa; width: 92%; }
.template-thumb-atelier u { height: 22px; background: #fff7ed; border: 1px solid #f4c98b; }
.template-thumb-atelier span { height: 7px; background: #fbbf24; width: 58%; }
.template-thumb-minimal_pro { gap: 10px; padding: 15px; border-color: #fff; }
.template-thumb-minimal_pro i { width: 54%; height: 4px; background: #111827; }
.template-thumb-minimal_pro b, .template-thumb-minimal_pro em, .template-thumb-minimal_pro span { height: 4px; background: #e5e7eb; }
.template-thumb-minimal_pro u { height: 18px; border-top: 1px solid #111827; background: transparent; border-radius: 0; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at top left, #dbeafe, transparent 34%), #f8fafc; }
.login-card { width: min(420px, calc(100vw - 32px)); padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 30px 100px rgba(15,23,42,.12); }
.login-card label { margin-top: 12px; color: var(--muted); font-size: 13px; }
.public-body { background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%); color: var(--ink); min-height: 100vh; }
.public-shell { width: min(1120px, calc(100% - 28px)); margin: 0 auto; padding: 28px 0 56px; }
.public-hero { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: stretch; margin-bottom: 18px; }
.public-hero > div:first-child, .public-status-card { background: #fff; border: 1px solid var(--line-soft); border-radius: 8px; padding: 24px; box-shadow: 0 16px 45px rgba(15,23,42,.08); }
.public-hero h1 { margin: 8px 0; font-size: clamp(30px, 5vw, 52px); letter-spacing: 0; }
.public-logo { max-height: 54px; max-width: 190px; object-fit: contain; margin-bottom: 14px; }
.public-status-card { display: grid; align-content: center; gap: 10px; }
.public-status-card strong { font-size: 30px; }
.public-actions { position: sticky; top: 0; z-index: 15; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 18px; padding: 12px; background: rgba(248,250,252,.92); border: 1px solid var(--line-soft); border-radius: 8px; backdrop-filter: blur(8px); }
.public-actions form { margin: 0; }
.public-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.public-card { margin-bottom: 18px; }
.public-card h2 { margin-top: 0; }
.public-totals { width: min(420px, 100%); margin-left: auto; margin-top: 16px; display: grid; gap: 8px; }
.public-totals div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.public-totals .grand { font-size: 18px; border-bottom: 0; }
.public-link-card { background: #f8fafc; }
.public-link-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.public-link-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 13px; margin: 8px 0 12px; }
.public-pay-cta { margin-top: 12px; width: 100%; justify-content: center; }
.public-mobile-paybar { display: none; }
.signature-consent-box { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.signature-consent { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border: 1px solid #fedf89; background: #fffaeb; border-radius: 8px; margin-top: 12px; line-height: 1.5; }
.signature-certificate-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; }
.certificate-grid { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; }
.certificate-grid dt { color: var(--muted); }
.certificate-grid dd { margin: 0; overflow-wrap: anywhere; }
.hash-value { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.verify-card h1 { font-size: 34px; margin: 8px 0; }
.portal-nav { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 22px; }
.portal-nav a, .portal-nav button { border: 1px solid var(--line-soft); background: #fff; color: var(--ink); border-radius: 999px; padding: 9px 14px; text-decoration: none; font-weight: 700; }
.portal-card { background: #fff; border: 1px solid var(--line-soft); border-radius: 10px; padding: 24px; box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.portal-login { max-width: 520px; margin: 40px auto; }
.portal-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; background: linear-gradient(135deg, #0f172a, #1f3a5f); color: #fff; border-radius: 12px; padding: 28px; margin-bottom: 18px; }
.portal-hero.compact { padding: 22px 26px; }
.portal-hero .eyebrow, .portal-hero p { color: rgba(255,255,255,.78); }
.portal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.portal-doc-row { display: grid; grid-template-columns: 1.4fr .8fr .8fr; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.portal-doc-row:first-of-type { border-top: 0; }
.portal-doc-row:hover { background: #f8fafc; }
.portal-doc-row strong, .portal-doc-row small { display: block; }
.portal-doc-row small, .small { color: var(--muted); }
.portal-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.admin-hero-pro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  margin: 0 0 24px;
  padding: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  background:
    radial-gradient(circle at 14% 20%, rgba(15,35,31,.10), transparent 13rem),
    linear-gradient(135deg, #ffffff 0%, #f7fbf8 52%, #f7e8d7 100%);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.admin-hero-pro .eyebrow,
.admin-hero-pro p {
  color: var(--muted);
}

[data-theme="dark"] .admin-hero-pro {
  background:
    radial-gradient(circle at 14% 20%, rgba(255,255,255,.10), transparent 13rem),
    linear-gradient(135deg, #07110f, #123c35 58%, #8a4f18);
  color: #fff;
}

[data-theme="dark"] .admin-hero-pro .eyebrow,
[data-theme="dark"] .admin-hero-pro p {
  color: rgba(255,255,255,.78);
}

.admin-hero-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.admin-hero-stats span {
  min-width: 132px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.68);
  border: 1px solid rgba(15,35,31,.10);
  color: var(--muted);
  font-weight: 800;
}

.admin-hero-stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.4rem;
}

[data-theme="dark"] .admin-hero-stats span {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.16);
  color: rgba(255,255,255,.78);
}

[data-theme="dark"] .admin-hero-stats strong {
  color: #fff;
}

.pro-dashboard-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pro-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 0 0 24px;
}

.pro-kpi-card {
  position: relative;
  min-height: 156px;
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.pro-kpi-card span,
.pro-kpi-card small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.pro-kpi-card strong {
  display: block;
  margin: 10px 0 8px;
  color: var(--ink);
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1;
  letter-spacing: 0;
}

.pro-kpi-card svg {
  position: absolute;
  inset-inline: 18px;
  bottom: 14px;
  width: calc(100% - 36px);
  height: 38px;
  overflow: visible;
  fill: none;
  pointer-events: none;
  opacity: .78;
}

.pro-kpi-card svg polyline {
  fill: none !important;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.pro-kpi-card.positive svg polyline { stroke: #16885f; }
.pro-kpi-card.warning svg polyline { stroke: #d8891d; }
.pro-kpi-card.danger svg polyline { stroke: #d94b3f; }

.pro-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 0 0 24px;
}

.pro-dashboard-grid .wide {
  grid-column: 1 / -1;
}

.pro-card {
  border: 1px solid var(--line-soft);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: 22px;
  overflow: hidden;
}

.pro-line-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  min-height: 220px;
  align-items: end;
}

.pro-chart-col {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.pro-chart-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
  min-height: 180px;
}

.pro-chart-bars span {
  display: block;
  width: 10px;
  min-height: 6px;
  border-radius: 999px 999px 4px 4px;
}

.pro-chart-bars .paid { background: var(--accent); }
.pro-chart-bars .incoming { background: #18483a; opacity: .9; }

.customer-action-toolbar {
  position: sticky;
  top: 86px;
  z-index: 12;
  align-items: center;
}

.customer-analytics-grid,
.audit-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 0 0 20px;
}

.customer-analytics-grid {
  grid-template-columns: 1.35fr .9fr;
}

.customer-chart-card {
  min-height: 260px;
}

.mini-bar-chart {
  min-height: 180px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 9px;
  align-items: end;
  padding-top: 18px;
}

.mini-bar {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  min-width: 0;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

.mini-bar i {
  display: block;
  width: 100%;
  min-height: 6px;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--primary)));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}

.customer-timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 14%, transparent);
}

.stripe-card-panel {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line-soft));
}

.customer-file-drop {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 18px;
  border: 1px dashed color-mix(in srgb, var(--accent) 42%, var(--line-soft));
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  text-align: center;
  margin-bottom: 14px;
}

.customer-file-drop input { width: 100%; max-width: 280px; }
.customer-file-list { display: grid; gap: 10px; }
.customer-file-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface);
}
.customer-file-row img,
.customer-file-row .document-icon { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; }
.customer-file-row a { font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.auto-pay-enabled {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: color-mix(in srgb, #067647 10%, var(--surface));
  margin-bottom: 12px;
}

.auto-pay-enabled svg {
  width: 42px;
  height: 42px;
  padding: 10px;
  border-radius: 14px;
  background: #067647;
  color: #fff;
}

.auto-pay-enabled strong,
.auto-pay-enabled span {
  display: block;
}

.pwa-install-banner {
  position: fixed;
  inset-inline: 18px;
  bottom: 18px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  margin-inline: auto;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 18px;
  background: linear-gradient(135deg, #0b2f24, #123f31);
  color: #fff7e8;
  box-shadow: 0 24px 70px rgba(7, 22, 16, .32);
}

.pwa-install-banner div { flex: 1; min-width: 0; }
.pwa-install-banner strong,
.pwa-install-banner span { display: block; }
.pwa-install-banner span { color: rgba(255,247,232,.72); font-size: 13px; }

.audit-hero {
  margin-bottom: 18px;
}

.audit-table-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.security-badge {
  background: color-mix(in srgb, #b42318 12%, var(--surface-muted));
}

@media (max-width: 760px) {
  .customer-analytics-grid,
  .audit-kpis {
    grid-template-columns: 1fr;
  }

  .customer-action-toolbar {
    position: sticky;
    top: auto;
    bottom: 76px;
    padding: 10px;
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
  }

  .customer-action-toolbar .btn {
    min-height: 44px;
    flex: 1 1 46%;
  }

  .mini-bar-chart {
    overflow-x: auto;
    grid-template-columns: repeat(12, minmax(36px, 1fr));
  }
}

.payment-method-donut {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  align-items: center;
}

.method-ring {
  width: 150px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(#123c35 0 45%, #c46a1a 45% 70%, #0f7a54 70% 88%, #d1d5db 88% 100%);
  position: relative;
}

.method-ring::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: var(--surface);
}

.method-list {
  display: grid;
  gap: 10px;
}

.method-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.method-list i {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  background: var(--accent);
  margin-inline-end: 8px;
}

.quick-fab {
  position: fixed;
  inset-inline-end: 28px;
  bottom: 28px;
  z-index: 90;
}

.quick-fab-button {
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 22px;
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #f59e0b);
  box-shadow: 0 22px 50px rgba(196,106,26,.34);
  cursor: pointer;
}

.quick-fab-menu {
  position: absolute;
  inset-inline-end: 0;
  bottom: 74px;
  min-width: 220px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
}

.quick-fab-menu[hidden] {
  display: none;
}

.quick-fab-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  color: var(--ink);
  font-weight: 800;
}

.quick-fab-menu a:hover {
  background: var(--surface-muted);
}

.invoice-builder-sticky-total {
  position: sticky;
  top: 94px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
  padding: 14px 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line-soft));
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 14px 32px rgba(15,23,42,.08);
  backdrop-filter: blur(16px);
}

.invoice-builder-sticky-total span,
.invoice-builder-sticky-total small {
  color: var(--muted);
  font-weight: 800;
}

.invoice-builder-sticky-total strong {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.invoice-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.invoice-stepper button {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 900;
  cursor: pointer;
}

.invoice-stepper button span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
}

.invoice-stepper button.active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line-soft));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  box-shadow: 0 12px 30px rgba(196,106,26,.10);
}

.invoice-stepper button.active span {
  background: var(--accent);
  color: #fff;
}

@media (max-width: 860px) {
  .admin-hero-pro {
    grid-template-columns: 1fr;
    padding: 22px;
  }
  .admin-hero-stats {
    grid-template-columns: 1fr;
  }
  .invoice-builder-sticky-total {
    top: auto;
    bottom: 12px;
    margin-inline: 8px;
    z-index: 35;
  }
  .invoice-stepper {
    grid-template-columns: 1fr;
  }
  .quick-fab {
    inset-inline-end: 18px;
    bottom: 18px;
  }
}

.customer-table-desktop {
  display: block;
  margin-bottom: 18px;
}

.customer-table-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.customer-table-identity small,
.premium-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.customer-avatar.sm {
  width: 38px;
  height: 38px;
  font-size: 14px;
}

.table-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

@media (min-width: 861px) {
  .customer-list-shell .customer-card-grid {
    display: none;
  }
}

@media (max-width: 860px) {
  .customer-table-desktop {
    display: none;
  }
}

.portal-pro-body {
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--primary, #0f172a) 16%, transparent), transparent 34rem),
    linear-gradient(180deg, #f7faf8 0%, #eef4ef 100%);
}

[data-theme="dark"] .portal-pro-body {
  background:
    radial-gradient(circle at top left, rgba(245, 158, 11, .16), transparent 34rem),
    linear-gradient(180deg, #07110f 0%, #101513 100%);
  color: #eef8f4;
}

.portal-public-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin: 0 auto 18px;
  max-width: 1240px;
}

.portal-public-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255,255,255,.8);
  box-shadow: 0 10px 28px rgba(15,23,42,.08);
}

.portal-public-brand span {
  margin-inline-end: auto;
  font-weight: 900;
  color: var(--ink);
}

[data-theme="dark"] .portal-public-brand span { color: #f8fafc; }

.portal-pro-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
  align-items: stretch;
  padding: clamp(22px, 4vw, 42px);
  margin-bottom: 22px;
  border-radius: 30px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(245, 158, 11, .96), rgba(180, 83, 9, .76)),
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.26), transparent 18rem),
    linear-gradient(135deg, #0f172a, #064e3b);
  box-shadow: 0 24px 70px rgba(15,23,42,.20);
  overflow: hidden;
  position: relative;
}

.portal-pro-hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -130px auto;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
}

.portal-hero-copy,
.portal-amount-card {
  position: relative;
  z-index: 1;
}

.portal-hero-copy h1 {
  margin: 8px 0;
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: 0;
}

.portal-hero-copy p,
.portal-hero-meta,
.portal-pro-hero .eyebrow {
  color: rgba(255,255,255,.82);
}

.portal-hero-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 18px;
}

.portal-amount-card {
  display: grid;
  gap: 10px;
  align-content: center;
  padding: 24px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 24px;
  background: rgba(15,23,42,.26);
  backdrop-filter: blur(20px);
}

.portal-amount-card span,
.portal-amount-card small {
  color: rgba(255,255,255,.76);
  font-weight: 800;
}

.portal-amount-card strong {
  display: block;
  font-size: clamp(2.1rem, 5vw, 3.8rem);
  line-height: 1;
}

.portal-pay-cta {
  width: 100%;
  min-height: 54px;
  margin-top: 8px;
  box-shadow: 0 16px 34px rgba(120,53,15,.28);
}

.portal-document-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 42%);
  gap: 22px;
  align-items: start;
}

.portal-document-main {
  min-width: 0;
}

.portal-summary-card,
.portal-pdf-pane,
.portal-payment-result,
.recurring-table-card {
  border-radius: 24px;
  border: 1px solid color-mix(in srgb, var(--line-soft) 75%, transparent);
  box-shadow: 0 18px 48px rgba(15,23,42,.08);
}

.portal-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.portal-summary-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 24px 0;
}

.portal-summary-grid div {
  padding: 16px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}

.portal-summary-grid span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: .82rem;
}

.portal-summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
}

[data-theme="dark"] .portal-card,
[data-theme="dark"] .portal-summary-grid div,
[data-theme="dark"] .portal-pdf-pane {
  background: #121816;
  border-color: rgba(255,255,255,.10);
  color: #edf7f4;
}

.portal-pdf-pane {
  position: sticky;
  top: 18px;
  overflow: hidden;
  background: #fff;
}

.portal-pdf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.portal-pdf-frame {
  width: 100%;
  height: min(76vh, 780px);
  border: 0;
  background: #f8fafc;
}

.portal-mobile-paybar {
  position: fixed;
  inset-inline: 14px;
  bottom: 14px;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 22px;
  background: rgba(15,23,42,.92);
  color: #fff;
  box-shadow: 0 20px 50px rgba(15,23,42,.34);
  backdrop-filter: blur(18px);
}

.portal-mobile-paybar span small,
.portal-mobile-paybar span strong {
  display: block;
}

.portal-mobile-paybar small {
  color: rgba(255,255,255,.72);
}

.stripe-loading {
  opacity: .82;
  cursor: wait;
}

.stripe-loading button::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-inline-start: 8px;
  display: inline-block;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.portal-payment-result {
  max-width: 760px;
  margin: 42px auto;
  padding: clamp(28px, 6vw, 56px);
  text-align: center;
  background: #fff;
}

.payment-result-mark {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  font-size: 2.3rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 20px 45px rgba(5,150,105,.25);
}

.portal-payment-result.warning .payment-result-mark {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  box-shadow: 0 20px 45px rgba(217,119,6,.22);
}

.portal-actions.center {
  justify-content: center;
}

.recurring-filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px auto;
  gap: 12px;
  align-items: center;
}

.recurring-table {
  border-collapse: separate;
  border-spacing: 0 10px;
}

.recurring-table tbody tr {
  background: var(--surface, #fff);
  box-shadow: 0 12px 28px rgba(15,23,42,.06);
}

.recurring-table tbody td {
  border-block: 1px solid var(--line-soft);
  padding: 16px;
}

.recurring-table tbody td:first-child {
  border-inline-start: 1px solid var(--line-soft);
  border-radius: 16px 0 0 16px;
}

.recurring-table tbody td:last-child {
  border-inline-end: 1px solid var(--line-soft);
  border-radius: 0 16px 16px 0;
}

[dir="rtl"] .recurring-table tbody td:first-child {
  border-radius: 0 16px 16px 0;
}

[dir="rtl"] .recurring-table tbody td:last-child {
  border-radius: 16px 0 0 16px;
}

.frequency-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: .82rem;
  border: 1px solid transparent;
}

.frequency-weekly { color: #7c2d12; background: #ffedd5; border-color: #fed7aa; }
.frequency-monthly { color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe; }
.frequency-quarterly { color: #047857; background: #d1fae5; border-color: #a7f3d0; }
.frequency-semi_annual { color: #6d28d9; background: #ede9fe; border-color: #ddd6fe; }
.frequency-yearly { color: #92400e; background: #fef3c7; border-color: #fde68a; }

@media (max-width: 920px) {
  .portal-pro-hero,
  .portal-document-layout,
  .portal-summary-grid,
  .portal-summary-grid.compact,
  .recurring-filter-bar {
    grid-template-columns: 1fr;
  }

  .portal-pdf-pane {
    position: static;
  }

  .portal-pdf-frame {
    height: 520px;
  }

  .portal-mobile-paybar {
    display: flex;
  }

  .portal-pro-body .public-shell {
    padding-bottom: 96px;
  }

  .portal-pay-card form .btn {
    width: 100%;
  }
}
.stack-form { display: grid; gap: 14px; }
.text-right { text-align: right; }
.legal-editor-grid { display: grid; gap: 16px; margin-top: 18px; }
.legal-textarea small { display: block; margin-top: 6px; color: var(--muted); }
.legal-preview { background: #f8fafc; border: 1px solid var(--line-soft); border-radius: 8px; padding: 18px; }
.legal-preview pre { margin: 0; white-space: pre-wrap; font-family: inherit; line-height: 1.6; color: var(--ink-2); }
.legal-identity-preview { background: #fbfcfe; border: 1px solid var(--line-soft); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.legal-identity-preview h3 { margin-top: 0; }
.legal-identity-preview small { color: var(--muted); display: block; margin-top: 10px; }
.legal-builder .section-head { align-items: flex-start; }
.variable-chip-panel { margin: 18px 0; padding: 14px; border: 1px solid var(--line-soft); border-radius: 10px; background: #f8fafc; }
.variable-chip-panel strong { display: block; margin-bottom: 10px; }
.variable-chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.variable-chip { white-space: nowrap; border: 1px solid #d0d5dd; background: #fff; border-radius: 999px; padding: 7px 10px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.variable-chip:hover { border-color: var(--primary); color: var(--primary); }
.variable-chip.copied { background: var(--accent); border-color: var(--accent); color: #fff; }
.legal-template-list { display: grid; gap: 18px; }
.legal-template-card { border: 1px solid var(--line-soft); border-radius: 12px; background: #fff; overflow: hidden; box-shadow: var(--shadow-sm); }
.legal-template-card header { padding: 16px 18px; border-bottom: 1px solid var(--line-soft); background: #fbfcfe; }
.legal-template-card h3 { margin: 4px 0 0; }
.legal-template-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr); gap: 18px; padding: 18px; }
.legal-template-editor span, .legal-rendered-preview span { display: block; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.legal-template-editor textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; line-height: 1.55; min-height: 190px; }
.legal-rendered-preview { border-left: 4px solid var(--accent); background: #f6fef9; border-radius: 8px; padding: 14px; }
.legal-rendered-preview pre { margin: 0; white-space: pre-wrap; font-family: inherit; line-height: 1.65; color: var(--ink); }
.legal-preview-loading { opacity: .55; }
.import-hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; padding: 30px; margin-bottom: 18px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 12%, transparent), transparent 34%), linear-gradient(135deg, #fff, #f7fbff); box-shadow: var(--shadow-card); }
.import-hero h1 { margin: 4px 0 8px; font-size: clamp(32px, 5vw, 52px); line-height: 1; }
.import-hero p { color: var(--muted); margin: 0; max-width: 720px; }
.import-hero-steps { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.import-hero-steps span { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid var(--line-soft); border-radius: 999px; background: #fff; font-weight: 800; color: var(--ink-2); }
.import-studio-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.import-card { display: grid; align-content: start; gap: 16px; padding: 18px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-card); }
.import-card header { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; }
.import-card h2 { margin: 0 0 6px; font-size: 18px; }
.import-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.import-dropzone { display: grid; gap: 10px; padding: 14px; border: 1px dashed #cbd5e1; border-radius: var(--radius-md); background: #f8fafc; }
.import-dropzone label span, .mapping-grid label span { display: block; color: var(--muted); font-size: 12px; font-weight: 850; margin-bottom: 6px; }
.import-file-uploader { min-width: 0; }
.import-native-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.import-upload-card { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 10px 12px; align-items: center; min-height: 112px; padding: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fff; cursor: pointer; transition: .18s ease; }
.import-upload-card:hover, .import-file-uploader.is-dragover .import-upload-card { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); transform: translateY(-1px); }
.import-upload-card .ui-icon { width: 28px; height: 28px; color: var(--primary); grid-row: span 2; }
.import-upload-card span { margin: 0; }
.import-upload-card strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 15px; }
.import-file-uploader.has-file .import-upload-card { border-color: #bbf7d0; background: #f0fdf4; }
.xml-viewer { max-height: 68vh; overflow: auto; padding: 18px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #0f172a; color: #dbeafe; font-size: 12px; line-height: 1.6; direction: ltr; text-align: left; white-space: pre-wrap; }
.compliance-checks { display: grid; gap: 10px; }
.compliance-checks div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fff; }
.compliance-checks .ok { border-color: #bbf7d0; background: #f0fdf4; }
.compliance-checks .missing { border-color: #fecaca; background: #fef2f2; }
.compliance-checks span { font-weight: 800; }
.compliance-lifecycle { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.compliance-lifecycle span { padding: 8px 11px; border: 1px solid var(--line-soft); border-radius: 999px; background: #fbfcfe; font-weight: 800; }

.ops-hero { display: flex; justify-content: space-between; gap: 22px; align-items: flex-end; margin-bottom: 22px; padding: 28px; border: 1px solid var(--line-soft); border-radius: 8px; background: linear-gradient(135deg, #0f172a, #1f2937 58%, #0d9488); color: #fff; box-shadow: var(--shadow-soft); }
.ops-hero h2 { margin: 6px 0 8px; font-size: clamp(28px, 4vw, 48px); letter-spacing: 0; }
.ops-hero p { max-width: 760px; margin: 0; color: rgba(255,255,255,.78); }
.ops-hero .eyebrow { color: rgba(255,255,255,.7); }
.ops-grid { display: grid; gap: 16px; }
.ops-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.ops-card { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; box-shadow: 0 12px 36px rgba(15,23,42,.06); transition: transform .18s ease, box-shadow .18s ease; }
.ops-card:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(15,23,42,.1); }
.ops-card::after { content: ""; position: absolute; inset-inline-end: -36px; top: -36px; width: 110px; height: 110px; border-radius: 999px; background: rgba(14,165,233,.08); }
.ops-card.primary::after { background: rgba(20,184,166,.16); }
.ops-card.warning::after, .ops-card.risky::after { background: rgba(245,158,11,.14); }
.ops-card.danger::after, .ops-card.critical::after { background: rgba(239,68,68,.14); }
.ops-card.healthy::after { background: rgba(34,197,94,.14); }
.ops-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.ops-card strong { display: block; margin-top: 10px; color: var(--ink); font-size: clamp(24px, 3vw, 36px); letter-spacing: 0; }
.ops-card small { display: block; margin-top: 8px; color: var(--muted); }
.ops-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr); gap: 18px; margin-bottom: 18px; }
.ops-panel { border-radius: 8px; }
.ops-panel.wide { min-width: 0; }
.ops-chart { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; min-height: 260px; padding: 18px 4px 4px; }
.ops-chart.tall { min-height: 340px; }
.ops-chart-col { display: grid; grid-template-rows: 1fr auto; gap: 10px; min-width: 0; text-align: center; }
.ops-bars { display: flex; align-items: flex-end; justify-content: center; gap: 8px; height: 100%; min-height: 180px; border-bottom: 1px solid var(--line-soft); }
.ops-bars .bar { width: 18px; min-height: 4px; border-radius: 8px 8px 0 0; transition: height .2s ease; }
.ops-bars .paid { background: #14b8a6; }
.ops-bars .incoming { background: #2563eb; }
.chart-legend { display: flex; gap: 18px; color: var(--muted); font-size: 13px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.paid { background: #14b8a6; }
.dot.incoming { background: #2563eb; }
.ops-row, .health-row, .ops-table-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-soft); color: inherit; text-decoration: none; }
.ops-row:last-child, .health-row:last-child, .ops-table-row:last-child { border-bottom: 0; }
.ops-row:hover, .health-row:hover, .ops-table-row:hover { background: #f8fafc; margin-inline: -12px; padding-inline: 12px; border-radius: 8px; }
.ops-row strong, .health-row strong, .ops-table-row strong { display: block; color: var(--ink); }
.ops-row small, .health-row small, .ops-table-row small { display: block; margin-top: 4px; color: var(--muted); }
.ops-row.overdue, .calendar-row.overdue { color: #991b1b; }
.ops-row.soon, .calendar-row.soon { color: #92400e; }
.health-row { grid-template-columns: minmax(0, 1fr) minmax(120px, 180px); }
.risk-meter { display: block; height: 8px; border-radius: 999px; background: #e5e7eb; overflow: hidden; }
.risk-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22c55e, #f59e0b 55%, #ef4444); }
.health-row.critical .risk-meter i { background: #ef4444; }
.health-row.risky .risk-meter i { background: #f97316; }
.health-row.warning .risk-meter i { background: #f59e0b; }
.health-row.healthy .risk-meter i { background: #22c55e; }
.ops-table { display: grid; gap: 0; }
.ops-table-row { grid-template-columns: 1.35fr .8fr .55fr .8fr auto; padding: 16px; border: 1px solid var(--line-soft); border-radius: 8px; margin-bottom: 10px; background: #fff; }
.ops-table-row.critical { border-color: #fecaca; background: #fff7f7; }
.ops-table-row.risky { border-color: #fed7aa; background: #fffaf4; }
.status-badge.risk-critical { color: #991b1b; background: #fee2e2; }
.status-badge.risk-risky { color: #9a3412; background: #ffedd5; }
.status-badge.risk-warning { color: #92400e; background: #fef3c7; }
.reminder-stage-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.reminder-stage { padding: 18px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; box-shadow: 0 10px 24px rgba(15,23,42,.05); }
.reminder-stage strong { display: block; color: var(--ink); }
.reminder-stage small { display: block; margin-top: 6px; color: var(--muted); }
.ops-nav { margin-bottom: 18px; }
.mapping-panel { border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fbfcfe; overflow: hidden; }
.mapping-panel summary { cursor: pointer; padding: 12px 14px; font-weight: 850; border-bottom: 1px solid var(--line-soft); }
.mapping-panel p { padding: 0 14px; margin: 12px 0; }
.mapping-grid { display: grid; gap: 10px; padding: 14px; }
.import-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }
.import-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.import-kpis div { padding: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fbfcfe; }
.import-kpis span { display: block; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.import-kpis strong { display: block; margin-top: 8px; font-size: 24px; }
.import-wizard { display: grid; gap: 18px; margin-bottom: 18px; }
.wizard-step-panel { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 16px; padding: 20px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-card); }
.wizard-step-number { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #0f172a; color: #fff; font-weight: 900; box-shadow: 0 12px 30px rgba(15,23,42,.18); }
.wizard-step-content h2 { margin: 4px 0 14px; }
.import-type-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.import-type-card { position: relative; display: grid; gap: 9px; min-height: 164px; padding: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fbfcfe; cursor: pointer; transition: .18s ease; }
.import-type-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); border-color: color-mix(in srgb, var(--primary) 32%, var(--line-soft)); }
.import-type-card input { position: absolute; opacity: 0; pointer-events: none; }
.import-type-card:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.import-type-card strong { font-size: 17px; }
.import-type-card small { color: var(--muted); line-height: 1.45; }
.import-type-full { background: radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 16%, transparent), transparent 45%), #fbfcfe; }
.import-dropzone-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.import-safety-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.import-safety-strip span { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 999px; background: #fff; color: var(--ink-2); font-weight: 800; font-size: 12px; }
.wizard-mapping { display: none; }
.wizard-mapping.active { display: block; }
.wizard-actions { max-width: 520px; }
.import-readiness-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.readiness-card { display: grid; gap: 7px; align-content: start; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fbfcfe; }
.readiness-card .ui-icon { width: 22px; height: 22px; }
.readiness-card span { color: var(--muted); font-size: 13px; }
.readiness-card.ok { border-color: #bbf7d0; background: #f0fdf4; }
.readiness-card.warning { border-color: #fde68a; background: #fffbeb; }
.readiness-card.danger { border-color: #fecaca; background: #fef2f2; }
.pdf-audit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.pdf-audit-grid div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fff; }
.pdf-audit-grid span { font-size: 22px; font-weight: 900; color: var(--primary); }
.final-import-box { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; padding: 16px; border: 1px solid #bbf7d0; border-radius: var(--radius-md); background: #f0fdf4; }
.final-import-box span { display: block; color: var(--muted); margin-top: 4px; }
.progress-line { width: 160px; max-width: 100%; height: 8px; border-radius: 999px; background: #e5e7eb; overflow: hidden; }
.progress-line span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.insight-stack { display: grid; gap: 10px; margin: 12px 0 18px; }
.insight-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fbfcfe; }
.insight-row span { color: var(--muted); font-weight: 750; }
.insight-row strong { color: var(--ink); font-weight: 900; }
.review-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.review-card { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-card); }
.review-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.review-meta span { display: inline-flex; align-items: center; gap: 5px; padding: 7px 9px; border: 1px solid var(--line-soft); border-radius: 999px; background: #fbfcfe; color: var(--muted); font-size: 12px; font-weight: 800; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.review-workspace { display: grid; gap: 18px; }
.review-workspace-row { display: grid; grid-template-columns: minmax(260px, 42%) minmax(0, 1fr); gap: 18px; padding: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: #fbfcfe; }
.pdf-preview-card { min-height: 420px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fff; overflow: hidden; }
.pdf-preview-card iframe { width: 100%; height: 420px; border: 0; display: block; }
.review-fields { display: grid; gap: 12px; align-content: start; }
.field-confidence-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.field-confidence-grid div { padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: #fff; }
.field-confidence-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; margin-bottom: 5px; }
.field-confidence-grid strong { display: block; margin-bottom: 8px; }

.payment-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.payment-summary-strip > div,
.payment-summary-strip > form {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
}
.payment-summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
.payment-summary-strip strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: 0;
}
.payment-summary-strip form {
  display: grid;
  align-content: center;
}
.payment-timeline {
  position: relative;
  display: grid;
  gap: 14px;
  padding-inline-start: 24px;
}
.payment-timeline::before {
  content: "";
  position: absolute;
  inset-block: 8px;
  inset-inline-start: 8px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(var(--primary), rgba(245, 158, 11, .35));
}
.payment-timeline-item {
  position: relative;
}
.payment-timeline-item::before {
  content: "";
  position: absolute;
  inset-inline-start: -23px;
  top: 24px;
  width: 12px;
  height: 12px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}
.reports-page-head {
  margin-bottom: 16px;
}
.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.report-card {
  padding: 20px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
}
.report-card.wide {
  grid-column: 1 / -1;
}
.report-card h3 {
  margin: 0 0 14px;
  color: var(--ink);
}
.report-bars,
.report-list {
  display: grid;
  gap: 10px;
}
.report-bars > div {
  display: grid;
  grid-template-columns: minmax(86px, 130px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.report-bars > div span {
  color: var(--muted);
  font-weight: 850;
}
.report-bars > div b {
  display: block;
  height: 13px;
  width: var(--bar);
  min-width: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.report-bars.muted > div b {
  background: linear-gradient(90deg, #64748b, #cbd5e1);
}
.report-bars > div strong {
  color: var(--ink);
  font-weight: 950;
  text-align: end;
}
.report-row {
  display: grid;
  grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.report-row span {
  color: var(--muted);
  font-weight: 800;
}
.report-row i {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.report-row strong {
  color: var(--ink);
  font-weight: 950;
}
.email-template-studio .card-header p {
  margin: 6px 0 0;
  color: var(--muted);
}
.email-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.email-template-card {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
}
.email-template-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.email-template-card header span {
  padding: 6px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 9%, #fff);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}
.email-template-card header strong {
  color: var(--ink);
}
.email-preview-frame {
  display: block;
  width: 100%;
  height: 360px;
  border: 0;
  background: #f8fafc;
}
.quote-tracking-badge {
  white-space: nowrap;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; padding: 18px; }
  .sidebar nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; padding-bottom: 4px; }
  .nav-group { display: none; }
  .sidebar nav a.sub-link { display: none; }
  .metric-grid, .two-col, .form-grid, .customer-metrics, .builder-grid, .quote-filters, .advanced-filters, .kpi-grid, .dashboard-grid, .quick-action-grid, .template-studio-grid, .template-picker, .designer-shell, .import-studio-grid, .import-kpis, .import-type-grid, .import-dropzone-wide, .import-readiness-grid, .pdf-audit-grid, .ops-kpis, .ops-layout, .reminder-stage-grid, .review-grid, .review-workspace-row, .field-confidence-grid, .payment-summary-strip, .reports-grid, .email-template-grid { grid-template-columns: 1fr; }
  .import-hero { flex-direction: column; align-items: stretch; }
  .import-hero-steps { justify-content: flex-start; }
  .wizard-step-panel { grid-template-columns: 1fr; }
  .final-import-box { flex-direction: column; align-items: stretch; }
  .public-hero, .public-grid { grid-template-columns: 1fr; }
  .portal-hero, .portal-grid, .portal-doc-row { display: block; }
  .legal-template-grid { grid-template-columns: 1fr; }
  .variable-chip-row { scrollbar-width: thin; }
  .portal-hero .btn, .portal-actions .btn { width: 100%; text-align: center; margin-top: 8px; }
  .portal-doc-row > span { display: block; margin-bottom: 8px; }
  .text-right { text-align: inherit; }
  .public-actions { bottom: 0; top: auto; border-radius: 8px 8px 0 0; }
  .public-actions .btn, .public-actions form { flex: 1 1 auto; }
  .public-mobile-paybar { display: flex; }
  .public-body .public-shell { padding-bottom: 100px; }
  .public-link-box { grid-template-columns: 1fr; }
  .signature-consent-box, .certificate-grid { grid-template-columns: 1fr; }
  .global-search { order: 3; width: 100%; }
  .topbar { gap: 14px; }
  .dashboard-hero, .ops-hero, .document-toolbar { flex-direction: column; align-items: stretch; }
  .ops-table-row, .health-row { grid-template-columns: 1fr; }
  .ops-chart { overflow-x: auto; grid-template-columns: repeat(6, minmax(72px, 1fr)); }
  .quote-summary { position: sticky; bottom: 0; top: auto; z-index: 4; border-radius: 8px 8px 0 0; margin-left: -18px; margin-right: -18px; }
  .builder-hero { flex-direction: column; align-items: stretch; padding: 22px; }
  .builder-hero-actions { justify-content: stretch; }
  .builder-hero-actions .btn { flex: 1 1 auto; }
  .premium-financial-sidebar { bottom: 0; top: auto; margin-left: -18px; margin-right: -18px; border-radius: 18px 18px 0 0; padding: 16px; }
  .financial-total-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; }
  .financial-total-hero strong { margin-top: 0; font-size: 22px; }
  .sidebar-actions { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: span 1; }
  .topbar, .doc-head, .doc-parties, .payment-box, .customer-hero, .pagination-bar { flex-direction: column; align-items: stretch; }
  .table-actions { justify-content: flex-start; }
  .info-list dl { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
  .document-list-panel { padding: 0; }
  .document-table, .document-table thead, .document-table tbody, .document-table tr, .document-table td { display: block; width: 100%; }
  .document-table thead { display: none; }
  .document-row { margin: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; box-shadow: 0 12px 32px rgba(15,23,42,.05); overflow: hidden; }
  .document-table td { border-bottom: 1px solid var(--line-soft); padding: 12px 14px; }
  .document-table td:last-child { border-bottom: 0; }
  .financial-amount, .document-table .text-end { text-align: start; }
  .quote-builder-table, .quote-builder-table thead, .quote-builder-table tbody, .quote-builder-table tr, .quote-builder-table td { display: block; width: 100%; }
  .quote-builder-table thead { display: none; }
  .quote-builder-table tr { margin-bottom: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; overflow: hidden; }
  .quote-builder-table td, .quote-builder-table td:first-child, .quote-builder-table td:last-child { border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; box-shadow: none; }
  .quote-builder-table td:last-child { border-bottom: 0; }
  .quote-builder-table td::before { content: attr(data-label); display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }
  .quote-builder-table input, .quote-builder-table select, .quote-builder-table td:first-child input { min-width: 0; }
  .line-actions-cell { display: flex !important; gap: 8px; justify-content: flex-end; }
  .workspace-panel { width: 100vw; max-width: none; }
  .workspace-financial-grid { grid-template-columns: 1fr; }
  .template-preview-shell { position: static; }
  .template-preview-frame { height: 620px; }
  .designer-controls { position: static; max-height: none; }
  .designer-canvas-head { align-items: stretch; flex-direction: column; }
  .designer-top-controls { justify-items: stretch; }
  .zoom-controls { overflow-x: auto; justify-content: flex-start; border-radius: 12px; }
  .zoom-controls button { white-space: nowrap; }
.document-canvas-stage { min-height: 560px; height: 68vh; padding: 16px; place-items: center; }
}

.legacy-pdf-frame {
  width: 100%;
  min-height: 560px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
}

.bulk-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 8px;
}

.error-page { min-height: min(620px, 70vh); display: grid; place-items: center; padding: 32px 0; }
.error-card { width: min(620px, 100%); padding: 36px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; box-shadow: var(--shadow-card); text-align: center; }
.error-code { display: inline-flex; align-items: center; justify-content: center; min-width: 82px; height: 44px; margin-bottom: 18px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 10%, #fff); color: var(--primary); font-weight: 950; letter-spacing: 0; }
.error-card h2 { margin: 0 0 10px; font-size: 28px; }
.error-card p { margin: 0 auto 22px; max-width: 460px; color: var(--muted); line-height: 1.65; }
.error-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .brand { margin-bottom: 18px; }
  .sidebar nav a { min-height: 44px; }
  .top-actions { width: 100%; justify-content: space-between; }
  .top-actions form { margin-inline-start: auto; }
  .global-search { grid-template-columns: 1fr; }
  .global-search kbd { display: none; }
  .sender-preview, .compact-grid { grid-template-columns: 1fr; }
  .workspace-panel-header, .workspace-section { padding-left: 18px; padding-right: 18px; }
  .workspace-title-meta { align-items: flex-start; flex-direction: column; }
  .workspace-actions .btn, .workspace-actions form, .workspace-actions form button { width: 100%; }
  .public-link-box { grid-template-columns: 1fr; }
  .document-icon { width: 52px; height: 52px; padding: 13px; }
}

/* Limova Phase 1 invoices layer. Kept at EOF because app.css is the file loaded in production. */
:root {
  --limova-forest-950: #071c15;
  --limova-forest-900: #0b2a21;
  --limova-forest-800: #103b2f;
  --limova-forest-700: #164b3c;
  --limova-forest-600: #1f6a54;
  --limova-amber-700: #bd6b13;
  --limova-amber-600: #d57a17;
  --limova-amber-500: #f09a24;
  --limova-paper: #fbf7ef;
  --limova-paper-2: #f5efe4;
  --limova-card: #fffdf8;
  --limova-ink: #12211c;
  --limova-muted: #687970;
  --limova-line: #e7ddcf;
  --limova-radius: 22px;
  --limova-shadow: 0 26px 80px rgba(33, 22, 9, .08);
}

body.app-shell {
  background:
    radial-gradient(900px 600px at 88% -8%, rgba(213, 122, 23, .08), transparent 60%),
    radial-gradient(760px 580px at -4% 98%, rgba(31, 106, 84, .07), transparent 60%),
    var(--limova-paper) !important;
  color: var(--limova-ink) !important;
}

.app-shell .sidebar {
  background: linear-gradient(180deg, var(--limova-forest-950), var(--limova-forest-900)) !important;
  border-inline-start: 1px solid rgba(255, 255, 255, .08);
  box-shadow: -24px 0 80px rgba(7, 28, 21, .18) !important;
}

.app-shell .content,
.app-shell .topbar {
  background: transparent !important;
}

.limova-page-head {
  display: flex !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  gap: 22px !important;
  padding: 0 !important;
  margin-bottom: 22px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.limova-page-head h2 {
  font-family: "Fraunces", "IBM Plex Sans Arabic", Georgia, serif !important;
  font-size: clamp(36px, 4.2vw, 58px) !important;
  line-height: 1 !important;
  color: var(--limova-ink) !important;
  letter-spacing: 0 !important;
}

.limova-page-head p {
  color: var(--limova-muted) !important;
  font-size: 16px !important;
}

.limova-page-head .btn-primary,
.invoice-page-actions .btn-primary {
  background: linear-gradient(180deg, var(--limova-amber-500), var(--limova-amber-700)) !important;
  border-color: rgba(120, 61, 7, .16) !important;
  color: #fff !important;
  box-shadow: 0 18px 36px rgba(189, 107, 19, .22) !important;
}

.limova-kpi-grid {
  display: grid !important;
  grid-template-columns: 1.45fr repeat(3, minmax(0, 1fr)) !important;
  gap: 16px !important;
  margin-bottom: 22px !important;
}

.limova-kpi {
  min-height: 140px !important;
  display: grid !important;
  align-content: space-between !important;
  gap: 12px !important;
  padding: 21px !important;
  border: 1px solid var(--limova-line) !important;
  border-radius: var(--limova-radius) !important;
  background: linear-gradient(180deg, #fffdf9, #fbf6ee) !important;
  box-shadow: var(--limova-shadow) !important;
}

.limova-kpi.hero {
  color: #eef7f2 !important;
  border-color: rgba(255, 255, 255, .1) !important;
  background:
    radial-gradient(440px 220px at 10% -20%, rgba(255, 255, 255, .11), transparent 58%),
    linear-gradient(145deg, var(--limova-forest-800), var(--limova-forest-950)) !important;
}

.limova-kpi.archive {
  background:
    radial-gradient(360px 220px at 100% 0, rgba(240, 154, 36, .13), transparent 64%),
    linear-gradient(180deg, #fffdf9, #fbf4e9) !important;
}

.limova-kpi strong {
  font-family: "Fraunces", "IBM Plex Sans Arabic", Georgia, serif !important;
  font-size: clamp(25px, 2.6vw, 38px) !important;
  line-height: 1 !important;
  color: var(--limova-ink) !important;
}

.limova-kpi.hero strong { color: #fff !important; }
.limova-kpi span,
.limova-kpi small {
  color: var(--limova-muted) !important;
  font-weight: 750 !important;
}
.limova-kpi.hero span,
.limova-kpi.hero small { color: #b6cec3 !important; }

.limova-filter-shell {
  display: grid !important;
  gap: 13px !important;
  padding: 13px !important;
  margin-bottom: 22px !important;
  border: 1px solid var(--limova-line) !important;
  border-radius: 18px !important;
  background: rgba(255, 253, 248, .86) !important;
  box-shadow: var(--limova-shadow) !important;
  backdrop-filter: blur(14px);
}

.limova-filter-shell .form-control,
.limova-filter-shell .form-select {
  border-color: var(--limova-line) !important;
  border-radius: 13px !important;
  background: #fffdf9 !important;
  color: var(--limova-ink) !important;
}

.limova-filter-chips a {
  min-height: 38px !important;
  padding: 8px 14px !important;
  border: 1px solid var(--limova-line) !important;
  border-radius: 13px !important;
  background: var(--limova-paper-2) !important;
  color: var(--limova-muted) !important;
  box-shadow: none !important;
  font-weight: 800 !important;
}

.limova-filter-chips a.active {
  background: #fffdf8 !important;
  color: var(--limova-forest-900) !important;
  border-color: rgba(189, 107, 19, .32) !important;
  box-shadow: 0 12px 26px rgba(33, 22, 9, .07) !important;
}

.limova-bulk-bar {
  border-color: rgba(189, 107, 19, .24) !important;
  background: #fff9ec !important;
  box-shadow: 0 18px 50px rgba(189, 107, 19, .14) !important;
}

.limova-table-card {
  overflow: hidden !important;
  border: 1px solid var(--limova-line) !important;
  border-radius: var(--limova-radius) !important;
  background: var(--limova-card) !important;
  box-shadow: var(--limova-shadow) !important;
}

.limova-invoice-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.limova-invoice-table thead th {
  padding: 18px 16px !important;
  background: #f7f1e8 !important;
  color: #53665e !important;
  border-bottom: 1px solid var(--limova-line) !important;
  font-size: 12px !important;
  letter-spacing: 0 !important;
  font-weight: 900 !important;
}

.limova-invoice-table tbody td {
  padding: 20px 16px !important;
  border-bottom: 1px solid rgba(231, 221, 207, .8) !important;
  vertical-align: middle !important;
}

.limova-invoice-table tbody tr:hover td {
  background: #fff9ef !important;
}

.limova-invoice-table .doc-number,
.limova-invoice-table .customer-name,
.limova-invoice-table .financial-amount {
  color: var(--limova-forest-950) !important;
  font-weight: 950 !important;
}

.limova-customer-cell {
  display: inline-flex !important;
  align-items: center !important;
  gap: 11px !important;
}

.limova-avatar {
  width: 36px !important;
  height: 36px !important;
  border-radius: 12px !important;
  display: inline-grid !important;
  place-items: center !important;
  background: linear-gradient(140deg, var(--limova-forest-600), var(--limova-forest-900)) !important;
  color: #fff !important;
  font-weight: 950 !important;
}

.limova-archive-mark {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  margin-inline-start: 8px !important;
  padding: 4px 8px !important;
  border: 1px solid #c7d7fe !important;
  border-radius: 999px !important;
  background: #eef4ff !important;
  color: #1746a2 !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  white-space: nowrap !important;
}

.limova-archive-mark .ui-icon {
  width: 13px !important;
  height: 13px !important;
}

.status-pill.payment-paid {
  background: #ecfdf3 !important;
  border-color: #abefc6 !important;
  color: #067647 !important;
}

.status-pill.payment-overdue {
  background: #fef3f2 !important;
  border-color: #fecdca !important;
  color: #b42318 !important;
}

.status-pill.payment-unpaid,
.status-pill.payment-partial {
  background: #eef4ff !important;
  border-color: #c7d7fe !important;
  color: #1746a2 !important;
}

.app-shell.dark .limova-table-card,
.app-shell.dark .limova-filter-shell,
.app-shell.dark .limova-kpi:not(.hero) {
  background: #10231c !important;
  border-color: rgba(255, 255, 255, .1) !important;
}

.app-shell.dark .limova-invoice-table thead th,
.app-shell.dark .limova-invoice-table tbody tr:hover td {
  background: rgba(255, 255, 255, .045) !important;
}

.app-shell.dark .limova-page-head h2,
.app-shell.dark .limova-kpi strong,
.app-shell.dark .limova-invoice-table .doc-number,
.app-shell.dark .limova-invoice-table .customer-name,
.app-shell.dark .limova-invoice-table .financial-amount {
  color: #f8fbf9 !important;
}

@media (max-width: 1080px) {
  .limova-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 760px) {
  .limova-page-head,
  .invoice-page-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
  }

  .limova-kpi-grid { grid-template-columns: 1fr !important; }
  .limova-table-card { display: none !important; }
  .invoice-card-grid { display: grid !important; }
}

/* Limova reference alignment for the invoices screen. */
body:has(.limova-invoices-page) {
  font-family: "IBM Plex Sans Arabic", Inter, ui-sans-serif, system-ui, sans-serif !important;
}

body:has(.limova-invoices-page).app-shell {
  grid-template-columns: 260px minmax(0, 1fr) !important;
}

body:has(.limova-invoices-page) .sidebar {
  position: sticky !important;
  top: 0 !important;
  height: 100vh !important;
  padding: 22px 14px 16px !important;
  background:
    radial-gradient(380px 260px at 50% 0%, rgba(201, 138, 43, .1), transparent 72%),
    linear-gradient(178deg, #0c1c16, #0f231c 58%, #0a1812) !important;
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, .18) !important;
}

body:has(.limova-invoices-page).rtl .sidebar {
  box-shadow: inset 1px 0 0 rgba(0, 0, 0, .18) !important;
}

body:has(.limova-invoices-page) .brand {
  padding: 4px 9px 24px !important;
  margin: 0 !important;
}

body:has(.limova-invoices-page) .brand strong {
  font-family: "Fraunces", Georgia, serif !important;
  color: #fff !important;
  font-size: 20px !important;
  letter-spacing: .2px !important;
  line-height: 1.05 !important;
}

body:has(.limova-invoices-page) .brand small {
  color: #7e9789 !important;
  font-size: 9.5px !important;
  letter-spacing: 3.5px !important;
  text-transform: uppercase !important;
}

body:has(.limova-invoices-page) .brand-logo,
body:has(.limova-invoices-page) .brand-mark {
  width: 42px !important;
  height: 42px !important;
  border-radius: 13px !important;
  background: linear-gradient(145deg, #e8bd76, #c98a2b 60%, #b67c22) !important;
  box-shadow: 0 8px 22px rgba(201, 138, 43, .34), inset 0 1px 0 rgba(255,255,255,.35) !important;
}

body:has(.limova-invoices-page) .sidebar-collapse-toggle {
  width: 36px !important;
  height: 36px !important;
  border-radius: 13px !important;
  border-color: rgba(255,255,255,.08) !important;
  background: rgba(255,255,255,.055) !important;
  color: #d9e7df !important;
}

body:has(.limova-invoices-page) .sidebar-search .form-control {
  min-height: 42px !important;
  border-radius: 13px !important;
  border-color: rgba(255,255,255,.08) !important;
  background: rgba(255,255,255,.045) !important;
  color: #e4ece6 !important;
}

body:has(.limova-invoices-page) .sidebar nav {
  gap: 2px !important;
}

body:has(.limova-invoices-page) .nav-group {
  color: #536b5f !important;
  font-size: 9.5px !important;
  letter-spacing: 1.6px !important;
  padding: 18px 14px 9px !important;
}

body:has(.limova-invoices-page) .sidebar nav a {
  min-height: 42px !important;
  padding: 10px 13px !important;
  border-radius: 12px !important;
  color: #a4b4aa !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

body:has(.limova-invoices-page) .sidebar nav a:hover {
  background: rgba(255,255,255,.045) !important;
  color: #e4ece6 !important;
  transform: none !important;
}

body:has(.limova-invoices-page) .sidebar nav a.active {
  color: #fff !important;
  background: linear-gradient(100deg, #1d4d3d, #184536 70%, rgba(63,152,118,.18)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 16px rgba(8,28,20,.48) !important;
}

body:has(.limova-invoices-page) .nav-icon {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  border-radius: 11px !important;
  border-color: rgba(255,255,255,.1) !important;
  background: rgba(255,255,255,.05) !important;
  color: #a4b4aa !important;
}

body:has(.limova-invoices-page) .nav-badge {
  background: linear-gradient(140deg, #dba148, #b67c22) !important;
  color: #2a1c05 !important;
}

body:has(.limova-invoices-page) .topbar {
  min-height: 72px !important;
  padding: 15px 30px !important;
  background: color-mix(in srgb, var(--limova-paper) 78%, transparent) !important;
  border-bottom: 1px solid var(--limova-line) !important;
  backdrop-filter: blur(18px) saturate(1.4) !important;
}

body:has(.limova-invoices-page) .topbar-brand {
  display: none !important;
}

body:has(.limova-invoices-page) .global-search {
  width: min(480px, 42vw) !important;
  margin-inline: auto 18px !important;
}

body:has(.limova-invoices-page) .top-actions {
  margin-inline-start: 0 !important;
  order: -1 !important;
}

body:has(.limova-invoices-page) .top-actions .btn,
body:has(.limova-invoices-page) .theme-toggle,
body:has(.limova-invoices-page) .notification-bell {
  min-width: 44px !important;
  min-height: 44px !important;
  border-radius: 13px !important;
  border: 1px solid var(--limova-line) !important;
  background: var(--limova-card) !important;
  color: var(--limova-ink) !important;
  box-shadow: var(--limova-shadow) !important;
}

body:has(.limova-invoices-page) .content {
  max-width: none !important;
  padding: 26px 30px 56px !important;
}

.limova-invoices-page {
  max-width: 1520px;
  margin: 0 auto;
}

.limova-eyebrow {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin-bottom: 9px !important;
  color: var(--limova-amber-700) !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  letter-spacing: 1.8px !important;
  text-transform: uppercase !important;
}

.limova-eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--limova-amber-500), transparent);
}

.limova-count-pill {
  align-self: flex-start;
  margin-top: 46px;
  padding: 7px 13px;
  border: 1px solid var(--limova-line);
  border-radius: 10px;
  background: var(--limova-card);
  color: var(--limova-muted);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 800;
  box-shadow: var(--limova-shadow);
}

.limova-action-row {
  margin: 0 0 24px !important;
}

.limova-action-row .invoice-page-actions {
  justify-content: flex-start !important;
}

body.rtl .limova-action-row .invoice-page-actions {
  justify-content: flex-end !important;
}

.limova-action-row .btn {
  min-height: 54px !important;
  padding-inline: 24px !important;
  border-radius: 15px !important;
  font-weight: 800 !important;
}

.limova-kpi-grid {
  grid-template-columns: 1.55fr 1fr 1fr 1fr !important;
  gap: 15px !important;
  margin-bottom: 28px !important;
}

body.rtl .limova-kpi-grid .hero {
  grid-column: auto !important;
}

.limova-kpi {
  min-height: 204px !important;
  padding: 25px !important;
  border-radius: 20px !important;
}

.limova-kpi.hero {
  background:
    radial-gradient(420px 220px at 88% 8%, rgba(219, 161, 72, .2), transparent 60%),
    linear-gradient(155deg, #184536, #0f231c 70%, #0a1812) !important;
}

.limova-kpi.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.045) 1px, transparent 0);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(135deg, #000, transparent 70%);
}

.limova-kpi strong {
  font-size: clamp(32px, 4vw, 54px) !important;
  letter-spacing: -.7px !important;
}

.limova-kpi-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--limova-line);
  border-radius: 14px;
  color: var(--limova-muted);
  background: var(--limova-paper-2);
}

.limova-kpi-icon .ui-icon {
  width: 21px;
  height: 21px;
}

.limova-filter-shell {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 16px !important;
  border-radius: 18px !important;
}

.limova-filter-shell .invoice-search-panel {
  display: contents !important;
}

.limova-filter-shell .invoice-search-main {
  min-height: 54px !important;
  border-radius: 15px !important;
  background: #fffdf8 !important;
  border: 1px solid var(--limova-line) !important;
  box-shadow: var(--limova-shadow) !important;
}

.limova-filter-shell .invoice-search-main input {
  font-size: 16px !important;
}

.limova-filter-shell .invoice-filter-fields {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(110px, 1fr)) auto !important;
  gap: 10px !important;
  order: 3 !important;
  grid-column: 1 / -1 !important;
}

.limova-filter-chips {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
}

.limova-filter-chips a {
  min-height: 46px !important;
  padding-inline: 16px !important;
}

.limova-table-card {
  border-radius: 18px !important;
}

.limova-invoice-table thead th {
  height: 58px !important;
  background: #f7f3ea !important;
}

.limova-invoice-table tbody td {
  height: 82px !important;
}

.limova-invoice-table .doc-number {
  font-family: "IBM Plex Mono", monospace !important;
  color: #0f3d30 !important;
}

.limova-invoice-table .table-actions .btn {
  border-radius: 11px !important;
  background: #fffdf8 !important;
}

@media (max-width: 1180px) {
  .limova-filter-shell {
    grid-template-columns: 1fr !important;
  }

  .limova-filter-shell .invoice-search-panel {
    display: grid !important;
  }

  .limova-filter-shell .invoice-search-main,
  .limova-filter-shell .invoice-filter-fields,
  .limova-filter-chips {
    grid-column: auto !important;
  }
}

/* Phase D-14 mobile and push polish */
@media (pointer: coarse) {
  button,
  .btn,
  input[type="button"],
  input[type="submit"],
  .nav a,
  .mobile-bottom-nav a {
    min-height: 44px;
    min-width: 44px;
  }
}

.push-permission-banner {
  gap: 10px;
}

.push-permission-banner strong,
.pwa-install-banner strong {
  display: block;
}

.push-permission-banner span,
.pwa-install-banner span {
  display: block;
  color: var(--muted, #66736d);
  font-size: 13px;
  margin-top: 2px;
}

@media (max-width: 980px) {
  body:has(.limova-invoices-page).app-shell {
    grid-template-columns: 1fr !important;
  }

  body:has(.limova-invoices-page) .sidebar {
    position: static !important;
    height: auto !important;
  }

  body:has(.limova-invoices-page) .topbar {
    flex-wrap: wrap !important;
  }

  body:has(.limova-invoices-page) .global-search {
    width: 100% !important;
    margin: 0 !important;
    order: 3 !important;
  }

  .limova-kpi-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 720px) {
  .limova-kpi-grid,
  .limova-filter-shell .invoice-filter-fields {
    grid-template-columns: 1fr !important;
  }

  .limova-kpi {
    min-height: 156px !important;
  }

  .limova-page-head {
    display: grid !important;
  }

  .limova-count-pill {
    margin-top: 0;
  }
}

/* Limova exact pass: match the supplied reference more closely on /invoices. */
body:has(.limova-invoices-page) .content {
  padding: 26px 30px 56px !important;
}

.limova-invoices-page {
  isolation: isolate;
}

.limova-invoices-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .45;
  background-image: radial-gradient(circle at 1px 1px, rgba(45,102,80,.055) 1px, transparent 0);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 72%);
}

.limova-page-head {
  display: flex !important;
  flex-direction: row-reverse !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  gap: 22px !important;
  margin: 0 0 24px !important;
}

html[dir="rtl"] .limova-page-head {
  flex-direction: row !important;
}

.limova-page-head > div:first-child {
  text-align: end !important;
  min-width: min(620px, 100%) !important;
}

.limova-page-head h2 {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 14px !important;
  margin: 0 !important;
  font-size: 34px !important;
  font-weight: 800 !important;
  letter-spacing: -.6px !important;
}

.limova-page-head p {
  margin: 8px 0 0 !important;
  font-size: 13.5px !important;
}

.limova-count-pill {
  margin: 0 !important;
  font-size: 14px !important;
  color: var(--limova-muted) !important;
  background: var(--limova-card) !important;
}

.limova-page-head .invoice-page-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
}

.limova-page-head .invoice-page-actions .btn {
  min-height: 54px !important;
  padding: 11px 20px !important;
  border-radius: 14px !important;
  font-size: 13px !important;
}

.limova-page-head .invoice-page-actions .btn-light {
  background: var(--limova-card) !important;
  color: var(--limova-ink) !important;
  border-color: var(--limova-line) !important;
  box-shadow: var(--limova-shadow) !important;
}

.limova-kpi-grid {
  direction: rtl !important;
  grid-template-columns: 1.55fr 1fr 1fr 1fr !important;
  margin-bottom: 30px !important;
}

.limova-kpi-grid > * {
  direction: rtl !important;
}

.limova-kpi {
  min-height: 204px !important;
  padding: 24px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  position: relative !important;
  overflow: hidden !important;
}

.limova-kpi .limova-kpi-icon {
  order: -2 !important;
  margin-bottom: 10px !important;
}

.limova-kpi span {
  font-size: 13px !important;
  color: #53665e !important;
}

.limova-kpi strong {
  margin-top: 8px !important;
  font-size: 34px !important;
  line-height: 1.04 !important;
}

.limova-kpi.hero strong {
  font-size: clamp(36px, 4.6vw, 56px) !important;
}

.limova-kpi.hero {
  min-height: 204px !important;
  box-shadow: 0 20px 56px rgba(12,28,22,.16), 0 4px 14px rgba(12,28,22,.08) !important;
}

.limova-kpi.hero .limova-kpi-icon {
  background: rgba(255,255,255,.07) !important;
  color: #e8bd76 !important;
  border-color: rgba(255,255,255,.08) !important;
}

.limova-kpi.hero span {
  color: #a4c0b3 !important;
}

.limova-kpi.hero small {
  color: #86a496 !important;
}

.limova-filter-shell {
  grid-template-columns: auto minmax(0, 1fr) !important;
  padding: 16px !important;
  margin-bottom: 22px !important;
}

.limova-filter-tools {
  display: flex !important;
  gap: 10px !important;
  grid-column: 1 !important;
  grid-row: 1 !important;
}

.limova-filter-tools .btn {
  min-height: 46px !important;
  padding-inline: 16px !important;
  border-radius: 12px !important;
  background: #efebe0 !important;
  border-color: #e1dac9 !important;
  color: #4e5a53 !important;
  box-shadow: none !important;
}

.limova-filter-shell .invoice-search-panel {
  display: contents !important;
}

.limova-filter-shell .invoice-search-main {
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
  max-width: 520px !important;
  justify-self: end !important;
  width: 100% !important;
  order: initial !important;
}

.limova-filter-shell .invoice-filter-fields {
  display: none !important;
}

.limova-filter-chips {
  grid-column: 2 !important;
  grid-row: 1 !important;
  align-items: center !important;
  justify-content: flex-end !important;
  padding: 0 !important;
}

.limova-filter-chips a {
  min-height: 36px !important;
  padding: 7px 13px !important;
  border-radius: 11px !important;
  gap: 8px !important;
}

.limova-filter-chips a strong {
  min-width: 24px !important;
  height: 24px !important;
  display: inline-grid !important;
  place-items: center !important;
  border-radius: 8px !important;
  background: #fffdf8 !important;
  color: #6d786f !important;
  font-family: "IBM Plex Mono", monospace !important;
  font-size: 11px !important;
}

.limova-filter-chips a.active {
  background: #fffdf8 !important;
  color: #0f3d30 !important;
  border-color: #e1dac9 !important;
}

.limova-filter-chips a.active strong {
  background: #1d4d3d !important;
  color: #fff !important;
}

.limova-table-card {
  border-radius: 18px !important;
  box-shadow: 0 2px 6px rgba(16,28,22,.05), 0 8px 24px rgba(16,28,22,.07) !important;
}

.limova-invoice-table thead th {
  padding: 16px 16px !important;
  background: #faf7ee !important;
  color: #828c84 !important;
  font-size: 12px !important;
  text-transform: none !important;
}

.limova-invoice-table tbody td {
  height: 84px !important;
  padding: 18px 16px !important;
}

.limova-invoice-table tbody tr:nth-child(even) td {
  background: rgba(250, 247, 238, .42) !important;
}

.limova-invoice-table tbody tr:hover td {
  background: #fbf4e7 !important;
}

.limova-invoice-table .doc-number {
  font-size: 14px !important;
  color: #111b17 !important;
}

.limova-invoice-table .customer-name {
  color: #111b17 !important;
}

.limova-avatar {
  width: 42px !important;
  height: 42px !important;
  border-radius: 12px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 5px 12px rgba(20,57,46,.16) !important;
}

.limova-archive-mark {
  background: #e7eef3 !important;
  border-color: #d3e0e9 !important;
  color: #3a6483 !important;
}

@media (max-width: 1180px) {
  .limova-filter-shell {
    grid-template-columns: 1fr !important;
  }

  .limova-filter-tools,
  .limova-filter-chips,
  .limova-filter-shell .invoice-search-main {
    grid-column: 1 !important;
    grid-row: auto !important;
    justify-self: stretch !important;
    max-width: none !important;
  }
}

@media (max-width: 980px) {
  .limova-page-head {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .limova-page-head > div:first-child {
    text-align: start !important;
  }

  .limova-page-head h2 {
    justify-content: flex-start !important;
  }

  .limova-page-head .invoice-page-actions {
    justify-content: stretch !important;
  }

  .limova-page-head .invoice-page-actions .btn {
    flex: 1 1 auto !important;
  }
}
