:root {
  --navy: #071a3a;
  --navy-2: #0d2b57;
  --red: #c90018;
  --red-dark: #a50014;
  --ink: #152033;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --canvas: #f4f6f9;
  --success: #067647;
  --warning: #b54708;
  --danger: #b42318;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(7, 26, 58, 0.12);
}

* { box-sizing: border-box; }
*[hidden] { display: none !important; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 75% 20%, rgba(201,0,24,.12), transparent 30%), linear-gradient(145deg, #06152f, #0e2b55 60%, #091c3c); }
.auth-card { width: min(100%, 980px); display: grid; grid-template-columns: 1.08fr .92fr; background: var(--surface); border-radius: 24px; overflow: hidden; box-shadow: 0 30px 90px rgba(0,0,0,.32); }
.auth-brand { position: relative; min-height: 560px; padding: 42px; display: flex; flex-direction: column; justify-content: flex-end; color: white; background: #11151e; }
.auth-brand::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,12,26,.12), rgba(5,12,26,.82)); }
.auth-brand-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center; background: white; }
.auth-brand-copy { position: relative; z-index: 1; }
.auth-kicker { margin: 0 0 10px; color: #ffbac2; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: 12px; }
.auth-brand h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); line-height: 1.05; }
.auth-brand p { max-width: 46ch; margin: 16px 0 0; color: #d4dbea; line-height: 1.6; }
.auth-form { padding: 56px 48px; align-self: center; }
.auth-form h2 { font-size: 30px; margin: 0 0 8px; color: var(--navy); }
.auth-subtitle { color: var(--muted); margin: 0 0 30px; line-height: 1.5; }

.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 700; color: #344054; }
.form-control, .field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; min-height: 46px; border: 1px solid #cfd4dc; border-radius: 10px; padding: 10px 12px; color: var(--ink); background: white; outline: none; transition: border .15s, box-shadow .15s; }
.form-control:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: #315e9c; box-shadow: 0 0 0 4px rgba(49,94,156,.13); }
.form-control:disabled, .field input:disabled, .field select:disabled { background: #f2f4f7; color: #667085; }
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 52px; }
.password-toggle { position: absolute; right: 5px; top: 5px; height: 36px; min-width: 40px; border: 0; border-radius: 8px; background: transparent; color: #475467; cursor: pointer; }
.password-toggle:hover { background: #f2f4f7; }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 4px 0 22px; font-size: 14px; }
.checkbox-line { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; color: #344054; }
.checkbox-input { width: 18px; height: 18px; accent-color: var(--red); }
.text-link { color: #174a86; font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.btn { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .12s, background .12s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: white; background: var(--red); }
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary { color: var(--navy); background: #eaf0f7; }
.btn-danger { color: white; background: var(--danger); }
.btn-block { width: 100%; }
.errorlist { margin: 7px 0 0; padding: 0; list-style: none; color: var(--danger); font-size: 13px; font-weight: 700; }
.form-errors { padding: 12px 14px; margin-bottom: 18px; border-radius: 10px; color: #912018; background: #fef3f2; border: 1px solid #fecdca; }
.helptext { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); transition: grid-template-columns .26s cubic-bezier(.4,0,.2,1); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 16px; color: white; background: linear-gradient(180deg, var(--navy), #061329); overflow-x: hidden; overflow-y: auto; transition: padding .26s cubic-bezier(.4,0,.2,1); }
.brand-link { display: flex; align-items: center; gap: 12px; padding: 0 8px 20px; text-decoration: none; }
.brand-thumb { flex: 0 0 auto; width: 82px; height: 36px; border-radius: 8px; object-fit: contain; background: white; border: 1px solid rgba(255,255,255,.2); transition: width .26s cubic-bezier(.4,0,.2,1); }
.brand-name, .nav-label, .nav-group summary > span:nth-child(2), .nav-chevron, .nav-badge { max-width: 190px; opacity: 1; overflow: hidden; white-space: nowrap; transform: translateX(0); visibility: visible; transition: max-width .22s cubic-bezier(.4,0,.2,1), opacity .16s ease, transform .22s ease, visibility 0s; }
.brand-name strong, .brand-name span { display: block; }
.brand-name strong { font-size: 18px; }
.brand-name span { color: #a9b8cf; font-size: 12px; }
.nav-section { margin: 18px 10px 8px; color: #7f96b7; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; margin: 3px 0; padding: 10px 12px; border-radius: 10px; color: #dbe5f4; text-decoration: none; font-weight: 650; }
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,.10); }
.nav-accordion { display: grid; gap: 5px; }
.nav-link-primary { margin-bottom: 5px; }
.nav-group { border-radius: 11px; overflow: hidden; }
.nav-group summary { min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: #dbe5f4; border-radius: 10px; cursor: pointer; font-weight: 750; list-style: none; user-select: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover, .nav-group[open] > summary { color: white; background: rgba(255,255,255,.10); }
.nav-chevron { margin-left: auto; color: #91a4c0; font-size: 20px; line-height: 1; transition: transform .15s; }
.nav-group[open] .nav-chevron { transform: rotate(90deg); }
.nav-submenu { display: grid; gap: 2px; max-height: 480px; padding: 4px 8px 8px 46px; opacity: 1; overflow: hidden; transition: max-height .22s ease, opacity .16s ease, padding .22s ease; }
.nav-submenu a { padding: 8px 10px; border-radius: 8px; color: #aebed4; text-decoration: none; font-size: 13px; font-weight: 650; }
.nav-submenu a:hover { color: white; background: rgba(255,255,255,.08); }
.nav-link.disabled { cursor: not-allowed; opacity: .55; }
.nav-link.disabled small { margin-left: auto; font-size: 10px; }
.nav-icon { width: 22px; text-align: center; color: #ff7b8b; }
.sidebar-footer { margin-top: 28px; padding: 14px 10px 4px; border-top: 1px solid rgba(255,255,255,.1); color: #91a4c0; font-size: 12px; }
.app-main { min-width: 0; }
.topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 28px; background: white; border-bottom: 1px solid var(--line); }
.menu-toggle { display: none; border: 0; background: #edf2f7; border-radius: 10px; min-width: 42px; min-height: 42px; cursor: pointer; }
.sidebar-collapse { display: inline-grid; place-items: center; border: 0; background: #edf2f7; color: var(--navy); border-radius: 10px; min-width: 42px; min-height: 42px; cursor: pointer; }
.global-search { flex: 1; max-width: 680px; position: relative; }
.global-search input { width: 100%; min-height: 44px; padding: 10px 14px 10px 42px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.global-search span { position: absolute; left: 15px; top: 12px; color: var(--muted); }
.account-menu { display: flex; align-items: center; gap: 12px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--navy); font-weight: 800; }
.account-copy strong, .account-copy span { display: block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.account-copy span { font-size: 12px; color: var(--muted); }
.logout-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; }
.content { padding: 30px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 24px; }
.page-header h1 { margin: 0; color: var(--navy); font-size: 30px; }
.page-header p { margin: 7px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.grid { display: grid; gap: 18px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: white; border: 1px solid #e6e9ee; border-radius: var(--radius); box-shadow: 0 4px 18px rgba(16,24,40,.04); }
.card-body { padding: 22px; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.stat-value { margin: 8px 0 3px; color: var(--navy); font-size: 28px; font-weight: 850; }
.stat-note { color: var(--success); font-size: 12px; font-weight: 700; }
.stat-label, .stat-value, .stat-note { display: block; }
.kpi-card .stat-value { white-space: nowrap; }
.phase-banner { margin-top: 20px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; padding: 26px; color: white; background: linear-gradient(115deg, var(--navy), #174a86); border-radius: var(--radius); }
.phase-banner h2 { margin: 0 0 8px; }
.phase-banner p { margin: 0; color: #d6e1f0; line-height: 1.55; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status-active { color: #05603a; background: #dcfae6; }
.status-inactive { color: #912018; background: #fee4e2; }
.messages { margin: 0 0 20px; padding: 0; list-style: none; }
.message { padding: 12px 15px; border-radius: 10px; background: #ecfdf3; color: #05603a; border: 1px solid #abefc6; }
.message.error { color: #912018; background: #fef3f2; border-color: #fecdca; }
.table-card { overflow: hidden; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 13px 16px; color: #475467; background: #f8fafc; font-size: 12px; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.table-link { color: #174a86; font-weight: 800; text-decoration: none; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; }
.inline-form { display: inline; }
.link-button { padding: 0; border: 0; color: var(--danger); background: none; font: inherit; font-weight: 700; cursor: pointer; }
.danger-link { color: var(--danger) !important; }
.master-data-list li { align-items: center; gap: 14px; }
.master-data-list li > div:first-child { min-width: 0; }
.master-data-list .inline-actions { flex: 0 0 auto; justify-content: flex-end; }
.form-card { max-width: 1080px; }
.form-card .card-body { padding: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.permission-section { padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.permission-section h3 { margin: 0 0 12px; color: var(--navy); font-size: 15px; }
.permission-option { display: flex; gap: 9px; align-items: flex-start; padding: 7px 0; font-size: 14px; }
.callout { padding: 13px 15px; border: 1px solid #fedf89; border-radius: 10px; color: #93370d; background: #fffaeb; line-height: 1.45; }
.backup-warning { padding: 8px 24px; border-bottom: 1px solid #fdb022; color: #7a2e0e; background: #fffaeb; font-size: 13px; }
.backup-warning a { color: #7a2e0e; font-weight: 800; text-decoration: underline; }
.empty-state { padding: 44px; text-align: center; color: var(--muted); }
.event-json { max-width: 380px; white-space: pre-wrap; word-break: break-word; font: 12px/1.4 ui-monospace, monospace; color: #475467; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 18px; padding: 16px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.filter-bar .field { margin: 0; min-width: 170px; flex: 1; }
.filter-bar .search-field { flex: 2; min-width: 260px; }
.filter-bar .number-search-mode { min-width: 220px; flex: 1.5; }
.number-search-mode { min-width: 0; max-width: 100%; }
.number-search-mode select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.number-match { display: block; overflow-wrap: anywhere; margin-top: 3px; }
.product-cell { display: flex; align-items: center; gap: 12px; min-width: 250px; }
.product-thumb { width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center; object-fit: cover; border-radius: 10px; color: #667085; background: #edf1f6; border: 1px solid var(--line); font-weight: 900; }
.number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stock-good { color: var(--success); font-weight: 800; }
.stock-zero { color: var(--danger); font-weight: 800; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; border-top: 1px solid var(--line); }
.product-hero { display: grid; grid-template-columns: 220px 1fr; gap: 26px; padding: 24px; }
.product-main-image { width: 220px; height: 180px; object-fit: cover; border-radius: 14px; background: #edf1f6; border: 1px solid var(--line); }
.product-image-placeholder { width: 220px; height: 180px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(145deg,#edf2f7,#dce4ee); color: #667085; font-weight: 800; }
.product-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.product-title-row h1 { margin: 4px 0 8px; color: var(--navy); font-size: 30px; }
.product-sku { color: var(--red); font-weight: 850; letter-spacing: .06em; }
.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-top: 22px; }
.metric { padding: 14px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line); }
.metric span, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong { margin-top: 5px; color: var(--navy); font-size: 20px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 22px 0 16px; padding: 5px; background: #e9eef5; border-radius: 12px; }
.tab { padding: 9px 13px; border-radius: 8px; white-space: nowrap; color: #475467; text-decoration: none; font-size: 13px; font-weight: 800; }
.tab:hover { color: var(--navy); background: white; }
.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.detail-list { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; margin: 0; }
.detail-list dt { color: var(--muted); font-weight: 700; }
.detail-list dd { margin: 0; font-weight: 650; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-title h2 { margin: 0; color: var(--navy); font-size: 20px; }
.identifier-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.identifier-chip { padding: 7px 10px; border-radius: 8px; color: #344054; background: #f2f4f7; font: 13px ui-monospace, monospace; }
.formset-row { display: grid; grid-template-columns: 180px 1fr auto; gap: 12px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--line); }
.formset-row.images { grid-template-columns: 1fr 1fr auto auto; }
.warning-box { margin-bottom: 18px; padding: 16px; border: 1px solid #fdb022; border-radius: 12px; color: #7a2e0e; background: #fffaeb; }
.warning-box h3 { margin: 0 0 8px; }
.warning-box ul { margin: 0 0 12px; }
.danger-reset-warning { border-color: #f04438; color: #7a271a; background: #fff4f2; }
.danger-reset-warning p { margin: 8px 0 0; line-height: 1.55; }
.danger-reset-card { border-color: #fda29b; }
.location-code { font: 800 13px ui-monospace, monospace; color: var(--navy); }
.operation-card { max-width: 760px; }
.operation-summary { padding: 14px 16px; margin-bottom: 18px; border-radius: 10px; color: #344054; background: #f2f4f7; }
.movement-positive { color: var(--success); font-weight: 850; }
.movement-negative { color: var(--danger); font-weight: 850; }
.master-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.compact-list { margin: 16px 0 0; padding: 0; list-style: none; max-height: 360px; overflow: auto; }
.compact-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.section-gap { margin-top: 20px; }
.eyebrow { display: block; margin-bottom: 7px; color: var(--red); font-size: 12px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; display: grid; place-items: center; border-radius: 999px; color: white; background: var(--red); font-size: 11px; }
.notification-button { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--navy); background: #edf2f7; text-decoration: none; font-weight: 900; }
.notification-button span { position: absolute; right: -4px; top: -5px; min-width: 19px; height: 19px; padding: 0 4px; display: grid; place-items: center; border-radius: 99px; color: white; background: var(--red); font-size: 10px; }
.line-form-grid { display: grid; grid-template-columns: minmax(220px,2fr) repeat(4,minmax(120px,1fr)); gap: 12px; align-items: end; padding: 14px 0; border-top: 1px solid var(--line); }
.line-form-grid .field { margin: 0; }
.invoice-line-form { display: grid; grid-template-columns: 1.3fr .8fr 2fr repeat(4,.72fr) auto; gap: 10px; align-items: end; padding: 14px 0; border-top: 1px solid var(--line); }
.invoice-line-form .field { margin: 0; }
.finance-stats { grid-template-columns: repeat(5,minmax(0,1fr)); }
.integration-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.integration-card h2 { margin: 3px 0 0; color: var(--navy); font-size: 20px; }
.status-draft { color: #344054; background: #eaecf0; }
.status-issued, .status-sent { color: #175cd3; background: #eff8ff; }
.status-partially_paid { color: #93370d; background: #fffaeb; }
.status-paid, .status-accepted { color: #05603a; background: #dcfae6; }
.status-credited, .status-rejected { color: #6941c6; background: #f4f3ff; }
.status-ordered, .status-in-progress { color: #175cd3; background: #eff8ff; }
.status-partially_received, .status-overdue, .status-review { color: #93370d; background: #fffaeb; }
.status-received, .status-posted, .status-completed, .status-fulfilled { color: #05603a; background: #dcfae6; }
.status-cancelled, .status-expired, .status-released, .status-reversed { color: #912018; background: #fee4e2; }
.compact-stats .card-body { min-height: 105px; }
.scanner-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; }
.scanner-panel .card-body, .camera-panel .card-body { padding: 28px; }
.scanner-stepper { display: flex; gap: 8px; margin-bottom: 24px; }
.scanner-stepper span { flex: 1; padding: 9px; border-radius: 8px; color: var(--muted); background: #f2f4f7; font-size: 12px; text-align: center; font-weight: 800; }
.scanner-stepper .active { color: white; background: var(--navy); }
.scan-input-label { display: block; margin-bottom: 10px; color: var(--navy); font-weight: 800; }
.scan-input-row { display: flex; align-items: center; gap: 10px; }
.scan-input { width: 100%; min-height: 62px; padding: 12px 16px; border: 2px solid #98a2b3; border-radius: 12px; font-size: 22px; font-weight: 750; outline: none; }
.scan-input:focus { border-color: var(--red); box-shadow: 0 0 0 5px rgba(201,0,24,.1); }
.scan-result { min-height: 130px; margin-top: 18px; padding: 20px; display: flex; flex-direction: column; justify-content: center; gap: 7px; border: 1px dashed #98a2b3; border-radius: 14px; background: #f8fafc; }
.scan-result strong { color: var(--navy); font-size: 20px; }.scan-result span { color: var(--muted); }.scan-result div { margin-top: 8px; }
.scan-result.success { border-style: solid; border-color: #75e0a7; background: #ecfdf3; }.scan-result.warning { border-style: solid; border-color: #fec84b; background: #fffaeb; }.scan-result.error { border-style: solid; border-color: #fda29b; background: #fef3f2; }
.scan-choices { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 12px; }
.scan-choice { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; overflow-wrap: anywhere; }
.scan-choice a { font-weight: 700; display: inline-block; padding: 5px 0; }
.scan-choice small { display: block; margin-top: 5px; }
@media (max-width: 480px) { .filter-bar .number-search-mode, .filter-bar .search-field { min-width: 0; flex-basis: 100%; } }
.scanner-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.camera-reader { min-height: 280px; margin: 16px 0; display: grid; place-items: center; overflow: hidden; border-radius: 14px; color: var(--muted); background: #111827; }
.camera-reader video { width: 100% !important; }
.scanner-device-stack { display: grid; gap: 20px; }
.scanner-device-steps { margin: 14px 0 18px; padding-left: 22px; color: var(--muted); line-height: 1.6; }
.scanner-auto-submit { margin-top: 12px; color: var(--muted); font-size: 13px; }
.handscanner-panel .card-body { padding: 24px 28px; }
.dashboard-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; }
.quick-actions { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.quick-action { padding: 20px; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; border: 1px solid var(--line); border-radius: 14px; color: var(--navy); background: white; text-decoration: none; box-shadow: 0 4px 18px rgba(16,24,40,.04); }
.quick-action > span { grid-row: span 2; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; color: white; background: var(--red); font-size: 22px; }.quick-action small { color: var(--muted); }
.report-card-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.report-card { color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }.report-card h2 { margin: 12px 0 7px; color: var(--navy); font-size: 18px; }.report-card p { margin: 0; color: var(--muted); line-height: 1.5; }.report-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--red); font-size: 20px; }
.notification-list { display: grid; gap: 12px; }.notification-item .card-body { display: flex; justify-content: space-between; align-items: center; gap: 20px; }.notification-item h2 { margin: 10px 0 5px; color: var(--navy); font-size: 18px; }.notification-item p { margin: 0 0 8px; color: var(--muted); }.notification-item.is-read { opacity: .65; }.severity-critical { border-left: 5px solid var(--danger); }.severity-warning { border-left: 5px solid #f79009; }.severity-info { border-left: 5px solid #2e90fa; }
.inventory-inline { display: contents; }
.offline { color: #fda29b; font-weight: 800; }

/* Dokumenteditor mit echter, druckbarer A4-Vorschau */
.document-toolbar { position: sticky; z-index: 12; top: 0; margin: -30px -30px 24px; padding: 10px 18px; display: flex; align-items: center; flex-wrap: wrap; gap: 9px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); box-shadow: 0 5px 18px rgba(7,26,58,.06); backdrop-filter: blur(12px); }
.document-toolbar > span { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 750; }
.document-editor-layout { display: grid; grid-template-columns: minmax(560px, .95fr) minmax(620px, 1.05fr); gap: 24px; align-items: start; }
.document-editor-fields, .settings-stack { display: grid; gap: 18px; }
.editor-section h2, .settings-stack h2 { margin: 0 0 20px; color: var(--navy); font-size: 20px; }
.editor-section h3 { margin: 12px 0 16px; color: var(--navy); font-size: 16px; }
.settings-three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.document-preview-pane { position: sticky; top: 82px; min-width: 0; padding: 18px; overflow: auto; border-radius: 16px; background: #e9edf2; box-shadow: inset 0 0 0 1px #dde3eb; }
.document-sheet { width: 100%; min-height: min(78vw, 1080px); aspect-ratio: 210 / 297; padding: 7.5%; display: flex; flex-direction: column; color: #071a3a; background: white; box-shadow: 0 8px 28px rgba(15,23,42,.15); font-size: clamp(7px,.58vw,11px); }
.preview-letterhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; }
.preview-letterhead img { width: 38%; height: auto; max-height: 92px; object-fit: contain; object-position: left top; }
.preview-letterhead > div { display: grid; justify-items: end; gap: 3px; text-align: right; }
.preview-address-meta { margin-top: 7%; display: grid; grid-template-columns: 1fr .8fr; gap: 8%; }
.preview-address-meta small { display: block; padding-bottom: 8px; border-bottom: 1px solid #aebdd0; color: #536b8d; }
.preview-address-meta p { white-space: pre-line; font-size: 1.25em; line-height: 1.45; }
.preview-address-meta h2 { margin: 4px 0 18px; text-align: right; font-size: 2.4em; letter-spacing: .04em; }
.preview-address-meta dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 15px; margin: 0; }
.preview-address-meta dd { margin: 0; text-align: right; font-weight: 750; }
.preview-contact-info { margin-top: 18px; padding-top: 12px; border-top: 1px solid #d0d9e6; color: #101828; font-size: .95em; line-height: 1.55; }
.preview-contact-line { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.preview-contact-line strong { color: #101828; }
.preview-intro { margin: 8% 0 3%; white-space: pre-line; line-height: 1.5; }
.preview-items { table-layout: fixed; font-size: 1em; }
.preview-items th { padding: 9px 7px; color: white; background: #123f70; font-size: .8em; }
.preview-items th:nth-child(1) { width: 7%; }.preview-items th:nth-child(2) { width: 40%; }.preview-items th:nth-child(3) { width: 14%; }.preview-items th:nth-child(4) { width: 16%; }.preview-items th:nth-child(5) { width: 10%; }.preview-items th:nth-child(6) { width: 16%; }
.preview-items td { padding: 10px 7px; white-space: pre-line; vertical-align: top; }
.preview-items td:not(:nth-child(2)) { text-align: right; }
.preview-product-cell { display: grid; grid-template-columns: auto 1fr; gap: 7px; align-items: start; text-align: left; }
.preview-product-cell img { width: 36px; height: 36px; object-fit: contain; border: 1px solid #e4e7ec; border-radius: 4px; }
.preview-product-cell small { color: #667085; }
.preview-totals { width: 43%; margin: 4% 0 0 auto; display: grid; gap: 8px; }
.preview-totals > div { display: flex; justify-content: space-between; gap: 15px; }
.preview-total { padding-top: 10px; border-top: 2px solid #123f70; font-size: 1.35em; }
.preview-closing { margin-top: 4%; white-space: pre-line; line-height: 1.55; }
.preview-payment { margin-top: 5%; line-height: 1.55; }
.preview-footer { margin-top: auto; padding-top: 12px; display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); gap: 12px; border-top: 2px solid #123f70; font-size: .78em; }
.preview-footer div { display: grid; gap: 2px; }.preview-footer strong { margin-bottom: 3px; }
.document-line { margin-top: 14px; padding: 16px; border: 1px solid #d6deea; border-radius: 12px; background: #fbfcfe; }
.document-line-head { margin-bottom: 14px; display: flex; justify-content: space-between; gap: 12px; }
.document-line-actions { display: flex; align-items: center; gap: 7px; }
.line-action-button { min-height: 34px; padding: 6px 10px; border: 1px solid #b9c7d9; border-radius: 8px; color: var(--navy); background: white; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.line-action-button:hover { border-color: var(--navy); background: #eef4fb; }
.line-action-danger { width: 34px; padding: 0; border-color: #f3b8c0; color: var(--danger); font-size: 22px; line-height: 1; }
.line-action-danger:hover { border-color: var(--danger); background: #fff0f2; }
.document-line-add { margin-top: 16px; display: flex; justify-content: stretch; }
.document-line-add .btn { width: 100%; justify-content: center; border-style: dashed; }
.line-product-preview { margin: 0 0 16px; padding: 10px; display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; border: 1px solid #dce4ee; border-radius: 10px; background: white; }
.line-product-image { width: 64px; height: 54px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; color: var(--muted); background: #f1f5f9; font-size: 10px; }.line-product-image img { width: 100%; height: 100%; object-fit: contain; }
.line-product-preview span, .line-product-preview strong { display: block; }.line-product-preview span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.editor-total-box { min-height: 92px; padding: 18px; display: flex; flex-direction: column; justify-content: center; border-radius: 10px; color: var(--navy); background: #eaf0f7; }.editor-total-box span { font-size: 12px; }.editor-total-box strong { margin-top: 6px; font-size: 24px; }
.document-option-row { margin: 4px 0 18px; padding: 14px; display: flex; flex-wrap: wrap; gap: 18px; border-radius: 10px; background: #f7f9fc; }
.alternate-address-fields { margin-top: 6px; padding: 16px 16px 0; border: 1px dashed #c6d1e0; border-radius: 10px; }
.discount-toggle-line { margin-bottom: 16px; }
.settings-tabs { margin-bottom: 22px; display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border-radius: 12px; background: #e7edf5; }.settings-tabs a { padding: 10px 15px; border-radius: 9px; color: #475467; text-decoration: none; font-weight: 800; }.settings-tabs a.active { color: white; background: var(--navy); }
.logo-setting { display: grid; grid-template-columns: 190px 1fr; gap: 20px; align-items: center; }.logo-setting-preview { height: 100px; padding: 10px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; }.logo-setting-preview img { width: 100%; height: 100%; object-fit: contain; }
.document-footer-preview { margin-top: 18px; padding: 18px; display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 16px; border: 1px solid #cfd8e5; border-top: 2px solid var(--navy); border-radius: 10px; background: white; font-size: 11px; }.document-footer-preview div { display: grid; gap: 3px; }.document-footer-preview strong { color: var(--navy); }
.letterhead-preview .preview-letterhead { justify-content: flex-end; }.letterhead-preview .preview-letterhead img { width: 44%; }.letterhead-contact { width: 38%; margin: 2% 0 0 auto; display: flex; flex-direction: column; gap: 3px; line-height: 1.35; }.letterhead-page-space { flex: 1; min-height: 42%; }
.sticky-form-actions { position: sticky; z-index: 8; bottom: 0; padding: 10px 0; background: linear-gradient(transparent, var(--canvas) 20%); }
.receipt-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
.receipt-dialog { width: min(1020px,calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 18px; color: var(--ink); box-shadow: 0 30px 90px rgba(7,26,58,.35); }.receipt-dialog::backdrop { background: rgba(10,20,38,.6); }
.receipt-dialog header { padding: 20px 24px; display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }.receipt-dialog h2, .receipt-dialog h3 { margin: 0; color: var(--navy); }.receipt-dialog header p { margin: 5px 0 0; color: var(--muted); }.receipt-dialog header button { border: 0; color: var(--navy); background: transparent; font-size: 30px; cursor: pointer; }
.receipt-dialog-body { padding: 20px; display: grid; grid-template-columns: .9fr 1.1fr; gap: 20px; }.receipt-dialog-body > section { padding: 20px; border: 1px solid var(--line); border-radius: 14px; }.receipt-dialog footer { padding: 16px 24px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }
.receipt-upload-panel { text-align: center; background: #f7faff; }.receipt-upload-icon { width: 48px; height: 48px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 12px; color: white; background: var(--navy); font-size: 22px; }.receipt-upload-panel p, .receipt-upload-panel small { color: var(--muted); }.receipt-upload-panel .field { margin-top: 18px; padding: 20px; border: 2px dashed #b8c7dc; border-radius: 12px; background: white; }.review-required { color: var(--warning); font-weight: 750; }

html.sidebar-prefers-collapsed .app-shell, body.sidebar-collapsed .app-shell { grid-template-columns: 84px minmax(0,1fr); }
body.sidebar-collapsed .sidebar { padding-inline: 12px; }
body.sidebar-collapsed .brand-name, body.sidebar-collapsed .nav-label, body.sidebar-collapsed .nav-group summary > span:nth-child(2), body.sidebar-collapsed .nav-chevron, body.sidebar-collapsed .nav-badge { max-width: 0; opacity: 0; transform: translateX(-7px); visibility: hidden; transition-delay: 0s,0s,0s,.22s; }
body.sidebar-collapsed .sidebar-footer { opacity: 0; visibility: hidden; transition: opacity .14s, visibility 0s .22s; }
body.sidebar-collapsed .brand-link { padding-inline: 0; justify-content: center; }
body.sidebar-collapsed .brand-thumb { width: 52px; }
body.sidebar-collapsed .nav-group summary, body.sidebar-collapsed .nav-link-primary, body.sidebar-collapsed .install-app { justify-content: center; gap: 0; padding-inline: 4px; }
body.sidebar-collapsed .nav-icon { font-size: 17px; }
body.sidebar-collapsed .nav-submenu { max-height: 0; padding-block: 0; opacity: 0; pointer-events: none; }

.category-groups { display: grid; gap: 14px; }
.category-product-group { overflow: hidden; }
.category-product-group > summary { min-height: 66px; padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--navy); cursor: pointer; list-style: none; user-select: none; }
.category-product-group > summary::-webkit-details-marker { display: none; }
.category-product-group > summary:hover { background: #f8fafc; }
.category-product-group > summary > span { display: flex; align-items: center; gap: 11px; }
.category-folder { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: white; background: var(--navy); }
.category-count { color: var(--muted); font-size: 13px; font-weight: 750; }
.category-chevron { display: inline-block; color: var(--navy); font-size: 24px; transition: transform .18s ease; }
.category-product-group[open] .category-chevron { transform: rotate(90deg); }

@media (max-width: 1350px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .invoice-line-form { grid-template-columns: repeat(4,minmax(120px,1fr)); }
  .invoice-line-form .line-description { grid-column: span 2; }
  .document-editor-layout { grid-template-columns: 1fr; }
  .document-preview-pane { position: relative; top: auto; max-width: 850px; margin-inline: auto; }
  .document-sheet { font-size: clamp(8px,1vw,11px); }
}

@media (max-width: 1050px) {
  .permission-grid { grid-template-columns: 1fr; }
  .metric-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .line-form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .integration-grid { grid-template-columns: 1fr; }
  .report-card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .quick-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .settings-three { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 820px) {
  .auth-card { grid-template-columns: 1fr; max-width: 540px; }
  .auth-brand { min-height: 230px; padding: 28px; }
  .auth-brand p { display: none; }
  .auth-form { padding: 36px 28px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; left: -280px; width: 260px; transition: left .2s; box-shadow: var(--shadow); }
  body.sidebar-open .sidebar { left: 0; }
  .menu-toggle { display: inline-grid; place-items: center; }
  .sidebar-collapse { display: none; }
  .topbar { padding: 0 16px; }
  .account-copy { display: none; }
  .content { padding: 22px 16px; }
  .page-header { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .product-hero { grid-template-columns: 1fr; }
  .detail-grid, .master-grid { grid-template-columns: 1fr; }
  .formset-row, .formset-row.images { grid-template-columns: 1fr; }
  .scanner-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .line-form-grid { grid-template-columns: 1fr; }
  .invoice-line-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .document-toolbar { position: relative; margin: -22px -16px 20px; }
  .document-toolbar .btn { flex: 1 1 180px; }
  .document-toolbar > span { width: 100%; margin-left: 0; }
  .document-preview-pane { margin-inline: -8px; padding: 8px; }
  .document-sheet { font-size: clamp(6px,1.55vw,10px); }
  .logo-setting { grid-template-columns: 1fr; }
  .document-footer-preview { grid-template-columns: repeat(2,1fr); }
  .receipt-dialog-body { grid-template-columns: 1fr; }
  body.sidebar-collapsed .app-shell { grid-template-columns: 1fr; }
  body.sidebar-collapsed .sidebar { padding-inline: 16px; }
  body.sidebar-collapsed .brand-link { padding-inline: 8px; justify-content: flex-start; }
  body.sidebar-collapsed .brand-thumb { width: 82px; }
  body.sidebar-collapsed .brand-name, body.sidebar-collapsed .sidebar-footer,
  body.sidebar-collapsed .nav-group summary > span:not(.nav-icon),
  body.sidebar-collapsed .nav-link-primary { font-size: inherit; }
  body.sidebar-collapsed .nav-group summary { justify-content: flex-start; padding-inline: 12px; }
  body.sidebar-collapsed .nav-submenu { display: grid; }
  body.sidebar-collapsed .brand-name, body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .nav-group summary > span:nth-child(2), body.sidebar-collapsed .nav-chevron,
  body.sidebar-collapsed .nav-badge { max-width: 190px; opacity: 1; transform: none; visibility: visible; }
  body.sidebar-collapsed .sidebar-footer { opacity: 1; visibility: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell, .sidebar, .brand-thumb, .brand-name, .nav-label, .nav-group summary > span:nth-child(2), .nav-chevron, .nav-badge, .nav-submenu { transition: none !important; }
}

@media (max-width: 560px) {
  .auth-shell { padding: 0; }
  .auth-card { min-height: 100vh; border-radius: 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .phase-banner { grid-template-columns: 1fr; }
  .global-search { display: none; }
  .form-row { align-items: flex-start; flex-direction: column; }
  .metric-row { grid-template-columns: 1fr 1fr; }
  .report-card-grid, .quick-actions { grid-template-columns: 1fr; }
  .finance-stats { grid-template-columns: 1fr; }
  .invoice-line-form { grid-template-columns: 1fr; }
  .invoice-line-form .line-description { grid-column: auto; }
  .scan-input-row { align-items: stretch; flex-direction: column; }
  .scan-input { font-size: 18px; }
  .settings-three { grid-template-columns: 1fr; }
  .line-product-preview { grid-template-columns: 54px 1fr; }.line-product-preview > strong:last-child { grid-column: 2; }
  .preview-address-meta { grid-template-columns: 1fr; gap: 12px; }.preview-address-meta h2 { text-align: left; }.preview-address-meta dl { max-width: 70%; }.preview-footer { grid-template-columns: repeat(2,1fr); }.preview-totals { width: 58%; }
  .receipt-stats { grid-template-columns: 1fr; }.receipt-dialog footer { flex-direction: column; }.receipt-dialog footer .btn { width: 100%; }
}

@media print {
  body.printing-document { background: white; }
  body.printing-document .sidebar, body.printing-document .topbar, body.printing-document .backup-warning, body.printing-document .document-toolbar, body.printing-document .document-page-title, body.printing-document .document-editor-fields { display: none !important; }
  body.printing-document .app-shell, body.printing-document .document-editor-layout { display: block; }
  body.printing-document .content { padding: 0; }
  body.printing-document .document-preview-pane { position: static; padding: 0; overflow: visible; background: white; box-shadow: none; }
  body.printing-document .document-sheet { width: 210mm; min-height: 297mm; margin: 0; box-shadow: none; font-size: 9pt; page-break-after: always; }
}
/* Produktauswahl für Rechnungen */
.selection-check { width: 5.5rem; text-align: center; }
.invoice-selection-toolbar {
  position: sticky; bottom: 1rem; z-index: 20; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: 1rem 1.25rem;
  border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.97);
  box-shadow: 0 12px 35px rgba(7, 32, 67, .16); backdrop-filter: blur(8px);
}
.invoice-selection-panel { margin-top: 1rem; }
.invoice-selection-line {
  display: grid; grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(105px, .8fr)) minmax(120px, .9fr) auto;
  gap: .75rem; align-items: end; padding: 1rem 0; border-bottom: 1px solid var(--line);
}
.invoice-selection-line:last-child { border-bottom: 0; }
.invoice-selection-identity { align-self: center; display: grid; gap: .3rem; }
.invoice-selection-identity small { color: var(--muted); }
.invoice-selection-total { align-self: center; display: grid; gap: .25rem; }
.invoice-selection-total span { color: var(--muted); font-size: .8rem; }
.invoice-type-dialog { width: min(680px, calc(100vw - 2rem)); border: 0; border-radius: 18px; padding: 1.5rem; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.invoice-type-dialog::backdrop { background: rgba(4, 20, 43, .6); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.dialog-heading h2 { margin: .3rem 0 1rem; }
.invoice-type-options { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.invoice-type-option { display: grid; gap: .5rem; min-height: 130px; padding: 1.25rem; text-align: left; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.invoice-type-option:hover, .invoice-type-option:focus-visible { border-color: var(--navy); box-shadow: 0 8px 24px rgba(7,54,103,.12); }
.invoice-type-option strong { font-size: 1.05rem; color: var(--navy); }
.invoice-type-option span { color: var(--muted); line-height: 1.45; }
@media (max-width: 1050px) {
  .invoice-selection-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-selection-identity { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .invoice-selection-toolbar { align-items: stretch; flex-direction: column; }
  .invoice-selection-toolbar .actions { display: grid; grid-template-columns: 1fr; }
  .invoice-selection-line, .invoice-type-options { grid-template-columns: 1fr; }
}
