:root {
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  color-scheme: dark;
  --bg: #0d1014;
  --surface: #15191e;
  --surface-2: #1b2026;
  --surface-3: #242a31;
  --text: #f4f6f8;
  --text-2: #c0c6ce;
  --muted: #89919b;
  --border: #2b323a;
  --border-strong: #3a424c;
  --sidebar: #07090b;
  --sidebar-2: #11151a;
  --shadow: 0 1px 2px rgba(0,0,0,.22), 0 18px 44px rgba(0,0,0,.18);
}

* { box-sizing: border-box; }
html, body, #root { min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
input, select, textarea { outline: none; }
svg { width: 18px; height: 18px; stroke-width: 1.9; }

.app-shell { min-height: 100vh; background: var(--bg); }
.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; background: #070a0e; }
.auth-gate::before, .auth-gate::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; filter: blur(120px); opacity: .16; pointer-events: none; }
.auth-gate::before { top: -220px; left: -120px; background: #e95420; }
.auth-gate::after { right: -160px; bottom: -240px; background: #00c6b2; }
.auth-card { width: min(430px, 100%); position: relative; z-index: 1; padding: 30px; border: 1px solid #29313a; border-radius: 20px; background: rgba(15,20,26,.96); box-shadow: 0 35px 100px rgba(0,0,0,.5); }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; border-radius: 20px 20px 0 0; background: linear-gradient(90deg, #e95420, #1f5da8 48%, #00c6b2); }
.auth-brand { display: flex; align-items: center; gap: 13px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.auth-brand img { width: 54px; height: 54px; object-fit: contain; }
.auth-brand span, .auth-brand b { display: block; }
.auth-brand span { color: #8d97a2; font-size: 8px; font-weight: 800; letter-spacing: 1.5px; }
.auth-brand b { margin-top: 4px; font-size: 12px; }
.auth-copy { padding: 26px 0 20px; }
.auth-copy > span { color: #00c6b2; font-size: 8px; font-weight: 800; letter-spacing: 1.5px; }
.auth-copy h1 { margin: 7px 0 6px; font-size: 27px; line-height: 1.15; letter-spacing: -1px; }
.auth-copy p { margin: 0; color: var(--text-2); font-size: 10px; }
.auth-form { display: grid; gap: 13px; }
.auth-form .field input { height: 44px; background: #10151b; }
.auth-form .field input:focus { border-color: #00c6b2; box-shadow: 0 0 0 3px rgba(0,198,178,.12); }
.auth-submit { width: 100%; height: 44px; margin-top: 4px; border-color: #00a995; background: linear-gradient(135deg, #e95420, #1f5da8 48%, #00bda9); }
.auth-error { margin-top: 0; color: #ffad9e; border-color: #5b3029; background: #2d1a18; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 20px; color: #7f8994; font-size: 8px; }
.secure-dot { width: 6px; height: 6px; border-radius: 50%; background: #00c6b2; box-shadow: 0 0 10px rgba(0,198,178,.75); }
.auth-loading { min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; }
.auth-loading img { width: 70px; height: 70px; object-fit: contain; }
.auth-loading p { margin: 0; color: var(--text-2); font-size: 10px; }
.auth-spinner { width: 24px; height: 24px; border: 2px solid #2b323a; border-top-color: #00c6b2; border-radius: 50%; animation: auth-spin .75s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 50; width: 218px;
  display: flex; flex-direction: column; padding: 14px 11px 12px;
  background: var(--sidebar); color: #fff; border-right: 1px solid #1d2228;
}
.sidebar-company {
  min-height: 67px; border: 1px solid #252c34; border-radius: 12px; background: #0d1116;
  color: #fff; display: grid; grid-template-columns: 46px 1fr 16px; align-items: center;
  gap: 10px; padding: 8px; text-align: left; margin-bottom: 16px;
}
.sidebar-company:hover { border-color: rgba(var(--brand-rgb), .65); }
.sidebar-company > svg { width: 14px; color: #89929e; }
.sidebar-company b, .sidebar-company span { display: block; }
.sidebar-company b { font-size: 12px; }
.sidebar-company span { color: #8e97a2; font-size: 9px; margin-top: 1px; }
.logo-wrap { display: grid; place-items: center; overflow: hidden; }
.logo-wrap img { display: block; width: 100%; height: 100%; object-fit: contain; }
.logo-wrap.safecyber { width: 46px; height: 46px; background: transparent; border-radius: 0; padding: 0; }
.logo-wrap.ethertronix { width: 46px; height: 46px; background: #071015; border-radius: 9px; padding: 5px; }
.sidebar-company.ethertronix { grid-template-columns: 126px 1fr 14px; }
.sidebar-company.ethertronix > .logo-wrap { width: 126px; height: 40px; padding: 2px; }
.sidebar-company.ethertronix > div { display: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav button, .sidebar-bottom > button {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid transparent; border-radius: 9px;
  display: flex; align-items: center; gap: 11px; background: transparent; color: #b7bdc5;
  font-size: 11px; font-weight: 600; text-align: left;
}
.sidebar nav button:hover, .sidebar-bottom > button:hover { color: #fff; background: #11161c; }
.sidebar nav button.active { color: #fff; background: rgba(var(--brand-rgb), .19); border-color: rgba(var(--brand-rgb), .58); }
.sidebar nav button.active svg { color: var(--brand); }
.sidebar-bottom { margin-top: auto; }
.sync-chip { margin: 8px 4px 0; padding: 9px 8px; border-top: 1px solid #252a30; color: #828b96; display: flex; gap: 8px; align-items: center; font-size: 9px; }
.sync-chip svg { width: 14px; }
.sync-chip.saved { color: #67d8a0; }
.sync-chip.schema-missing { color: #f4a66e; }

.main-shell { margin-left: 218px; min-height: 100vh; }
.topbar {
  height: 64px; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; background: rgba(21, 25, 30, .92); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.breadcrumbs { display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--muted); }
.breadcrumbs b { color: var(--border-strong); }
.breadcrumbs strong { color: var(--text); font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-2); }
.icon-button:hover { border-color: var(--brand); color: var(--brand); }
.menu-button { display: none; }
.company-pill { height: 37px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); padding: 0 10px 0 5px; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 10px; }
.company-pill > span { width: 27px; height: 27px; border-radius: 7px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 9px; }
.company-pill svg { width: 13px; color: var(--muted); }
.content { max-width: 1360px; margin: 0 auto; padding: 34px 34px 60px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 25px; }
.eyebrow, .quick-create > div:first-child > span, .panel-head span, .section-label { display: block; color: var(--brand); font-size: 9px; line-height: 1; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 9px; }
.page-head h1 { margin: 0; font-size: clamp(25px, 3vw, 36px); line-height: 1.12; letter-spacing: -1.3px; }
.page-head p { margin: 7px 0 0; color: var(--text-2); font-size: 11px; }
.button { height: 39px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.button svg { width: 15px; }
.button.primary { color: #fff; border-color: var(--brand); background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 8px 20px rgba(var(--brand-rgb), .22); }
.button.primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.button.ghost:hover { color: var(--brand); border-color: var(--brand); }
.button.dashed { border-style: dashed; width: 100%; background: var(--surface-2); }

.quick-create { background: #090d11; color: #fff; border-radius: 16px; padding: 19px; display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: center; margin-bottom: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.quick-create::after { content: ""; position: absolute; inset: -50% auto auto 5%; width: 260px; height: 180px; background: var(--brand); opacity: .13; filter: blur(70px); pointer-events: none; }
.quick-create h2 { font-size: 16px; margin: 0; }
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; position: relative; z-index: 1; }
.quick-actions > button { border: 1px solid #27303a; border-radius: 11px; min-height: 68px; background: #11171d; color: #fff; padding: 10px; display: grid; grid-template-columns: 34px 1fr 14px; align-items: center; gap: 9px; text-align: left; }
.quick-actions > button:hover { border-color: var(--brand); background: rgba(var(--brand-rgb), .12); }
.quick-actions > button > span { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: rgba(var(--brand-rgb), .18); color: var(--brand); }
.quick-actions > button > span svg { width: 16px; }
.quick-actions > button > svg { width: 13px; color: #636e79; }
.quick-actions b, .quick-actions small { display: block; }
.quick-actions b { font-size: 10px; }
.quick-actions small { color: #818b96; font-size: 8px; margin-top: 2px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric-card { border: 1px solid var(--border); background: var(--surface); border-radius: 14px; min-height: 148px; padding: 17px; text-align: left; color: var(--text); box-shadow: var(--shadow); position: relative; }
.metric-card:hover { border-color: rgba(var(--brand-rgb), .58); transform: translateY(-2px); }
.metric-icon { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--brand); background: rgba(var(--brand-rgb), .10); }
.metric-icon svg { width: 17px; }
.metric-card > span { display: block; color: var(--text-2); font-size: 10px; font-weight: 600; }
.metric-card > strong { display: block; font-size: 28px; line-height: 1; letter-spacing: -1px; margin: 25px 0 9px; }
.metric-card > strong.money-metric { font-size: 20px; }
.metric-card > small { color: var(--muted); font-size: 9px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; font-size: 15px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 13px; }
.search-box { width: min(390px, 100%); height: 40px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; display: flex; align-items: center; gap: 9px; }
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .13); }
.search-box svg { width: 15px; color: var(--muted); }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 10px; }
.toolbar-count { color: var(--muted); font-size: 9px; }
.status-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.status-tabs button { border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; background: var(--surface); color: var(--text-2); font-size: 9px; }
.status-tabs button.active { color: var(--brand); border-color: var(--brand); background: rgba(var(--brand-rgb), .08); font-weight: 700; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 8px; letter-spacing: .6px; text-transform: uppercase; text-align: left; }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); font-size: 10px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(var(--brand-rgb), .03); }
.num { text-align: right; }
.cell-title b, .cell-title small { display: block; }
.cell-title { color: var(--text); font-weight: 700; }
.cell-title small { color: var(--muted); font-weight: 400; margin-top: 3px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code { font-family: "Plus Jakarta Sans", sans-serif; font-size: 9px; background: var(--surface-3); padding: 4px 6px; border-radius: 5px; }
.stock { padding: 4px 7px; border-radius: 20px; color: #16845a; background: #e9f8f2; }
:root[data-theme="dark"] .stock { background: #15362c; color: #83e1bd; }
.stock.low { color: #c85029; background: #fff0e9; }
:root[data-theme="dark"] .stock.low { background: #40251c; color: #ffb191; }
.row-actions { display: flex; justify-content: flex-end; gap: 3px; }
.row-actions button { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); }
.row-actions button:hover { border-color: var(--border); background: var(--surface-2); color: var(--text); }
.row-actions button.danger:hover { color: #dd553f; border-color: #dd553f; }
.row-actions svg { width: 14px; }

.empty-state { padding: 56px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 13px; background: rgba(var(--brand-rgb), .09); color: var(--brand); margin-bottom: 15px; }
.empty-icon svg { width: 22px; }
.empty-state h3 { margin: 0; font-size: 14px; }
.empty-state p { max-width: 370px; margin: 6px 0 16px; color: var(--text-2); font-size: 10px; }

.customer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.customer-card { min-height: 140px; position: relative; display: flex; gap: 12px; padding: 17px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.customer-avatar { width: 39px; height: 39px; flex: 0 0 auto; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-radius: 10px; font-size: 10px; font-weight: 800; }
.customer-copy { min-width: 0; padding-right: 48px; }
.customer-copy h3 { margin: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.customer-copy p { margin: 2px 0 8px; font-size: 9px; color: var(--text-2); }
.customer-copy span { display: block; color: var(--muted); font-size: 8px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }
.customer-card > .row-actions { position: absolute; top: 11px; right: 9px; }

.document-list { width: 100%; }
.document-row { display: grid; grid-template-columns: 38px minmax(170px, 1.2fr) minmax(100px, .7fr) 80px minmax(120px, .6fr) 100px; gap: 12px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.document-row:last-child { border-bottom: 0; }
.document-row:hover { background: rgba(var(--brand-rgb), .03); }
.doc-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 9px; color: var(--brand); background: rgba(var(--brand-rgb), .09); }
.doc-icon svg { width: 16px; }
.doc-primary b, .doc-primary span, .doc-date span, .doc-date b { display: block; }
.doc-primary b { font-size: 10px; }
.doc-primary span, .doc-date span { color: var(--muted); font-size: 8px; margin-top: 2px; }
.doc-date b { font-size: 9px; margin-top: 2px; }
.status { justify-self: start; padding: 4px 8px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); font-size: 8px; font-weight: 700; }
.status-paid, .status-accepted { color: #147c54; background: #e7f8f0; }
.status-sent { color: #235da7; background: #eaf2ff; }
.status-overdue, .status-declined, .status-cancelled { color: #b94835; background: #ffede9; }
:root[data-theme="dark"] .status-paid, :root[data-theme="dark"] .status-accepted { color: #8adbb9; background: #14372b; }
:root[data-theme="dark"] .status-sent { color: #9bc2ff; background: #172c49; }
:root[data-theme="dark"] .status-overdue, :root[data-theme="dark"] .status-declined, :root[data-theme="dark"] .status-cancelled { color: #ffad9e; background: #40231f; }
.doc-total { text-align: right; font-size: 10px; }
.recent-panel .document-row { grid-template-columns: 38px minmax(180px, 1fr) 100px 80px 130px 36px; }
.row-actions button.convert-action { color: var(--brand); }
.row-actions button.convert-action:hover { color: var(--brand); border-color: var(--brand); background: rgba(var(--brand-rgb), .10); }

.modal-backdrop, .chooser-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; background: rgba(3,6,9,.72); backdrop-filter: blur(7px); }
.modal { width: min(610px, 100%); max-height: calc(100vh - 44px); overflow: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.modal-wide { width: min(740px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 2; padding: 19px 21px; display: flex; justify-content: space-between; align-items: flex-start; background: var(--surface); border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-head p { margin: 4px 0 0; color: var(--text-2); font-size: 9px; }
.modal form, .account-card { padding: 21px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-2 { grid-column: 1 / -1; }
.field > .field-label { color: var(--text-2); font-size: 9px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); padding: 10px 11px; font-size: 10px; resize: vertical; }
.field input, .field select { height: 39px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); background: var(--surface); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-stack { display: grid; gap: 12px; }
.form-message { margin-top: 12px; padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); font-size: 9px; }
.account-card { display: flex; align-items: center; gap: 12px; }
.account-card > svg { color: var(--brand); }
.account-card > div { flex: 1; }
.account-card b, .account-card span { display: block; }
.account-card span { font-size: 9px; color: var(--text-2); margin-top: 3px; }

.confirm-modal { width: min(440px, 100%); position: relative; overflow: hidden; }
.confirm-modal::before { content: ""; position: absolute; inset: 0 0 auto; z-index: 4; height: 3px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.confirm-modal .modal-head { position: relative; padding: 22px 22px 10px; border-bottom: 0; }
.confirm-modal .modal-head h2 { font-size: 18px; letter-spacing: -.35px; }
.confirm-body { padding: 4px 22px 22px; }
.confirm-message { display: grid; grid-template-columns: 42px 1fr; gap: 13px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.confirm-symbol { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; color: var(--brand); background: rgba(var(--brand-rgb), .12); }
.confirm-symbol svg { width: 18px; }
.confirm-message p { margin: 0; color: var(--text-2); font-size: 10px; line-height: 1.65; }
.confirm-modal .modal-actions { margin-top: 16px; padding-top: 15px; }
.button.danger-fill { color: #fff; border-color: #d74b3a; background: linear-gradient(135deg, #e35b43, #b93630); box-shadow: 0 8px 20px rgba(210,65,48,.2); }
.button.danger-fill:hover { filter: brightness(1.06); transform: translateY(-1px); }

.chooser { width: min(850px, 100%); padding: 48px; border: 1px solid #28313a; border-radius: 22px; background: #0c1116; color: #fff; box-shadow: 0 40px 100px rgba(0,0,0,.5); text-align: center; position: relative; overflow: hidden; }
.chooser::before { content: ""; position: absolute; inset: -140px 20% auto; height: 240px; background: #00c6b2; filter: blur(100px); opacity: .12; }
.chooser-close { position: absolute; top: 17px; right: 17px; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #29313a; border-radius: 9px; background: #121820; color: #aab2bd; }
.chooser-kicker { color: #89949e; font-size: 9px; font-weight: 800; letter-spacing: 2px; }
.chooser h1 { margin: 8px 0 7px; font-size: 30px; letter-spacing: -1.2px; }
.chooser > p { margin: 0 auto 30px; color: #89949e; font-size: 10px; }
.company-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; }
.company-choice { min-height: 190px; padding: 19px; border: 1px solid #26313b; border-radius: 16px; background: #111820; color: #fff; display: grid; grid-template-columns: 1fr auto; grid-template-rows: 1fr auto; gap: 15px; }
.company-choice:hover, .company-choice.selected { border-color: var(--choice); transform: translateY(-3px); box-shadow: 0 20px 40px rgba(var(--choice-rgb), .10); }
.choice-logo { grid-column: 1 / -1; height: 86px; border-radius: 12px; display: grid; place-items: center; background: #070b0f; overflow: hidden; }
.choice-logo .logo-wrap.safecyber.wordmark { width: min(300px, 92%); height: 72px; display: flex; align-items: center; justify-content: center; gap: 15px; overflow: visible; }
.choice-logo .logo-wrap.safecyber.wordmark img { width: 72px; height: 68px; }
.choice-logo .logo-wrap.ethertronix { width: min(340px, 92%); height: 72px; padding: 0; }
.safecyber-wordmark { display: flex; align-items: baseline; white-space: nowrap; font-size: 22px; font-style: normal; font-weight: 800; letter-spacing: 1.7px; }
.safecyber-wordmark b { color: #e95420; }
.safecyber-wordmark em { color: #2f70b4; font-style: normal; }
.company-choice .safecyber-wordmark { color: #fff; font-size: 22px; }
.company-choice h2 { margin: 0; font-size: 15px; }
.company-choice span { color: #86919b; font-size: 8px; }
.choice-arrow { align-self: end; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, var(--choice), var(--choice2)); font-size: 16px; }

.document-main { padding: 0; }
.editor-shell { min-height: calc(100vh - 64px); }
.editor-toolbar { min-height: 66px; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); background: var(--surface); }
.editor-toolbar > div { display: flex; align-items: center; gap: 10px; }
.button.convert-button { color: var(--brand); border-color: rgba(var(--brand-rgb), .62); background: rgba(var(--brand-rgb), .09); }
.button.convert-button:hover { border-color: var(--brand); background: rgba(var(--brand-rgb), .16); }
.editor-title { display: flex; flex-direction: column; padding-left: 11px; border-left: 1px solid var(--border); }
.editor-title span { color: var(--muted); font-size: 8px; }
.editor-title b { font-size: 10px; }
.save-state { font-size: 8px; color: var(--muted); }
.save-state.done { color: #1a9666; }
.editor-layout { display: grid; grid-template-columns: minmax(410px, 520px) minmax(650px, 1fr); align-items: start; }
.editor-panel { min-height: calc(100vh - 130px); border-right: 1px solid var(--border); background: var(--surface); }
.editor-section { padding: 20px; border-bottom: 1px solid var(--border); }
.line-editor { display: grid; gap: 9px; margin-bottom: 9px; }
.line-card { padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.line-card.recurring-line { border-color: rgba(var(--brand-rgb), .45); background: rgba(var(--brand-rgb), .06); }
.line-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.line-card-head b, .line-card-head span { display: block; }
.line-card-head b { font-size: 9px; }
.line-card-head span { margin-top: 2px; color: var(--muted); font-size: 8px; }
.line-card-head button { border: 0; background: transparent; color: var(--muted); }
.line-card-head svg { width: 14px; }
.charge-type-row { margin-bottom: 8px; }
.line-add-product { width: 100%; }
.line-fields { margin-top: 10px; grid-template-columns: 1fr 1fr; }
.line-discount-control { margin-top: 13px; padding: 12px; border: 1px solid rgba(var(--brand-rgb), .28); border-radius: 8px; background: rgba(var(--brand-rgb), .035); }
.line-discount-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 10px; }
.line-discount-heading strong { font-size: 9px; }
.line-discount-heading span { color: var(--muted); font-size: 8px; }
.line-discount-fields { gap: 9px; }
.line-discount-warning { color: #d97706; font-weight: 700; }
.line-price-breakdown { display: grid; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.line-price-breakdown > span, .line-price-breakdown > strong { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 8px; }
.line-price-breakdown > span { color: var(--muted); }
.line-price-breakdown > span b { color: var(--text); font-weight: 600; }
.line-price-breakdown > strong { color: var(--brand); font-size: 10px; }
.document-discount-overview { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 12px; border: 1px solid rgba(var(--brand-rgb), .27); border-radius: 8px; background: rgba(var(--brand-rgb), .05); }
.document-discount-overview > span { font-size: 9px; color: var(--muted); }
.document-discount-overview > span b { color: var(--text); }
.document-discount-overview > strong { margin-left: auto; font-size: 10px; color: var(--brand); }
.document-discount-overview > small { flex-basis: 100%; color: var(--muted); font-size: 8px; }
.line-recurring-fields { margin-top: 11px; padding-top: 11px; border-top: 1px solid rgba(var(--brand-rgb), .35); }
.inline-tip { color: var(--muted); font-size: 8px; margin: 7px 0 0; }
.document-link-note { color: var(--brand); font-weight: 700; }
.inline-create-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.button.inline-add { color: var(--brand); border-color: rgba(var(--brand-rgb), .55); background: rgba(var(--brand-rgb), .08); }
.button.inline-add:hover { border-color: var(--brand); background: rgba(var(--brand-rgb), .15); }
.charge-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.charge-section-head h3 { margin: 0; font-size: 12px; }
.charge-section-head p { margin: 4px 0 0; color: var(--muted); font-size: 8px; }
.charge-section-head > strong { color: var(--text); font-size: 11px; white-space: nowrap; }
.charge-section-head > strong small { display: block; color: var(--muted); font-size: 7px; text-align: right; }
.recurring-charge-section { border-left: 3px solid var(--brand); background: rgba(var(--brand-rgb), .05); }
.charge-empty { margin-bottom: 10px; padding: 13px; border: 1px dashed var(--border-strong); border-radius: 9px; color: var(--muted); background: var(--surface-2); font-size: 8px; text-align: center; }
.recurring-add { color: var(--brand); border-color: rgba(var(--brand-rgb), .55); }

.print-sheet { position: sticky; top: 84px; width: 210mm; min-height: 297mm; margin: 30px auto; padding: 19mm 16mm 16mm; background: #fff; color: #1b1e23; box-shadow: 0 20px 50px rgba(10,15,20,.12); font-family: "Plus Jakarta Sans", sans-serif; overflow: hidden; }
.print-sheet.pdf-exporting { display: block !important; position: fixed !important; left: -10000px !important; top: 0 !important; margin: 0 !important; width: 210mm !important; min-height: 297mm !important; }
.print-accent { position: absolute; inset: 0 0 auto; height: 6px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 15mm; }
.print-logo.logo-wrap.safecyber.wordmark { width: 68mm; height: 20mm; display: flex; justify-content: flex-start; gap: 4mm; overflow: visible; }
.print-logo.logo-wrap.safecyber.wordmark img { width: 19mm; height: 19mm; }
.print-logo .safecyber-wordmark { font-size: 18px; letter-spacing: 1.2px; }
.print-logo.logo-wrap.ethertronix { width: 68mm; height: 18mm; background: #071015; padding: 3mm; }
.print-head > div { text-align: right; }
.print-head span, .print-head strong { display: block; }
.print-head span { font-size: 8px; letter-spacing: 3px; font-weight: 800; color: var(--brand); }
.print-head strong { font-size: 15px; margin-top: 4px; }
.print-meta { display: grid; grid-template-columns: 1fr 1fr 44mm; gap: 10mm; padding: 7mm 0; border-top: 1px solid #e4e7ea; border-bottom: 1px solid #e4e7ea; }
.print-meta span, .print-subject span, .print-summary section span, .print-terms span { display: block; font-size: 6.5px; font-weight: 800; letter-spacing: 1.3px; color: #9399a1; margin-bottom: 4px; }
.print-meta b { font-size: 9px; }
.print-meta p { margin: 2px 0; white-space: pre-line; color: #626873; font-size: 7px; line-height: 1.5; }
.print-meta dl, .print-summary dl { margin: 0; }
.print-meta dl > div, .print-summary dl > div { display: flex; justify-content: space-between; gap: 10px; }
.print-meta dt, .print-meta dd { font-size: 7px; margin: 0 0 6px; }
.print-meta dt { color: #858b94; }
.print-meta dd { font-weight: 700; }
.print-subject { padding: 7mm 0 3mm; }
.print-subject b { font-size: 10px; }
.print-table { margin-top: 7mm; table-layout: fixed; }
.print-table th { padding: 3mm 2mm; background: #11171d; color: #fff; font-size: 6px; }
.print-table th:first-child { width: 7mm; }
.print-table th:nth-child(3) { width: 17mm; }
.print-table th:nth-child(4) { width: 26mm; }
.print-table th:nth-child(5) { width: 28mm; }
.print-table th:nth-child(6) { width: 12mm; }
.print-table th:nth-child(7) { width: 28mm; }
.print-table td { padding: 4mm 2mm; border-color: #eaeced; color: #343840; font-size: 7px; vertical-align: top; }
.print-table td:nth-child(n+3), .print-table th:nth-child(n+3) { text-align: right; }
.print-table td b, .print-table td span { display: block; }
.print-table td b { font-size: 7.5px; }
.print-table td span { margin-top: 2px; color: #858b94; font-size: 6.5px; }
.print-charge-group { margin-top: 7mm; break-inside: avoid; }
.print-charge-heading { display: flex; align-items: center; justify-content: space-between; padding: 2.5mm 3mm; border: 1px solid #dfe3e7; border-bottom: 0; border-radius: 2mm 2mm 0 0; background: #f4f6f8; }
.print-charge-heading span { color: #656c75; font-size: 6.5px; font-weight: 800; letter-spacing: 1.2px; }
.print-charge-heading strong { color: #262b31; font-size: 7.5px; }
.print-charge-heading strong small { color: #7b828b; font-size: 6px; font-weight: 600; }
.print-charge-group.recurring .print-charge-heading { border-color: rgba(var(--brand-rgb), .35); background: rgba(var(--brand-rgb), .05); }
.print-charge-group.recurring .print-charge-heading span, .print-charge-group.recurring .print-charge-heading strong { color: var(--brand); }
.print-charge-group .print-table { margin-top: 0; }
.print-table td span.print-billing-line { margin-top: 3px; color: var(--brand); font-size: 6px; font-weight: 700; }
.print-summary { display: grid; grid-template-columns: 1fr 60mm; gap: 16mm; margin-top: 8mm; }
.print-summary section { margin-bottom: 6mm; }
.print-summary section p, .print-terms p { margin: 0; white-space: pre-line; color: #666d76; font-size: 7px; }
.print-summary dl > div { padding: 2.3mm 0; font-size: 7px; }
.print-summary dd { margin: 0; font-weight: 700; }
.print-summary .print-included-row { color: #79818b; font-size: 6.5px; }
.print-summary .grand-total { border-top: 1px solid #cfd3d7; margin-top: 2mm; padding-top: 4mm; color: var(--brand); font-size: 10px; }
.print-terms { margin-top: 14mm; padding-top: 5mm; border-top: 1px solid #e2e4e7; }
.print-footer { position: absolute; left: 16mm; right: 16mm; bottom: 9mm; color: #a5a9ae; font-size: 6px; text-align: center; }

.sidebar-scrim { display: none; }

@media (max-width: 1500px) {
  .quick-create { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .customer-grid { grid-template-columns: 1fr 1fr; }
  .editor-layout { display: block; overflow: visible; }
  .editor-panel { min-height: 0; border-right: 0; }
  .print-sheet { position: relative; top: 0; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 45; border: 0; background: rgba(3,6,9,.58); }
  .main-shell { margin-left: 0; }
  .menu-button { display: grid; }
  .topbar { padding: 0 18px; }
  .breadcrumbs { display: none; }
  .content { padding: 26px 20px 50px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .document-row, .recent-panel .document-row { grid-template-columns: 36px 1fr 90px 70px; }
  .doc-date, .document-row .row-actions { display: none; }
  .doc-total { grid-column: 3; grid-row: 1; }
  .status { grid-column: 4; grid-row: 1; }
  .print-sheet { position: relative; top: 0; transform-origin: top left; width: 210mm; margin: 20px; }
  .editor-toolbar { position: sticky; top: 64px; z-index: 20; }
}

@media (max-width: 620px) {
  .auth-gate { padding: 16px; }
  .auth-card { padding: 24px 20px; }
  .auth-copy h1 { font-size: 24px; }
  .company-pill { font-size: 0; }
  .company-pill > span { font-size: 9px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 16px; }
  .page-head .button { width: 100%; }
  .quick-actions, .metric-grid, .customer-grid, .company-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 125px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .status-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .chooser { padding: 45px 18px 22px; }
  .chooser h1 { font-size: 24px; }
  .company-choice { min-height: 150px; }
  .choice-logo { height: 65px; }
  .document-row, .recent-panel .document-row { grid-template-columns: 34px 1fr 94px; gap: 8px; padding: 11px; }
  .status { display: none; }
  .doc-total { grid-column: 3; }
  .editor-toolbar { padding: 10px 12px; align-items: flex-start; gap: 9px; }
  .editor-toolbar > div:last-child { flex-wrap: wrap; justify-content: flex-end; }
  .editor-title, .save-state { display: none; }
  .editor-toolbar .button { padding: 0 10px; }
  .line-fields { grid-template-columns: 1fr 1fr; }
  .inline-create-control { grid-template-columns: 1fr; }
  .charge-section-head { flex-direction: column; }
  .charge-section-head > strong small { display: inline; text-align: left; }
  .button.inline-add { width: 100%; }
  .print-sheet { display: none; }
}

@media print {
  @page { size: A4; margin: 0; }
  html, body, #root, .app-shell, .main-shell, .document-main, .editor-shell, .editor-layout { margin: 0 !important; padding: 0 !important; width: 210mm !important; min-height: 297mm !important; background: #fff !important; display: block !important; }
  .no-print, .sidebar, .sidebar-scrim, .modal-backdrop, .chooser-backdrop { display: none !important; }
  .print-sheet { display: block !important; position: relative !important; inset: auto !important; width: 210mm !important; min-height: 297mm !important; margin: 0 !important; padding: 19mm 16mm 16mm !important; box-shadow: none !important; transform: none !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

@media (prefers-reduced-motion: no-preference) {
  button, .metric-card, .company-choice { transition: .18s ease; }
}

/* v1.9.3: consistent typography, aligned discount inputs and usable select arrows */
html, body, button, input, select, textarea, .print-sheet, .code { font-family: "Plus Jakarta Sans", sans-serif !important; }
.field select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 34px; line-height: 1.35; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aab4bf' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px 15px;
}
.field select::-ms-expand { display: none; }
.line-discount-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
.line-discount-fields .field { min-width: 0; justify-content: flex-end; }
.line-discount-fields .field > .field-label { display: flex; align-items: flex-end; min-height: 26px; line-height: 1.35; }
.line-discount-fields .field input, .line-discount-fields .field select { min-width: 0; height: 41px; }
.line-discount-heading { align-items: center; }
.document-discount-overview > strong { flex-basis: 100%; margin-left: 0; padding-top: 5px; border-top: 1px solid var(--border); }
/* A4-optimised document: fewer dead spaces, resilient columns and clean rows. */
.print-sheet { overflow: visible; padding: 14mm 13mm 12mm; }
.print-sheet.pdf-exporting { overflow: visible !important; min-height: 0 !important; height: auto !important; padding: 14mm 13mm 12mm !important; }
.print-head { padding-bottom: 7mm; }
.print-meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 43mm; gap: 5mm; padding: 5mm 0; }
.print-meta > div, .print-meta dl { min-width: 0; overflow-wrap: anywhere; }
.print-meta dt, .print-meta dd { font-size: 7.5px; }
.print-charge-group { margin-top: 5mm; break-inside: auto; page-break-inside: auto; }
.print-charge-heading { padding: 2mm 2.5mm; break-after: avoid; }
.print-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.print-table th, .print-table td { box-sizing: border-box; line-height: 1.35; overflow-wrap: anywhere; }
.print-table th { padding: 2mm 1.3mm; vertical-align: middle; font-size: 6.4px; }
.print-table td { padding: 2.5mm 1.3mm; font-size: 7.2px; vertical-align: top; }
.print-table td b { font-size: 7.2px; }
.print-table td span { font-size: 6.3px; line-height: 1.35; }
.print-table td:nth-child(n+3), .print-table th:nth-child(n+3) { font-variant-numeric: tabular-nums; }
.print-table td:nth-child(3), .print-table th:nth-child(3) { text-align: center; }
.print-table th:first-child { width: 6mm; }
.print-table th:nth-child(2) { width: auto; text-align: left; }
.print-table th:nth-child(3) { width: 17mm; }
.print-table th:nth-child(4) { width: 24mm; }
.print-table th:nth-child(5) { width: 27mm; }
.print-table th:nth-child(6) { width: 10mm; }
.print-table th:nth-child(7) { width: 25mm; }
.print-table td:nth-child(5), .print-table th:nth-child(5) { text-align: right; }
.print-table tbody tr { break-inside: avoid; page-break-inside: avoid; }
.print-summary { grid-template-columns: minmax(0, 1fr) 69mm; gap: 9mm; margin-top: 6mm; break-inside: avoid; }
.print-summary dl > div { align-items: baseline; gap: 5mm; padding: 1.9mm 0; }
.print-summary dt { min-width: 0; overflow-wrap: break-word; }
.print-summary dd { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.print-terms { margin-top: 6mm; padding-top: 3mm; break-inside: avoid; }
.print-footer { display: none; }
@media print {
  .print-sheet { height: auto !important; min-height: 0 !important; overflow: visible !important; padding: 14mm 13mm 12mm !important; }
  .print-table thead { display: table-header-group; }
  .print-table tr, .print-charge-heading, .print-summary { break-inside: avoid; }
}

/* v1.9.4 — document currency conversion, cleaner editor controls and denser A4 output */
.field-label { display: block; min-width: 0; line-height: 1.35; }
.select-control { position: relative; display: block; width: 100%; min-width: 0; color: inherit; font-size: inherit; font-weight: inherit; }
.select-control select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  width: 100%;
  padding-right: 38px !important;
  background-image: none !important;
}
.select-control > svg {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  stroke-width: 2.2;
}
.select-control:focus-within > svg { color: var(--brand); }
.select-control select:disabled + svg { opacity: .55; }

.line-card { overflow: hidden; }
.line-fields, .charge-type-row, .line-discount-fields { gap: 12px; }
.line-discount-control {
  margin-top: 14px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(var(--brand-rgb), .045);
}
.line-discount-heading { display: block; margin-bottom: 12px; }
.line-discount-heading strong { display: block; font-size: 10px; line-height: 1.35; }
.line-discount-heading span { display: block; margin-top: 3px; font-size: 8px; line-height: 1.45; }
.line-discount-fields { align-items: end; }
.line-discount-fields .field { justify-content: initial; }
.line-discount-fields .field > .field-label { min-height: 0; align-items: initial; }
.line-discount-fields .field input,
.line-discount-fields .field select { height: 40px; }

.line-price-breakdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.line-price-breakdown > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.018);
}
.line-price-breakdown > div > span,
.line-price-breakdown > div > b { display: block; }
.line-price-breakdown > div > span { color: var(--muted); font-size: 7.5px; line-height: 1.35; }
.line-price-breakdown > div > b {
  margin-top: 4px;
  color: var(--text);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.line-price-breakdown > .line-total-stat { border-color: rgba(var(--brand-rgb), .42); background: rgba(var(--brand-rgb), .08); }
.line-price-breakdown > .line-total-stat > span,
.line-price-breakdown > .line-total-stat > b { color: var(--brand); }

.currency-conversion-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
}
.currency-conversion-note > div { min-width: 0; }
.currency-conversion-note b,
.currency-conversion-note span { display: block; }
.currency-conversion-note b { color: var(--text); font-size: 8.5px; }
.currency-conversion-note span { margin-top: 2px; color: var(--muted); font-size: 7.5px; line-height: 1.5; }
.currency-conversion-note a { flex: 0 0 auto; color: var(--brand); font-size: 7px; text-decoration: none; }
.currency-conversion-note.loading { border-color: rgba(var(--brand-rgb), .38); }
.currency-conversion-note.ready { border-color: rgba(39,174,96,.35); }
.currency-conversion-note.error { border-color: rgba(218,91,72,.4); }

/* Keep all monetary table columns on a single visual line. */
.print-table td:nth-child(3),
.print-table td:nth-child(4),
.print-table td:nth-child(5),
.print-table td:nth-child(6),
.print-table td:nth-child(7) { white-space: nowrap; }
.print-money-nowrap { white-space: nowrap; }
.print-table th:nth-child(3) { width: 15mm; }
.print-table th:nth-child(4) { width: 25mm; }
.print-table th:nth-child(5) { width: 31mm; }
.print-table th:nth-child(6) { width: 10mm; }
.print-table th:nth-child(7) { width: 26mm; }

/* Documents with many lines switch to a denser but still readable A4 layout. */
.print-sheet.print-sheet-compact { padding: 11mm 11mm 10mm; }
.print-sheet.print-sheet-compact .print-head { padding-bottom: 4.5mm; }
.print-sheet.print-sheet-compact .print-logo.logo-wrap.safecyber.wordmark { height: 16mm; }
.print-sheet.print-sheet-compact .print-logo.logo-wrap.safecyber.wordmark img { width: 15mm; height: 15mm; }
.print-sheet.print-sheet-compact .print-logo .safecyber-wordmark { font-size: 15px; }
.print-sheet.print-sheet-compact .print-head strong { font-size: 13px; }
.print-sheet.print-sheet-compact .print-meta { gap: 4mm; padding: 3.5mm 0; }
.print-sheet.print-sheet-compact .print-meta span { margin-bottom: 2px; }
.print-sheet.print-sheet-compact .print-meta p { line-height: 1.35; }
.print-sheet.print-sheet-compact .print-meta dt,
.print-sheet.print-sheet-compact .print-meta dd { margin-bottom: 3px; }
.print-sheet.print-sheet-compact .print-subject { padding: 4mm 0 2mm; }
.print-sheet.print-sheet-compact .print-charge-group { margin-top: 3.5mm; }
.print-sheet.print-sheet-compact .print-charge-heading { padding: 1.5mm 2mm; }
.print-sheet.print-sheet-compact .print-table th { padding: 1.5mm 1.1mm; font-size: 5.9px; }
.print-sheet.print-sheet-compact .print-table td { padding: 1.75mm 1.1mm; font-size: 6.6px; line-height: 1.25; }
.print-sheet.print-sheet-compact .print-table td b { font-size: 6.7px; }
.print-sheet.print-sheet-compact .print-table td span { margin-top: 1px; font-size: 5.8px; line-height: 1.25; }
.print-sheet.print-sheet-compact .print-table td span.print-billing-line { margin-top: 2px; font-size: 5.6px; }
.print-sheet.print-sheet-compact .print-summary { grid-template-columns: minmax(0,1fr) 66mm; gap: 7mm; margin-top: 4mm; }
.print-sheet.print-sheet-compact .print-summary dl > div { padding: 1.35mm 0; font-size: 6.5px; }
.print-sheet.print-sheet-compact .print-summary .grand-total { margin-top: 1mm; padding-top: 2.5mm; font-size: 9px; }
.print-sheet.print-sheet-compact .print-terms { margin-top: 4mm; padding-top: 2.5mm; }
.print-sheet.print-sheet-compact .print-summary section { margin-bottom: 3mm; }

@media (max-width: 760px) {
  .line-price-breakdown { grid-template-columns: 1fr 1fr; }
  .currency-conversion-note { align-items: flex-start; flex-direction: column; }
}

@media print {
  .print-sheet.print-sheet-compact { padding: 11mm 11mm 10mm !important; }
}

/* v1.9.6 — invoice/table import workspace */
.import-document-button { white-space: nowrap; }
.import-document-modal { width: min(1180px, calc(100vw - 32px)); max-height: min(900px, calc(100vh - 32px)); overflow: auto; }
.import-document-grid { display: grid; grid-template-columns: minmax(300px, .82fr) minmax(520px, 1.45fr); gap: 18px; padding: 0 20px 18px; }
.import-source-panel, .import-preview-panel { min-width: 0; }
.import-dropzone { display: flex; min-height: 170px; padding: 20px; border: 1px dashed rgba(var(--brand-rgb), .55); border-radius: 12px; background: rgba(var(--brand-rgb), .045); cursor: pointer; flex-direction: column; align-items: center; justify-content: center; text-align: center; transition: border-color .18s ease, background .18s ease; }
.import-dropzone:hover { border-color: var(--brand); background: rgba(var(--brand-rgb), .075); }
.import-dropzone > svg { width: 28px; height: 28px; margin-bottom: 10px; color: var(--brand); }
.import-dropzone strong { max-width: 100%; color: var(--text); font-size: 11px; overflow-wrap: anywhere; }
.import-dropzone span { margin-top: 5px; color: var(--muted); font-size: 8px; font-weight: 700; }
.import-dropzone small { max-width: 350px; margin-top: 7px; color: var(--muted); font-size: 7px; line-height: 1.5; }
.import-progress { margin: 10px 0 2px; }
.import-progress > div { height: 5px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.import-progress > div > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .2s ease; }
.import-progress b { display: block; margin-top: 5px; color: var(--muted); font-size: 7.5px; font-weight: 700; }
.import-or { display: flex; align-items: center; gap: 9px; margin: 13px 0; color: var(--muted); font-size: 7px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.import-or::before, .import-or::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.import-source-panel textarea { min-height: 190px; font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif; font-size: 8px; line-height: 1.55; }
.import-source-actions { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.import-error { margin: 9px 0 0; padding: 9px 10px; border: 1px solid rgba(218,91,72,.35); border-radius: 8px; background: rgba(218,91,72,.06); color: #d66556; font-size: 7.5px; line-height: 1.45; }
.import-preview-panel { display: flex; min-height: 420px; flex-direction: column; }
.import-preview-head { display: flex; min-height: 48px; margin-bottom: 10px; align-items: flex-start; justify-content: space-between; gap: 12px; }
.import-preview-head h3 { margin: 3px 0 0; font-size: 13px; }
.import-detection-chips { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.import-detection-chips > span { padding: 6px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 7px; white-space: nowrap; }
.import-detection-chips b { color: var(--text); }
.import-table-scroll { overflow: auto; max-height: 485px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.import-table { width: 100%; min-width: 790px; border-collapse: collapse; }
.import-table th { position: sticky; top: 0; z-index: 2; padding: 8px 7px; border-bottom: 1px solid var(--border); background: var(--surface-3); color: var(--muted); font-size: 6.5px; text-align: left; text-transform: uppercase; letter-spacing: .06em; }
.import-table td { padding: 7px; border-bottom: 1px solid var(--border); vertical-align: top; }
.import-table tr:last-child td { border-bottom: 0; }
.import-table input, .import-table select { width: 100%; height: 34px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); padding: 7px 8px; color: var(--text); font: inherit; font-size: 8px; }
.import-table input:focus, .import-table select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(var(--brand-rgb), .1); }
.import-table td:first-child { min-width: 190px; }
.import-table td:nth-child(2) { width: 70px; }
.import-table td:nth-child(3) { width: 82px; }
.import-table td:nth-child(4) { width: 100px; }
.import-table td:nth-child(5) { width: 70px; }
.import-table td:nth-child(6) { width: 140px; }
.import-table td:last-child { width: 42px; }
.import-table .import-description { height: 30px; margin-top: 5px; color: var(--muted); font-size: 7px; }
.import-discount-cell { display: grid; grid-template-columns: 58px 1fr; gap: 5px; }
.row-icon-button { display: grid; width: 32px; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); place-items: center; cursor: pointer; }
.row-icon-button svg { width: 14px; height: 14px; }
.row-icon-button.danger:hover { background: rgba(218,91,72,.09); color: #d66556; }
.import-empty-preview { display: flex; min-height: 315px; padding: 30px; border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2); flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.import-empty-preview svg { width: 30px; height: 30px; color: var(--muted); }
.import-empty-preview b { margin-top: 10px; font-size: 10px; }
.import-empty-preview span { max-width: 390px; margin-top: 6px; color: var(--muted); font-size: 7.5px; line-height: 1.55; }
.import-options { display: grid; gap: 7px; margin-top: 12px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.import-options label { display: grid; grid-template-columns: 16px 1fr; align-items: start; gap: 7px; color: var(--text); font-size: 8px; font-weight: 700; cursor: pointer; }
.import-options input { margin: 1px 0 0; accent-color: var(--brand); }
.import-options label small { display: block; grid-column: 2; margin-top: -4px; color: var(--muted); font-size: 6.8px; font-weight: 500; line-height: 1.45; }
.import-options label.disabled { opacity: .55; cursor: not-allowed; }
.import-modal-actions { position: sticky; bottom: 0; z-index: 5; margin: 0; padding: 13px 20px; border-top: 1px solid var(--border); background: rgba(9,14,19,.96); backdrop-filter: blur(12px); }

@media (max-width: 980px) {
  .import-document-modal { width: min(900px, calc(100vw - 20px)); }
  .import-document-grid { grid-template-columns: 1fr; padding: 0 14px 14px; }
  .import-preview-panel { min-height: 0; }
  .import-table-scroll { max-height: 420px; }
}

@media (max-width: 640px) {
  .import-document-modal { width: calc(100vw - 12px); max-height: calc(100vh - 12px); }
  .import-document-grid { padding: 0 10px 12px; gap: 14px; }
  .import-dropzone { min-height: 145px; padding: 15px; }
  .import-preview-head { flex-direction: column; }
  .import-detection-chips { justify-content: flex-start; }
  .import-modal-actions { padding: 10px; }
}

/* Renewal reminders — v1.9.9 */
.renewal-summary-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:18px; }
.renewal-summary { min-height:116px; padding:16px; border:1px solid var(--border); border-radius:14px; background:var(--surface); box-shadow:var(--shadow); }
.renewal-summary > span { display:block; color:var(--text-2); font-size:10px; font-weight:700; }
.renewal-summary > strong { display:block; margin:14px 0 8px; font-size:28px; line-height:1; letter-spacing:-1px; }
.renewal-summary > small { color:var(--muted); font-size:9px; }
.renewal-summary.danger strong { color:#ff8a7a; }
.renewal-summary.warning strong { color:#f2bd68; }
.renewal-summary.success strong { color:#67d8a0; }
.renewal-toolbar { margin-top:0; }
.renewal-panel { overflow:hidden; }
.renewal-list { display:grid; }
.renewal-row { display:grid; grid-template-columns:104px minmax(0,1fr) minmax(270px,auto); gap:18px; align-items:center; padding:18px 20px; border-bottom:1px solid var(--border); }
.renewal-row:last-child { border-bottom:0; }
.renewal-row:hover { background:rgba(var(--brand-rgb),.035); }
.renewal-countdown { min-height:78px; border-radius:12px; display:grid; place-items:center; text-align:center; border:1px solid var(--border); background:var(--surface-2); }
.renewal-countdown strong { display:block; font-size:24px; line-height:1; }
.renewal-countdown span { display:block; margin-top:6px; color:var(--muted); font-size:8px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; }
.renewal-countdown.overdue { border-color:#6a3834; background:#2a1918; color:#ff9d91; }
.renewal-countdown.soon { border-color:#5c4d2e; background:#241f15; color:#f2bd68; }
.renewal-countdown.scheduled { color:var(--brand); background:rgba(var(--brand-rgb),.07); border-color:rgba(var(--brand-rgb),.28); }
.renewal-main { min-width:0; }
.renewal-title { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.renewal-title b { font-size:12px; }
.renewal-review { display:inline-flex; align-items:center; min-height:20px; padding:0 7px; border:1px solid #65542f; border-radius:99px; background:#251f13; color:#f2bd68; font-size:7px; font-weight:800; text-transform:uppercase; letter-spacing:.45px; }
.renewal-customer { display:block; margin-top:3px; color:var(--text-2); font-size:10px; font-weight:600; }
.renewal-main p { max-width:760px; margin:8px 0 0; color:var(--muted); font-size:9px; line-height:1.55; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.renewal-meta { display:flex; flex-wrap:wrap; gap:8px 16px; margin-top:10px; }
.renewal-meta span { color:var(--muted); font-size:8px; }
.renewal-meta b { margin-right:5px; color:var(--text-2); font-weight:700; }
.renewal-side { display:flex; flex-direction:column; align-items:flex-end; gap:7px; }
.renewal-amount { font-size:13px; }
.renewal-state { font-size:8px; font-weight:700; }
.renewal-state.overdue { color:#ff8a7a; }
.renewal-state.soon { color:#f2bd68; }
.renewal-state.scheduled { color:#7f8994; }
.renewal-actions { display:flex; justify-content:flex-end; gap:7px; margin-top:3px; }
.renewal-actions .button { height:34px; padding:0 10px; font-size:9px; }
@media (max-width: 1000px) {
  .renewal-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .renewal-row { grid-template-columns:90px minmax(0,1fr); }
  .renewal-side { grid-column:2; align-items:flex-start; }
  .renewal-actions { justify-content:flex-start; flex-wrap:wrap; }
}
@media (max-width: 680px) {
  .renewal-summary-grid { grid-template-columns:1fr 1fr; gap:8px; }
  .renewal-summary { min-height:100px; padding:13px; }
  .renewal-summary > strong { font-size:24px; }
  .renewal-row { grid-template-columns:1fr; padding:15px; gap:12px; }
  .renewal-countdown { min-height:60px; place-items:start; padding:12px; text-align:left; }
  .renewal-countdown div { display:flex; align-items:baseline; gap:7px; }
  .renewal-countdown strong { font-size:20px; }
  .renewal-countdown span { margin:0; }
  .renewal-side { grid-column:1; align-items:flex-start; }
  .renewal-main p { white-space:normal; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
  .renewal-actions { width:100%; }
  .renewal-actions .button { flex:1; }
}

/* v1.9.10 prepaid recurring plans */
.recurring-plan-wrap { margin-top: 11px; padding-top: 11px; border-top: 1px solid rgba(var(--brand-rgb), .35); }
.recurring-plan-wrap .line-recurring-fields { margin-top: 0; padding-top: 0; border-top: 0; }
.prepaid-plan-summary { margin-top: 10px; padding: 11px 12px; border: 1px solid rgba(var(--brand-rgb), .34); border-radius: 9px; background: rgba(var(--brand-rgb), .075); }
.prepaid-plan-summary strong, .prepaid-plan-summary span, .prepaid-plan-summary small { display: block; }
.prepaid-plan-summary strong { color: var(--brand); font-size: 9px; }
.prepaid-plan-summary span { margin-top: 4px; color: var(--text); font-size: 8px; line-height: 1.5; }
.prepaid-plan-summary small { margin-top: 4px; color: var(--muted); font-size: 7.5px; line-height: 1.5; }

/* v1.9.11 final payment receipts */
.receipt-button { border-color: rgba(var(--brand-rgb), .34); background: rgba(var(--brand-rgb), .08); color: var(--brand); }
.receipt-button:hover { background: rgba(var(--brand-rgb), .14); }
.receipt-action { color: #67d8a0 !important; }
.paid-receipt-note { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:10px; padding:10px 11px; border:1px solid rgba(103,216,160,.3); border-radius:10px; background:rgba(103,216,160,.06); }
.paid-receipt-note > div { display:flex; align-items:center; gap:9px; min-width:0; }
.paid-receipt-note svg { width:18px; height:18px; color:#67d8a0; flex:0 0 auto; }
.paid-receipt-note span { display:grid; gap:2px; }
.paid-receipt-note b { font-size:9px; color:#8be6b2; }
.paid-receipt-note small { color:var(--muted); font-size:7.5px; }
.paid-receipt-note .button { flex:0 0 auto; height:32px; font-size:8px; }

.payment-form { padding:0 20px 18px; }
.payment-total-card { display:flex; gap:12px; align-items:center; margin-bottom:15px; padding:14px; border:1px solid rgba(var(--brand-rgb), .34); border-radius:12px; background:rgba(var(--brand-rgb), .07); }
.payment-total-card > svg { width:30px; height:30px; color:var(--brand); }
.payment-total-card div { display:grid; gap:2px; }
.payment-total-card span { color:var(--muted); font-size:8px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; }
.payment-total-card strong { color:var(--text); font-size:20px; }
.payment-total-card small { color:var(--muted); font-size:7.5px; }
.payment-error { margin:12px 0 0; padding:9px 10px; border:1px solid rgba(218,91,72,.35); border-radius:9px; background:rgba(218,91,72,.07); color:#ff9d91; font-size:8px; line-height:1.5; }

.receipt-summary-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-bottom:18px; }
.receipt-summary-card { min-height:112px; padding:16px; border:1px solid var(--border); border-radius:14px; background:var(--surface); box-shadow:var(--shadow); }
.receipt-summary-card > span { display:block; color:var(--text-2); font-size:10px; font-weight:700; }
.receipt-summary-card > strong { display:block; margin:13px 0 7px; font-size:28px; line-height:1; letter-spacing:-1px; }
.receipt-summary-card > small { color:var(--muted); font-size:9px; }
.receipt-summary-card.warning > strong { color:#f2bd68; }
.receipt-toolbar { margin-top:0; }
.receipt-panel { overflow:hidden; }
.receipt-list { display:grid; }
.receipt-row { display:grid; grid-template-columns:42px minmax(0,1fr) 150px minmax(250px,auto); gap:14px; align-items:center; padding:15px 18px; border-bottom:1px solid var(--border); }
.receipt-row:last-child { border-bottom:0; }
.receipt-row:hover { background:rgba(var(--brand-rgb),.035); }
.receipt-row-icon { display:grid; width:38px; height:38px; border:1px solid var(--border); border-radius:10px; background:var(--surface-2); place-items:center; }
.receipt-row-icon svg { width:18px; height:18px; }
.receipt-row-icon.issued { border-color:rgba(103,216,160,.32); color:#67d8a0; background:rgba(103,216,160,.06); }
.receipt-row-icon.pending { border-color:#5c4d2e; color:#f2bd68; background:#241f15; }
.receipt-row-main { min-width:0; }
.receipt-row-main > div { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.receipt-row-main > div b { font-size:11px; }
.receipt-row-main > div span { color:var(--muted); font-size:8px; }
.receipt-row-main > strong { display:block; margin-top:3px; font-size:9.5px; }
.receipt-row-main > small { display:block; margin-top:3px; color:var(--muted); font-size:7.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.receipt-row-amount { text-align:right; font-size:12px; }
.receipt-row-actions { display:flex; justify-content:flex-end; gap:7px; }
.receipt-row-actions .button { height:34px; padding:0 10px; font-size:8px; }

.receipt-print-backdrop { z-index:160; overflow:auto; align-items:flex-start; padding:24px; }
.receipt-viewer { width:min(980px,calc(100vw - 32px)); margin:auto; border:1px solid var(--border); border-radius:16px; background:#0d141a; box-shadow:0 30px 80px rgba(0,0,0,.55); overflow:hidden; }
.receipt-viewer-toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:12px 14px; border-bottom:1px solid var(--border); background:#101920; }
.receipt-viewer-toolbar > div:first-child { display:grid; gap:2px; }
.receipt-viewer-toolbar b { font-size:10px; }
.receipt-viewer-toolbar span { color:var(--muted); font-size:8px; }
.receipt-viewer-toolbar > div:last-child { display:flex; gap:7px; align-items:center; }
.receipt-viewer-toolbar .button { height:34px; font-size:8px; }
.receipt-sheet { position:relative; width:210mm; min-height:297mm; margin:20px auto 28px; padding:17mm 15mm 15mm; background:#fff; color:#1b1e23; box-shadow:0 18px 45px rgba(0,0,0,.25); font-family:"Plus Jakarta Sans",sans-serif; overflow:hidden; }
.receipt-sheet.pdf-exporting { position:fixed !important; left:-10000px !important; top:0 !important; margin:0 !important; box-shadow:none !important; }
.receipt-accent { position:absolute; left:0; right:0; top:0; height:3.5mm; background:linear-gradient(90deg,var(--brand),var(--brand-2)); }
.receipt-head { display:flex; justify-content:space-between; align-items:flex-start; gap:15mm; padding-bottom:8mm; border-bottom:1px solid #e4e7ea; }
.receipt-logo.logo-wrap { height:21mm; max-width:85mm; }
.receipt-logo.logo-wrap img { max-height:21mm; }
.receipt-head > div { display:grid; justify-items:end; gap:2px; text-align:right; }
.receipt-head > div > span { color:var(--brand); font-size:7px; font-weight:800; letter-spacing:1.9px; }
.receipt-head > div > strong { font-size:15px; }
.receipt-head > div > em { margin-top:4px; padding:4px 8px; border:1px solid #b5dbc4; border-radius:99px; background:#effaf3; color:#237848; font-size:7px; font-style:normal; font-weight:800; letter-spacing:.7px; }
.receipt-parties { display:grid; grid-template-columns:1.05fr 1.05fr .9fr; gap:9mm; padding:7mm 0; border-bottom:1px solid #e5e8eb; }
.receipt-parties section > span, .receipt-purpose span, .receipt-payment-summary section > span { display:block; margin-bottom:4px; color:#8b9299; font-size:5.8px; font-weight:800; letter-spacing:1.1px; }
.receipt-parties section > b { font-size:8px; }
.receipt-parties p { margin:3px 0 0; color:#61686f; font-size:6.2px; line-height:1.45; }
.receipt-parties dl { margin:0; }
.receipt-parties dl > div { display:grid; grid-template-columns:1fr auto; gap:7px; margin-bottom:4px; font-size:6.2px; }
.receipt-parties dt { color:#7f878e; }
.receipt-parties dd { margin:0; font-weight:700; text-align:right; }
.receipt-purpose { padding:6mm 0 4mm; }
.receipt-purpose strong { display:block; font-size:10px; }
.receipt-purpose p { margin:3px 0 0; color:#7a8187; font-size:6.2px; }
.receipt-items { width:100%; border-collapse:collapse; }
.receipt-items th { padding:2.3mm 2mm; background:#111920; color:white; font-size:6px; text-align:left; text-transform:uppercase; letter-spacing:.5px; }
.receipt-items td { padding:2.6mm 2mm; border-bottom:1px solid #e8eaec; font-size:6.8px; vertical-align:top; }
.receipt-items th.num, .receipt-items td.num { text-align:right; }
.receipt-items td div b { display:block; font-size:6.9px; }
.receipt-items td div span { display:block; margin-top:2px; color:#7a8187; font-size:5.9px; line-height:1.35; }
.receipt-payment-summary { display:grid; grid-template-columns:minmax(0,1fr) 70mm; gap:10mm; margin-top:8mm; }
.receipt-payment-summary section { margin-bottom:5mm; }
.receipt-payment-summary section p { margin:0; color:#545b61; font-size:6.4px; line-height:1.55; }
.receipt-payment-summary dl { margin:0; }
.receipt-payment-summary dl > div { display:flex; justify-content:space-between; gap:10px; padding:2.2mm 0; border-bottom:1px solid #e7e9eb; font-size:7px; }
.receipt-payment-summary dd { margin:0; font-weight:700; }
.receipt-payment-summary .receipt-paid-row { color:#237848; font-weight:800; }
.receipt-payment-summary .receipt-paid-row dd { font-size:8.5px; }
.receipt-payment-summary .receipt-balance-row { margin-top:2mm; padding-top:3mm; border-top:2px solid #181d21; border-bottom:0; font-size:8px; font-weight:800; }
.receipt-footer { display:flex; justify-content:space-between; gap:8mm; align-items:flex-end; margin-top:13mm; padding-top:5mm; border-top:1px solid #e5e8eb; }
.receipt-footer strong { color:var(--brand); font-size:8px; }
.receipt-footer span { color:#8a9197; font-size:5.8px; text-align:right; }

@media (max-width: 980px) {
  .receipt-row { grid-template-columns:42px minmax(0,1fr) 120px; }
  .receipt-row-actions { grid-column:2 / 4; justify-content:flex-start; }
  .receipt-sheet { transform:scale(.78); transform-origin:top left; margin-bottom:calc(-297mm * .22 + 24px); }
  .receipt-viewer { width:calc(100vw - 18px); }
}
@media (max-width: 680px) {
  .paid-receipt-note { align-items:flex-start; flex-direction:column; }
  .receipt-summary-grid { grid-template-columns:1fr; }
  .receipt-row { grid-template-columns:38px 1fr; gap:10px; }
  .receipt-row-amount { grid-column:2; text-align:left; }
  .receipt-row-actions { grid-column:2; flex-wrap:wrap; }
  .receipt-row-actions .button { flex:1; }
  .receipt-print-backdrop { padding:6px; }
  .receipt-viewer-toolbar { align-items:flex-start; flex-direction:column; }
  .receipt-viewer-toolbar > div:last-child { width:100%; flex-wrap:wrap; }
  .receipt-viewer-toolbar .button { flex:1; }
  .receipt-sheet { transform:scale(.48); margin:8px 0 calc(-297mm * .52 + 16px); transform-origin:top left; }
}
@media print {
  body.receipt-print-mode .main-shell,
  body.receipt-print-mode .sidebar,
  body.receipt-print-mode .sidebar-scrim,
  body.receipt-print-mode .chooser-backdrop,
  body.receipt-print-mode .modal-backdrop:not(.receipt-print-backdrop) { display:none !important; }
  body.receipt-print-mode .receipt-print-backdrop { display:block !important; position:static !important; inset:auto !important; padding:0 !important; background:#fff !important; }
  body.receipt-print-mode .receipt-viewer { width:210mm !important; margin:0 !important; border:0 !important; border-radius:0 !important; box-shadow:none !important; background:#fff !important; overflow:visible !important; }
  body.receipt-print-mode .receipt-viewer-toolbar { display:none !important; }
  body.receipt-print-mode .receipt-sheet { display:block !important; position:relative !important; width:210mm !important; min-height:297mm !important; margin:0 !important; padding:17mm 15mm 15mm !important; transform:none !important; box-shadow:none !important; overflow:hidden !important; print-color-adjust:exact; -webkit-print-color-adjust:exact; }
}

/* v1.9.12 — receipt/document logo + print legibility fixes */
/* Keep receipt logos at their intended aspect ratio; v1.9.11 inherited the 46px sidebar box. */
.receipt-logo.logo-wrap.safecyber.wordmark {
  width: 72mm;
  height: 21mm;
  max-width: 72mm;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4mm;
  padding: 0;
  overflow: visible;
}
.receipt-logo.logo-wrap.safecyber.wordmark img {
  width: 19mm;
  height: 19mm;
  max-width: 19mm;
  max-height: 19mm;
  flex: 0 0 19mm;
  object-fit: contain;
}
.receipt-logo .safecyber-wordmark {
  display: flex;
  align-items: baseline;
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 1.2px;
}
.receipt-logo.logo-wrap.ethertronix.wordmark {
  width: 72mm;
  height: 18mm;
  max-width: 72mm;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 3mm;
  overflow: visible;
  background: #071015;
  border-radius: 2mm;
}
.receipt-logo.logo-wrap.ethertronix.wordmark img {
  width: 100%;
  height: 100%;
  max-height: 12mm;
  object-fit: contain;
}

/* Printed invoices/quotations: keep all informational/body copy solid black. */
.print-sheet { color: #000; }
.print-meta span,
.print-subject span,
.print-summary section span,
.print-terms span,
.print-meta p,
.print-meta dt,
.print-meta dd,
.print-subject b,
.print-table td,
.print-table td b,
.print-table td span,
.print-table td span.print-billing-line,
.print-charge-heading span,
.print-charge-heading strong,
.print-charge-heading strong small,
.print-charge-group.recurring .print-charge-heading span,
.print-charge-group.recurring .print-charge-heading strong,
.print-summary section p,
.print-terms p,
.print-summary dl,
.print-summary dt,
.print-summary dd,
.print-summary .print-included-row,
.print-summary .grand-total,
.print-footer {
  color: #000 !important;
}
/* Keep the dark table header readable. */
.print-table th { color: #fff !important; }
/* Keep the document type/number accent as branding, while body copy stays black. */
.print-head span { color: var(--brand) !important; }
.print-head strong { color: #000 !important; }

/* Receipt: body/customer/item/payment text should be black for screen, print and PDF. */
.receipt-sheet { color: #000; }
.receipt-parties section > span,
.receipt-purpose span,
.receipt-payment-summary section > span,
.receipt-parties section > b,
.receipt-parties p,
.receipt-parties dt,
.receipt-parties dd,
.receipt-purpose strong,
.receipt-purpose p,
.receipt-items td,
.receipt-items td div b,
.receipt-items td div span,
.receipt-payment-summary section p,
.receipt-payment-summary dl,
.receipt-payment-summary dt,
.receipt-payment-summary dd,
.receipt-payment-summary .receipt-balance-row,
.receipt-footer span {
  color: #000 !important;
}
.receipt-items th { color: #fff !important; }
/* Preserve intentional status/brand accents only. */
.receipt-head > div > span { color: var(--brand) !important; }
.receipt-head > div > strong { color: #000 !important; }
.receipt-head > div > em { color: #237848 !important; }
.receipt-payment-summary .receipt-paid-row,
.receipt-payment-summary .receipt-paid-row dt,
.receipt-payment-summary .receipt-paid-row dd { color: #237848 !important; }
.receipt-footer strong { color: var(--brand) !important; }

@media print {
  body.receipt-print-mode .receipt-logo.logo-wrap.safecyber.wordmark {
    width: 72mm !important;
    height: 21mm !important;
    display: flex !important;
    overflow: visible !important;
  }
  body.receipt-print-mode .receipt-logo.logo-wrap.safecyber.wordmark img {
    width: 19mm !important;
    height: 19mm !important;
  }
}

/* v1.9.13 — future / optional payments, distinct from payable charges */
.future-charge-section { background: linear-gradient(150deg, rgba(var(--brand-rgb),.055),transparent 65%); }
.future-charge-section .charge-section-head { flex-wrap: wrap; gap: 12px; }
.future-charge-section .charge-section-head h3 { margin: 5px 0 5px; }
.future-charge-section .charge-section-head p { max-width: 560px; line-height: 1.5; }
.future-charge-cards { display: grid; gap: 13px; margin-bottom: 10px; }
.future-charge-card { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface,#111d28); }
.future-charge-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.future-charge-card-head > strong { margin-left: auto; color: var(--brand); font-size: 13px; white-space: nowrap; }
.future-charge-card-head > strong small { color: var(--muted); font-size: 9px; font-weight: 500; }
.future-remove { display: inline-flex; align-items: center; gap: 4px; border: 1px solid rgba(232,80,80,.3); border-radius: 8px; padding: 7px 9px; background: transparent; color: #db6161; cursor: pointer; font-size: 11px; }
.future-remove svg { width: 13px; height: 13px; }
.future-fields { align-items: start; }
.future-fields textarea { resize: vertical; }
.future-totals-strip { display: flex; flex-wrap: wrap; gap: 9px 20px; padding: 12px 0; font-size: 11px; }
.future-totals-strip b { font-variant-numeric: tabular-nums; }
.future-totals-strip small { flex-basis: 100%; color: var(--muted); font-size: 10px; }
.document-discount-overview .future-overview-total { color: var(--brand); }
.document-discount-overview .future-combined-total { font-size: 10px; color: var(--text); }
.future-print-group .print-charge-heading { background: #f3f6ff; border-color: #cbd6ec; }
.future-print-group .print-charge-heading span, .future-print-group .print-charge-heading strong { color: #234975; }
.future-print-table th:last-child, .future-print-table td:last-child { text-align: right; }
.future-kind-print { font-weight: 700; color: #325b80 !important; }
.future-print-disclaimer { margin: 2.5mm 2mm 0; font-size: 6.5px; line-height: 1.45; color: #4c5868; }
.print-summary .future-grand-total, .print-summary .combined-grand-total { color: #2e4f75; font-size: 7px; }
.print-summary .combined-grand-total { border-top: 1px dashed #b2bfd0; padding-top: 3mm; font-weight: 800; }
.future-summary-notice { margin-top: 3mm; padding: 2.5mm 3mm; border: 1px solid #d5dfe8; background: #f8faff; border-radius: 1.5mm; font-size: 6.5px; color: #42576b; line-height: 1.55; }
@media (max-width: 600px) {
  .future-charge-card { padding: 11px; }
  .future-charge-card-head > strong { margin-left: 0; }
  .future-charge-section .charge-section-head > strong { width: 100%; }
  .future-totals-strip { flex-direction: column; gap: 5px; }
}
@media print {
  .future-charge-section { display: none !important; }
  .future-print-group, .future-print-table, .future-summary-notice { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* v1.9.14 — six-column optional/future table; prevent 7-column rules squeezing amount */
.future-print-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.future-print-table th,
.future-print-table td {
  box-sizing: border-box;
  vertical-align: middle;
  line-height: 1.4;
}
.future-print-table th {
  word-break: normal;
  overflow-wrap: normal;
  white-space: normal;
  hyphens: none;
}
.future-print-table th:nth-child(1),
.future-print-table td:nth-child(1) { width: 7mm; text-align: center; }
.future-print-table th:nth-child(2),
.future-print-table td:nth-child(2) { width: auto; text-align: left; }
.future-print-table th:nth-child(3),
.future-print-table td:nth-child(3) { width: 28mm; text-align: center; }
.future-print-table th:nth-child(4),
.future-print-table td:nth-child(4) { width: 26mm; text-align: center; }
.future-print-table th:nth-child(5),
.future-print-table td:nth-child(5) { width: 12mm; text-align: center; }
.future-print-table th:nth-child(6),
.future-print-table td:nth-child(6) { width: 34mm; text-align: right; }
.future-print-table td:nth-child(2) {
  overflow-wrap: break-word;
  word-break: normal;
}
.future-print-table td:nth-child(6) {
  white-space: nowrap;
  overflow-wrap: normal;
  font-variant-numeric: tabular-nums;
}
.future-print-table th:nth-child(6) {
  white-space: normal;
  overflow-wrap: normal;
  text-wrap: balance;
}
.future-print-group .print-charge-heading { gap: 8mm; }
.future-print-group .print-charge-heading span { min-width: 0; }
.future-print-group .print-charge-heading strong { flex-shrink: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media print {
  .future-print-table th,
  .future-print-table td { line-height: 1.4 !important; }
  .future-print-table td:nth-child(6) { white-space: nowrap !important; }
}
