:root {
  --ink: #17191f;
  --muted: #7c8089;
  --line: #e8e9ed;
  --panel: #f7f7f8;
  --white: #fff;
  --accent: #6d5dfc;
  --accent-soft: #efedff;
  --green: #25c77a;
  --green-soft: #e8faf1;
  --red: #ee5b64;
  --red-soft: #ffebed;
  --amber: #e6a318;
  --amber-soft: #fff6db;
  --blue: #3f82f7;
  --shadow: 0 18px 50px rgba(28, 30, 38, .09);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--ink); background: #fbfbfc; font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .16em; color: #9ba0aa; }
.brand { display: flex; gap: 10px; align-items: center; font-size: 18px; font-weight: 750; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px 9px 9px 3px; color: white; background: linear-gradient(145deg, #7665ff, #3b2fd0); font-size: 14px; }
.brand-light .brand-mark { color: #241c5d; background: white; }

.login-screen { display: grid; grid-template-columns: minmax(420px, 1.1fr) minmax(420px, .9fr); min-height: 100vh; }
.login-visual { position: relative; overflow: hidden; padding: 54px 64px; color: white; background: radial-gradient(circle at 80% 20%, rgba(255,255,255,.19), transparent 22%), linear-gradient(145deg, #30276e 0%, #6757df 58%, #8c7aff 100%); }
.login-copy { position: relative; z-index: 2; max-width: 660px; margin-top: 20vh; }
.login-copy .eyebrow { color: rgba(255,255,255,.65); }
.login-copy h1 { margin: 18px 0; max-width: 630px; font-size: clamp(42px, 5vw, 72px); line-height: .98; letter-spacing: -.045em; }
.login-copy p { max-width: 530px; color: rgba(255,255,255,.72); font-size: 18px; line-height: 1.65; }
.login-orbit { position: absolute; right: -130px; bottom: -190px; width: 620px; height: 620px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; }
.login-orbit span { position: absolute; inset: 80px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.login-orbit span:nth-child(2) { inset: 160px; background: rgba(255,255,255,.04); }
.login-orbit span:nth-child(3) { inset: 255px; background: white; box-shadow: 0 0 80px rgba(255,255,255,.5); }
.login-panel { display: grid; place-items: center; padding: 40px; background: white; }
.login-card { width: min(440px, 100%); }
.login-card h2 { margin: 15px 0 8px; font-size: 34px; letter-spacing: -.035em; }
.login-card > p { margin: 0 0 30px; }
.login-card label, .form-grid label { display: grid; gap: 9px; margin-bottom: 18px; color: #454952; font-size: 13px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid #dedfe4; border-radius: 11px; padding: 12px 13px; outline: none; background: white; transition: .2s; }
input:focus, select:focus, textarea:focus { border-color: #8a7eff; box-shadow: 0 0 0 3px rgba(109,93,252,.1); }
textarea { min-height: 90px; resize: vertical; }
.login-hint { margin-top: 18px !important; color: #a0a4ad; font-size: 12px; text-align: center; }
.mobile-brand { display: none; margin-bottom: 36px; }

.btn { display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border: 1px solid #dddfe5; border-radius: 11px; background: white; cursor: pointer; font-size: 13px; font-weight: 700; transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(20,22,29,.08); }
.btn-dark { color: white; border-color: #1d1f25; background: #1d1f25; }
.btn-primary { color: white; border-color: var(--accent); background: var(--accent); }
.btn-soft { color: #5748d8; border-color: transparent; background: var(--accent-soft); }
.btn-danger { color: #b52d39; border-color: #f6cdd1; background: #fff8f8; }
.btn-wide { width: 100%; min-height: 48px; }
.icon-button { border: 0; background: transparent; cursor: pointer; }

.app-shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 18px 14px; border-right: 1px solid var(--line); background: white; }
.company-switcher { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; width: 100%; margin: 0 0 16px; padding: 8px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.company-switcher:hover { background: var(--panel); }
.company-switcher strong { display: block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.company-switcher small { color: var(--muted); font-size: 10px; }
.company-logo { display: grid; place-items: center; width: 38px; height: 38px; overflow: hidden; border-radius: 11px; background: #f0efff; color: #5848da; font-size: 12px; font-weight: 850; }
.company-logo img { width: 100%; height: 100%; padding: 3px; object-fit: contain; background: white; }
.chevron { color: #999da6; }
#nav { display: grid; gap: 3px; }
#nav p { margin: 18px 10px 6px; color: #a0a4ad; font-size: 10px; letter-spacing: .08em; }
.nav-item { display: flex; gap: 11px; align-items: center; min-height: 39px; padding: 0 12px; border: 0; border-radius: 11px; background: transparent; cursor: pointer; color: #444850; text-align: left; font-size: 13px; }
.nav-item span { width: 18px; color: #696d75; font-size: 16px; text-align: center; }
.nav-item:hover { background: #f7f7f8; }
.nav-item.active { color: var(--ink); background: #f1f1f3; font-weight: 750; }
.nav-item.active span { color: var(--ink); }
.sidebar-footer { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center; margin-top: auto; padding: 10px; color: #666a73; font-size: 12px; }
.sidebar-footer .brand { grid-column: 1 / -1; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); color: #292c33; font-size: 15px; }
.help-dot { display: grid; place-items: center; width: 21px; height: 21px; border: 1px solid #c8cad0; border-radius: 50%; font-weight: 800; }

.workspace { min-width: 0; }
.topbar { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; height: 66px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.93); backdrop-filter: blur(12px); }
.topbar > div { display: flex; gap: 11px; align-items: center; }
.topbar strong { font-size: 14px; }
.page-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: #f2f2f4; font-size: 13px; }
#mobile-nav { display: none; }
.avatar { width: 36px; height: 36px; border: 0; border-radius: 50%; color: white; background: linear-gradient(145deg, #6555e7, #2d2869); font-size: 11px; font-weight: 800; cursor: pointer; }
.language-select { width: auto; min-width: 62px; height: 38px; padding: 0 28px 0 11px; border-radius: 10px; background-color: white; font-size: 12px; font-weight: 800; }
.page { max-width: 1500px; margin: 0 auto; padding: 30px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h1 { margin: 0 0 7px; font-size: 25px; letter-spacing: -.025em; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric, .card { border: 1px solid #eeeeef; border-radius: 16px; background: var(--panel); }
.metric { min-height: 132px; padding: 20px; }
.metric-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.metric-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: white; }
.metric strong { display: block; margin-top: 22px; font-size: 25px; letter-spacing: -.035em; }
.metric small { color: var(--muted); }
.trend-up { color: var(--green) !important; }
.trend-down { color: var(--red) !important; }
.dashboard-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.card { padding: 22px; }
.card.white { background: white; }
.card h2 { margin: 0; font-size: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.invoice-summary { display: grid; gap: 18px; }
.summary-row { display: flex; justify-content: space-between; align-items: center; }
.summary-row > div { display: flex; gap: 10px; align-items: center; }
.summary-row strong { font-size: 20px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; }
.dot-red { background: var(--red); box-shadow: 0 0 0 5px var(--red-soft); }
.dot-amber { background: var(--amber); box-shadow: 0 0 0 5px var(--amber-soft); }
.dot-blue { background: #3588d1; box-shadow: 0 0 0 5px #e8f3ff; }
.dot-green { background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.cash-chart { display: grid; gap: 14px; margin-top: 26px; }
.bar-label { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.bar { height: 11px; overflow: hidden; border-radius: 99px; background: #ececef; }
.bar span { display: block; height: 100%; border-radius: inherit; }
.bar-income { background: linear-gradient(90deg, #2ecc7e, #67e2a6); }
.bar-expense { background: linear-gradient(90deg, #ef5e68, #ff8c93); }
.clients-mini { display: grid; gap: 4px; }
.client-mini, .activity-item { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid #e8e8eb; }
.client-mini:last-child, .activity-item:last-child { border-bottom: 0; }
.initials { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #5748d8; background: #ebe8ff; font-size: 11px; font-weight: 850; }
.client-mini > div:nth-child(2), .activity-item > div { min-width: 0; flex: 1; }
.client-mini strong, .activity-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.client-mini small, .activity-item small { color: var(--muted); font-size: 10px; }
.client-mini > strong { flex: 0 0 auto; font-size: 12px; }

.tabs { display: inline-flex; gap: 3px; margin-bottom: 18px; padding: 4px; border-radius: 11px; background: #f0f0f2; }
.tab { padding: 8px 13px; border: 0; border-radius: 8px; background: transparent; color: #777b84; cursor: pointer; font-size: 12px; font-weight: 700; }
.tab.active { color: var(--ink); background: white; box-shadow: 0 2px 7px rgba(20,22,28,.07); }
.table-card { overflow: visible; border: 1px solid var(--line); border-radius: 15px; background: white; }
.table-tools { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px; border-bottom: 1px solid var(--line); }
.search { max-width: 300px; background: #f8f8f9; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; color: #8d919a; background: #fafafb; font-size: 10px; font-weight: 750; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 14px 16px; border-top: 1px solid #eeeef0; font-size: 12px; vertical-align: middle; }
.data-table tr:hover td { background: #fcfcfd; }
.data-table strong { font-size: 12px; }
.table-person { display: flex; gap: 10px; align-items: center; }
.table-link { padding: 0; border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; text-align: left; }
.table-link:hover strong { color: #5748d8; }
.table-link small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
button.table-person { width: 100%; }
.product-image-button { display: block; padding: 0; border: 0; background: transparent; cursor: pointer; }
.product-thumbnail { display: grid; width: 48px; height: 48px; overflow: hidden; border: 1px solid #e3e4e8; border-radius: 9px; background: white; object-fit: contain; place-items: center; }
.product-thumbnail-empty { padding: 4px; color: #a1a4ac; background: #f7f7f9; font-size: 8px; line-height: 1.15; text-align: center; }
.product-image-panel { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 18px; align-items: center; margin-bottom: 20px; padding: 16px; border: 1px solid #dedaf9; border-radius: 15px; background: linear-gradient(120deg, #faf9ff, #fff); }
.product-image-preview { display: grid; width: 132px; height: 132px; place-items: center; overflow: hidden; border: 1px dashed #d2cbee; border-radius: 12px; background: #fff; color: #9b96aa; font-size: 12px; }
.product-image-preview img { width: 100%; height: 100%; object-fit: contain; }
.product-image-details strong { display: block; margin-bottom: 5px; font-size: 14px; }
.product-image-details p { margin: 0 0 12px; color: #626574; font-size: 12px; line-height: 1.5; }
.product-image-details small { display: block; margin-top: 9px; color: var(--muted); font-size: 10px; }
.product-image-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.product-image-actions .btn { margin: 0; }
.product-packaging-block { align-items: start; }
.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 99px; font-size: 10px; font-weight: 750; }
.badge-open { color: #9a6e00; background: var(--amber-soft); }
.badge-paid, .badge-sent { color: #14834b; background: var(--green-soft); }
.badge-partial { color: #186cae; background: #e8f3ff; }
.badge-overdue { color: #b93642; background: var(--red-soft); }
.document-paid-detail { display: block; margin-top: 4px; color: #2879bc; font-size: 10px; white-space: nowrap; }
.badge-draft { color: #5f6470; background: #eeeef1; }
.row-actions { display: flex; gap: 5px; }
.row-button { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid #e3e4e8; border-radius: 8px; background: white; cursor: pointer; }
.row-button-danger { color: #b52d39; border-color: #f1d4d7; background: #fffafa; }
.row-button-danger:hover { border-color: #e8aeb4; background: #fff0f2; }
.row-menu-wrap { position: relative; }
.action-menu { position: absolute; z-index: 30; top: 36px; right: 0; display: grid; width: 210px; padding: 7px; border: 1px solid #e2e3e8; border-radius: 11px; background: white; box-shadow: 0 14px 35px rgba(20,22,29,.16); }
.action-menu span { padding: 8px 9px 4px; color: #9699a2; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.action-menu button { padding: 8px 9px; border: 0; border-radius: 7px; color: #383a42; background: transparent; cursor: pointer; font-size: 11px; text-align: left; }
.action-menu button:hover { background: #f4f2ff; }
.action-menu .danger { color: #b93642; }
.empty { padding: 60px 20px; color: var(--muted); text-align: center; }

.settings-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; }
.logo-card { text-align: center; }
.logo-preview { display: grid; place-items: center; width: 160px; height: 160px; margin: 12px auto 20px; overflow: hidden; border: 1px dashed #cfd1d8; border-radius: 22px; color: #6959e5; background: #f0eeff; font-size: 38px; font-weight: 850; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; grid-column: 1 / -1; margin: 3px 0 18px; padding: 14px; border-radius: 12px; background: #f7f7f9; }
.switch-row input { width: 18px; }
.compact-switch { display: inline-flex; align-items: center; gap: 8px; color: #626670; font-size: 11px; font-weight: 700; }
.compact-switch input { width: 18px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.script-fields { grid-column: 1 / -1; margin-bottom: 16px; padding: 14px; border: 1px solid #e4e1fa; border-radius: 12px; background: #faf9ff; }
.address-block { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; margin-bottom: 16px; padding: 14px; border: 1px solid #e5e5e9; border-radius: 12px; background: #fbfbfc; }
.address-block .wide { grid-column: 1 / -1; }
.address-block.is-disabled { opacity: .62; }
.integration-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; }
.integration-card > div { display: flex; align-items: center; gap: 13px; }
.integration-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: white; background: linear-gradient(145deg, #fd822f, #db3c17); font-weight: 900; }
.sixby-api-icon { background: linear-gradient(145deg, #5142cc, #7f70f0); }
.integration-error { border-color: #efc3c7; background: #fffafa; }
.integration-error-text { margin-top: 5px; color: #b52d39; font-size: 11px; }
.api-contract-note, .api-status-note { margin-top: 12px; padding: 14px; }
.api-contract-note code { padding: 1px 4px; border-radius: 4px; background: #eceafc; color: #4d42a8; }
.mapping-grid { margin-top: 14px; }
.integration-issues { margin-top: 8px; color: #8a6500; }
.integration-issues summary { cursor: pointer; font-weight: 650; }
.integration-issues ul { max-height: 180px; overflow: auto; margin: 8px 0 0; padding-left: 20px; }
.integration-issues li { margin: 5px 0; font-size: 12px; }
.row-with-warning { background: #fffaf0; }
.field-warning { color: #9a6e00; font-weight: 650; }
.product-tools { justify-content: flex-start; flex-wrap: nowrap; gap: 12px; overflow-x: auto; padding: 14px 18px; background: #fcfcff; }
.product-tools label { display: grid; flex: 0 0 auto; gap: 5px; margin: 0; color: #777b88; font-size: 10px; font-weight: 750; letter-spacing: .03em; }
.product-tools label span { padding-left: 2px; }
.product-tool-search { flex: 1 1 320px !important; min-width: 230px; }
.product-tools .search { width: 100%; max-width: none; }
.product-tool-select { min-width: 165px; }
.product-tool-sort { min-width: 235px; }
.product-tools select, .product-tools input { height: 42px; padding: 9px 12px; border-color: #e3e0f2; border-radius: 10px; background: #fff; font-size: 12px; }
.product-tool-count { flex: 0 0 auto; margin: 17px 0 0 auto; color: #686d7a; font-size: 11px; font-weight: 700; white-space: nowrap; }
.product-tools .row-button-danger { flex: 0 0 auto; margin-top: 16px; white-space: nowrap; }
.csv-preview-action { display: flex; align-items: end; margin-bottom: 18px; }
.csv-preview-card { margin-top: 12px; padding: 14px; }
.table-scroll { margin-top: 10px; overflow-x: auto; }
.data-table input[type="checkbox"] { width: 17px; height: 17px; }
.vat-settings { margin-top: 16px; }
.vat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.vat-rate-row { display: grid; grid-template-columns: 30px minmax(70px, 1fr) 76px 112px; gap: 8px; align-items: end; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafafb; font-size: 11px; }
.vat-rate-row strong { font-size: 11px; }
.vat-rate-row .vat-country { align-self: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vat-rate-row label { display: grid; gap: 3px; }
.vat-rate-row small { color: var(--muted); font-size: 8px; }
.vat-rate-row input { width: 100%; padding: 7px 8px; text-align: right; }
.tax-preview { grid-column: 1 / -1; padding: 13px 14px; border: 1px solid #dedafa; border-radius: 11px; background: #f7f5ff; color: #4e43aa; font-size: 12px; line-height: 1.5; }
.address-choice { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.address-choice.is-disabled { opacity: .72; }
.address-choice textarea[readonly], .address-choice select:disabled { background: #f4f4f7; color: #666a73; }
.paper-footer-data { margin: 25px 0 32px; }
.paper-bottom-grid { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 35px; align-items: start; }
.paper-bottom-grid-single { grid-template-columns: 1fr; }
.paper-shipping { padding: 15px; border-radius: 10px; background: #f7f7f9; font-size: 10px; line-height: 1.65; }
.paper-shipping small { color: var(--muted); font-weight: 800; letter-spacing: .08em; }

.bank-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.bank-account { position: relative; overflow: hidden; min-height: 174px; padding: 22px; color: white; border-radius: 17px; background: linear-gradient(135deg, #292353, #6558d8); }
.bank-account:after { position: absolute; right: -30px; bottom: -80px; width: 190px; height: 190px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; content: ""; }
.bank-account small { color: rgba(255,255,255,.65); }
.bank-account h3 { margin: 9px 0 28px; font-size: 16px; }
.bank-account strong { font-size: 24px; }
.bank-account p { margin: 8px 0 0; color: rgba(255,255,255,.7); font-size: 11px; letter-spacing: .08em; }
.bank-card-logo { position: absolute; z-index: 1; top: 18px; right: 18px; width: 72px; height: 30px; padding: 4px; border-radius: 7px; background: white; object-fit: contain; }
.add-account { display: grid; min-height: 174px; place-items: center; border: 1px dashed #cfd1d8; border-radius: 17px; background: white; color: #696d76; cursor: pointer; }
.company-bank-section { margin-top: 14px; }
.company-users-section { margin-top: 14px; }
.company-user-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.company-user-item { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafafb; }
.company-user-item > div { display: grid; flex: 1; gap: 3px; min-width: 0; }
.company-user-item small, .company-user-item div span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar { display: grid; flex: 0 0 auto; width: 40px; height: 40px; place-items: center; border-radius: 12px; color: #5549c8; background: #eeecff; font-size: 11px; font-weight: 850; }
.password-help { margin-top: 5px; padding: 13px 14px; border: 1px solid #e3e0fa; border-radius: 11px; background: #f8f7ff; }
.password-help p { margin: 5px 0 0; font-size: 11px; }
.company-bank-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.company-bank-item { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafafb; }
.company-bank-item img, .bank-logo-placeholder { display: grid; flex: 0 0 auto; width: 66px; height: 38px; place-items: center; padding: 5px; border: 1px solid #e1e2e7; border-radius: 8px; background: white; object-fit: contain; }
.company-bank-item div { display: grid; flex: 1; gap: 3px; min-width: 0; }
.company-bank-item small, .company-bank-item span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.compact-empty { grid-column: 1 / -1; padding: 28px 15px; }
.bank-logo-upload { display: flex; align-items: center; gap: 16px; margin-bottom: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafafb; }
.bank-logo-preview { display: grid; flex: 0 0 auto; width: 116px; height: 64px; place-items: center; overflow: hidden; border: 1px dashed #cfd1d8; border-radius: 10px; background: white; color: #6357d8; font-size: 24px; }
.bank-logo-preview img { width: 100%; height: 100%; padding: 6px; object-fit: contain; }
.bank-edit-button { position: absolute; z-index: 2; right: 16px; bottom: 14px; padding: 6px 9px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; color: white; background: rgba(255,255,255,.12); cursor: pointer; font-size: 10px; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(21,22,29,.42); backdrop-filter: blur(5px); }
.modal { width: min(700px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: 18px; background: white; box-shadow: var(--shadow); }
.modal-large { width: min(920px, 100%); }
.modal-head, .modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head button { border: 0; background: transparent; cursor: pointer; font-size: 24px; }
.modal-body { padding: 22px; }
.modal-foot { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
.line-editor { display: grid; grid-template-columns: 1.7fr .55fr .6fr .75fr 34px; gap: 8px; margin-bottom: 8px; }
.line-editor input, .line-editor select { padding: 9px; }
.line-editor button { border: 1px solid #e3e4e8; border-radius: 8px; background: white; cursor: pointer; }
.line-product-picker { position: relative; grid-column: 1 / -1; }
.line-product-results { display: grid; max-height: 280px; margin-top: 5px; overflow: auto; border: 1px solid #dedfe4; border-radius: 11px; background: white; box-shadow: 0 12px 28px rgba(22,24,32,.12); }
.line-product-result { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 13px; border: 0 !important; border-bottom: 1px solid #ececf0 !important; border-radius: 0 !important; text-align: left; }
.line-product-result:last-child { border-bottom: 0 !important; }
.line-product-result:hover, .line-product-result:focus { background: #f5f3ff; }
.line-product-result span { display: grid; gap: 3px; min-width: 0; }
.line-product-result strong { color: #5146bd; font-size: 11px; }
.line-product-result small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #34363d; }
.line-product-result b { flex: 0 0 auto; font-size: 12px; }
.line-product-empty { padding: 14px; color: var(--muted); font-size: 12px; text-align: center; }
.form-section-title { margin: 10px 0 12px; font-size: 12px; }

.document-view { padding: 36px; }
.paper { max-width: 820px; margin: 0 auto; padding: 56px; border: 1px solid #e5e5e8; background: white; box-shadow: 0 18px 45px rgba(20,22,29,.08); }
.paper-head { display: flex; justify-content: space-between; gap: 30px; margin-bottom: 55px; }
.paper-logo { display: grid; place-items: center; width: 184px; height: 110px; overflow: hidden; background: transparent; color: #5f50de; font-size: 32px; font-weight: 850; }
.paper-logo img { width: 100%; height: 100%; object-fit: contain; }
.paper-company { text-align: right; font-size: 11px; line-height: 1.65; }
.paper-title { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 35px; }
.paper-title h1 { margin: 0; font-size: 34px; letter-spacing: -.04em; }
.paper-title p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.paper-reference { display: block; margin-top: 10px; color: #4f46b8; font-size: 11px; }
.document-copy-label { margin-top: 12px; color: #25272d; font-size: 17px; font-weight: 900; letter-spacing: .12em; }
.paper-address { margin-bottom: 35px; font-size: 12px; line-height: 1.7; }
.paper table { width: 100%; border-collapse: collapse; }
.paper th { padding: 10px 8px; border-bottom: 2px solid #22242a; font-size: 9px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.paper td { padding: 13px 8px; border-bottom: 1px solid #e5e5e8; font-size: 11px; }
.paper .numeric { text-align: right; }
.paper-totals { display: grid; align-self: start; gap: 8px; width: 270px; margin: 0 0 0 auto; font-size: 11px; }
.paper-totals > div { display: flex; justify-content: space-between; }
.paper-totals .grand { padding-top: 10px; border-top: 2px solid #22242a; font-size: 15px; font-weight: 850; }
.paper-totals .paper-payment-state { display: grid; justify-content: stretch; gap: 3px; margin-top: 5px; padding: 10px 12px; border-radius: 9px; font-size: 11px; }
.paper-payment-state.is-paid { color: #127a49; background: #e9f8ef; }
.paper-payment-state.is-partial { color: #176da9; background: #e9f4ff; }
.paper-payment-state small { font-size: 10px; font-weight: 600; }
.payment-history { max-width: 760px; margin: 0 auto 18px; padding: 15px 18px; border: 1px solid #e0e4ed; border-radius: 12px; background: #fff; }
.payment-history > div { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 11px; }
.payment-history > div:first-child { justify-content: space-between; padding-top: 0; }
.payment-history > div + div { border-top: 1px solid #eff0f3; }
.payment-history > div > span { flex: 1; color: #686c78; }
.payment-history > div > strong { white-space: nowrap; }
.payment-history p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.payment-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.payment-overview > div { display: grid; gap: 7px; padding: 13px; border: 1px solid #e6e7ee; border-radius: 10px; }
.payment-overview > div:last-child { border-color: #bcd9f3; background: #f1f8ff; }
.payment-overview span { color: #6c7180; font-size: 10px; }
.payment-overview strong { font-size: 14px; white-space: nowrap; }
.partial-payment-fields { display: grid; grid-template-columns: 1fr 150px 160px; gap: 12px; align-items: end; margin-bottom: 15px; padding: 15px; border: 1px solid #bfdcf7; border-radius: 12px; background: #f2f8ff; }
.partial-payment-fields.hidden { display: none; }
.partial-payment-fields strong, .partial-payment-fields small { display: block; }
.partial-payment-fields small { margin-top: 4px; color: #5e7488; font-size: 10px; line-height: 1.4; }
.partial-payment-fields label { margin: 0; font-size: 11px; }
.invoice-import-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.invoice-import-heading .form-section-title { margin: 0; }
.amazon-settings-card { margin-top: 20px; }
.amazon-settings-card .card-head { align-items: flex-start; }
.amazon-settings-card .card-head h2 { margin-top: 4px; }
.amazon-settings-card .card-head p { max-width: 730px; line-height: 1.5; }
.amazon-settings-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 18px; }
.amazon-settings-form .switch-row { flex: 1 1 360px; margin: 0; }
.amazon-settings-form > label:not(.switch-row) { display: grid; gap: 6px; min-width: 160px; font-size: 11px; font-weight: 700; }
.amazon-settings-form input[type=number] { width: 100%; height: 39px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.amazon-settings-form small { color: var(--muted); font-size: 10px; font-weight: 400; }
.amazon-settings-note { margin: 16px 0 0; color: #a76e0b; font-size: 11px; }
.amazon-picker-overlay { position: fixed; z-index: 150; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(17, 20, 31, .65); backdrop-filter: blur(4px); }
.amazon-picker-window { display: flex; flex-direction: column; width: min(850px, 100%); max-height: calc(100vh - 40px); overflow: hidden; border-radius: 18px; background: #fff; box-shadow: 0 25px 75px rgba(0,0,0,.24); }
.amazon-picker-head { display: flex; justify-content: space-between; gap: 12px; padding: 23px 26px 16px; border-bottom: 1px solid var(--line); }
.amazon-picker-head h2 { margin: 5px 0; font-size: 22px; }
.amazon-picker-head p { margin: 0; color: var(--muted); font-size: 11px; }
.amazon-picker-search { padding: 14px 26px; border-bottom: 1px solid var(--line); }
.amazon-picker-search input { width: 100%; height: 42px; padding: 10px 13px; border: 1px solid #dfe1eb; border-radius: 10px; font-size: 12px; }
.amazon-picker-content { overflow: auto; padding: 18px 26px 26px; }
.amazon-shipment-list { display: grid; gap: 13px; }
.amazon-shipment-card { padding: 16px; border: 1px solid #e1e3eb; border-radius: 13px; background: #fff; }
.amazon-shipment-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.amazon-shipment-top strong, .amazon-shipment-top small { display: block; }
.amazon-shipment-top strong { font-size: 14px; }
.amazon-shipment-top small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.amazon-shipment-meta { display: flex; flex-wrap: wrap; gap: 10px 17px; margin: 12px 0; color: #6c7080; font-size: 10px; }
.amazon-shipment-items { overflow: hidden; margin-bottom: 13px; border: 1px solid #ececf2; border-radius: 9px; }
.amazon-shipment-items > div { display: grid; grid-template-columns: minmax(90px, .8fr) minmax(0, 2fr) auto; gap: 12px; padding: 8px 11px; font-size: 10px; }
.amazon-shipment-items > div + div { border-top: 1px solid #f0f0f4; }
.amazon-shipment-items > div:nth-child(even) { background: #fbfbfe; }
.amazon-shipment-items span { color: #6556bf; font-weight: 750; }
.amazon-shipment-items strong { overflow: hidden; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.amazon-picker-error { padding: 17px; border: 1px solid #f0cbd0; border-radius: 10px; color: #a42e3b; background: #fff6f7; font-size: 12px; }
.amazon-import-warning { margin: 10px 0 12px; padding: 11px 13px; border: 1px solid #edd297; border-radius: 9px; color: #8f620b; background: #fff9e9; font-size: 11px; }
.paper-note { padding: 16px; border-radius: 10px; background: #f7f7f9; color: #646872; font-size: 10px; line-height: 1.6; }
.paper-bank { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 10px 13px; border: 1px solid #e5e5e9; border-radius: 10px; font-size: 9px; line-height: 1.45; }
.paper-bank-logo { flex: 0 0 auto; width: 74px; height: 38px; object-fit: contain; }
.paper-bank strong { font-size: 10px; }
.document-actions { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; }

.toast { position: fixed; z-index: 200; right: 24px; bottom: 24px; max-width: 380px; padding: 13px 16px; border-radius: 12px; color: white; background: #25272d; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(12px); transition: .25s; font-size: 12px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b93642; }

@media (max-width: 1050px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .logo-card { display: grid; grid-template-columns: 190px 1fr; align-items: center; text-align: left; }
  .bank-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .product-image-panel { grid-template-columns: 1fr; }
  .partial-payment-fields, .payment-overview { grid-template-columns: 1fr; }
  .amazon-picker-overlay { padding: 8px; }
  .amazon-picker-window { max-height: calc(100vh - 16px); }
  .amazon-picker-head, .amazon-picker-search, .amazon-picker-content { padding-left: 16px; padding-right: 16px; }
  .amazon-shipment-items > div { grid-template-columns: minmax(60px, 1fr) minmax(0, 2fr) auto; gap: 6px; }
  .invoice-import-heading { flex-wrap: wrap; }
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .mobile-brand { display: flex; }
  .login-panel { min-height: 100vh; padding: 28px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; left: -250px; width: 236px; transition: left .2s; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  #mobile-nav { display: inline-block; }
  .topbar { padding: 0 16px; }
  .top-actions #global-create { display: none; }
  .page { padding: 20px 14px; }
  .metrics { grid-template-columns: 1fr; }
  .bank-grid { grid-template-columns: 1fr; }
  .company-bank-grid { grid-template-columns: 1fr; }
  .company-user-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .logo-card { display: block; text-align: center; }
  .table-card { overflow-x: auto; }
  .data-table { min-width: 760px; }
  .page-head { align-items: stretch; flex-direction: column; }
  .line-editor { grid-template-columns: 1fr 1fr; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .line-editor > :first-child { grid-column: 1 / -1; }
  .paper { padding: 28px; }
  .vat-grid { grid-template-columns: 1fr; }
  .vat-rate-row { grid-template-columns: 30px minmax(70px, 1fr) 76px 112px; }
  .address-choice { grid-template-columns: 1fr; }
  .paper-bottom-grid { grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; }
  .paper-bottom-grid-single { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { width: 210mm; min-height: 0; margin: 0; padding: 0; background: white; }
  body > * { display: none !important; }
  body > #modal-root { display: block !important; }
  #modal-root:empty { display: none !important; }
  .modal-backdrop { position: static; display: block; width: 210mm; min-height: 0; padding: 0; background: white; backdrop-filter: none; }
  .modal { width: 210mm; max-height: none; margin: 0; overflow: visible; border-radius: 0; box-shadow: none; }
  .modal-head, .document-actions, .payment-history { display: none; }
  .document-view { padding: 0; }
  .paper { width: 210mm; max-width: none; margin: 0; padding: 14mm 16mm; border: 0; box-shadow: none; break-after: auto; break-inside: avoid; page-break-after: auto; page-break-inside: avoid; }
  .paper-head { margin-bottom: 30px; }
  .paper-title, .paper-address { margin-bottom: 24px; }
  .paper-footer-data { margin: 18px 0 22px; }
  .paper-bottom-grid { grid-template-columns: minmax(0, 1fr) 62mm !important; gap: 9mm; }
  .paper-bottom-grid-single { grid-template-columns: 1fr !important; }
  .paper-totals { width: 62mm; }
  .paper-bank { break-inside: avoid; page-break-inside: avoid; }
}
