/* Invoice demo only. Tokens and proportions follow the desktop Layout,
   Dashboard, PageHeader and Card components. KP/converter stay untouched. */
#demoApp {
  --surface-50: #fafbfc;
  --surface-100: #f4f6f9;
  --surface-200: #e8ecf1;
  --surface-300: #d6dce5;
  --surface-400: #a9b3c1;
  --surface-500: #6b7689;
  --surface-600: #4b5569;
  --surface-700: #333c4f;
  --surface-800: #1f2636;
  --surface-900: #131826;
  --demo-padding: 24px;
  container: invoice-demo / inline-size;
  font-feature-settings: 'cv11', 'ss01', 'ss03', 'tnum';
  letter-spacing: -0.005em;
}
#demoApp .win-body {
  container: invoice-canvas / inline-size;
  grid-template-columns: 260px minmax(0, 1fr);
  width: 100%;
  height: var(--demo-window-height, 860px);
}
#demoApp .app-side { background: #0a0e1a; gap: 0; }
#demoApp .side-brand { gap: 10px; flex-shrink: 0; }
#demoApp .side-brand-copy strong { font-weight: 600; }
#demoApp .side-brand-copy small { font-size: 10px; font-weight: 400; }
#demoApp .side-label { padding: 0 12px 6px; font-family: var(--font); font-size: 10px; letter-spacing: 0.12em; }
#demoApp .side-section { padding: 16px 12px 0; gap: 2px; }
#demoApp .side-section + .side-section { margin-top: 20px; padding-top: 0; }
#demoApp .app-side a { height: 36px; padding: 0 12px; gap: 12px; font-size: 14px; font-weight: 400; }
#demoApp .app-side a.active { box-shadow: none; font-weight: 500; }
#demoApp .app-side a.active::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 4px; background: var(--primary-400); }
#demoApp .app-side a .ico { width: 18px; height: 18px; }
#demoApp .side-foot { padding: 12px; gap: 4px; }
#demoApp .firma-name { font-size: 13px; font-weight: 500; }
#demoApp .firma-nip, #demoApp .lic { font-family: var(--font); font-size: 11px; }
#demoApp .lic { padding: 6px 8px; color: rgba(255,255,255,0.7); }
#demoApp .app-main { min-width: 0; }
#demoApp .app-global-topbar { padding: 0 24px; background: rgba(255,255,255,0.7); border-color: rgba(232,236,241,0.6); }
#demoApp .app-back-program { font-size: 12px; font-weight: 600; }
#demoApp .app-firm-switcher { font-size: 12px; font-weight: 500; box-shadow: none; }
#demoApp .app-firm-switcher small { font-size: 11px; }
#demoApp .app-module-pill { font-size: 11px; font-weight: 600; padding: 2px 8px; }
#demoApp .app-global-topbar .avatar { width: 32px; height: 32px; font-size: 12px; font-weight: 600; }
#demoApp .page-view { scrollbar-gutter: stable; }
#demoApp .page-header { align-items: flex-start; flex-wrap: wrap; padding: 24px var(--demo-padding); gap: 16px; }
#demoApp .ph-title { font-size: 24px; line-height: 32px; font-weight: 700; }
#demoApp .ph-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; background: linear-gradient(135deg, #eef2ff, #e0e7ff); }
#demoApp .ph-icon::before { width: 20px; height: 20px; }
#demoApp .ph-sub { font-size: 14px; line-height: 20px; margin-top: 4px; }
#demoApp .ph-actions { flex-wrap: wrap; }
#demoApp .ph-actions .btn { min-height: 36px; padding: 8px 12px; font-size: 13px; font-weight: 600; }
#demoApp .dashboard-page-header .ph-title > span { font-weight: 600; }
#demoApp .page-view[data-page="dashboard"] { background: radial-gradient(at 0 0, rgba(238,242,255,0.65), transparent 60%), var(--surface-50); }
#demoApp .dash-stats { gap: 16px; padding: 0 var(--demo-padding) !important; }
#demoApp .dash-stats .stat { padding: 20px; gap: 0; border-radius: 16px; border-color: rgba(232,236,241,0.8); box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 2px 6px rgba(15,23,42,0.04); }
#demoApp .dash-stats .stat-ico { width: 40px; height: 40px; top: 20px; right: 20px; border-radius: 12px; background: linear-gradient(135deg, #eef2ff, #e0e7ff); }
#demoApp .dash-stats .stat-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
#demoApp .dash-stats .stat-ico::before { width: 20px; height: 20px; }
#demoApp .dash-stats .stat-lbl { font-size: 12px; font-weight: 500; line-height: 16px; letter-spacing: 0.04em; padding-right: 45px; }
#demoApp .dash-stats .stat-val { font-family: var(--font); font-size: 24px; font-weight: 600; line-height: 32px; margin-top: 8px; max-width: none; overflow: visible; text-overflow: clip; }
#demoApp .dash-stats .stat-val small { font-size: inherit; }
#demoApp .dash-stats .stat-hint { margin-top: 4px; font-size: 12px; line-height: 16px; color: var(--surface-500); }
#demoApp .stat.tone-success .stat-ico { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #059669; }
#demoApp .stat.tone-warning .stat-ico { background: linear-gradient(135deg, #fffbeb, #fef3c7); color: #b45309; }
#demoApp .stat.tone-danger .stat-ico { background: linear-gradient(135deg, #fef2f2, #fee2e2); color: #dc2626; }
#demoApp .dash-grid { gap: 24px; padding: 24px var(--demo-padding) 32px; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); align-items: start; }
#demoApp .dash-col-main, #demoApp .dash-col-side { min-width: 0; }
#demoApp .dash-card { border-radius: 16px; }
#demoApp .dash-card-head { padding: 16px 24px; border-color: rgba(232,236,241,0.8); align-items: center; }
#demoApp .dash-card-head .demo-h { font-size: 16px; font-weight: 600; }
#demoApp .dash-card-head p { font-size: 12px; }
#demoApp .dash-link { font-size: 12px; font-weight: 500; }
#demoApp .dash-card .data-table { overflow-x: auto; }
#demoApp .dash-card .tr { grid-template-columns: 132px 100px minmax(135px,1fr) 110px 110px 134px; gap: 0; min-width: 721px; padding: 0; font-size: 14px; font-family: var(--font); }
#demoApp .dash-card .tr > span { min-width: 0; padding: 12px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#demoApp .dash-card .tr.head { font-size: 11px; letter-spacing: 0.06em; }
#demoApp .dash-card .num { font-weight: 500; color: var(--surface-900); }
#demoApp .quick-actions-card { padding: 0; gap: 12px; }
#demoApp .quick-actions-card .demo-h { font-size: 14px; font-weight: 600; padding-left: 4px; margin: 0; }
#demoApp .quick-actions-card > p { font-size: 12px; line-height: 16px; margin: -10px 0 4px; padding-left: 4px; }
#demoApp .quick-action { align-items: flex-start; gap: 12px; padding: 16px; border-radius: 16px; box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 2px 6px rgba(15,23,42,0.04); }
#demoApp .quick-action:hover { background: white; transform: none; box-shadow: 0 4px 8px rgba(15,23,42,0.06), 0 12px 24px rgba(15,23,42,0.08); }
#demoApp .quick-action .qa-ico { width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(135deg, #eef2ff, #e0e7ff); }
#demoApp .quick-action .qa-ico svg { width: 18px; height: 18px; }
#demoApp .quick-action .qa-ico::before { width: 18px; height: 18px; }
#demoApp .quick-action > span:nth-child(2) { flex: 1; min-width: 0; }
#demoApp .quick-action strong { font-size: 14px; line-height: 20px; }
#demoApp .quick-action em { margin-top: 2px; font-size: 12px; line-height: 16px; }
#demoApp .qa-chevron { color: var(--surface-300); font-size: 20px; line-height: 20px; }
#demoApp .bdg { padding: 2px 8px; font-size: 11px; font-family: var(--font); }
#demoApp .bdg::before { font-size: 11px; }
#demoApp .demo-firma-scope { margin: 0 var(--demo-padding) 16px; padding: 24px; flex-wrap: wrap; gap: 16px; border-radius: 16px; }
#demoApp .scope-company { white-space: nowrap; }
#demoApp .scope-company .app-building { color: var(--primary-600); }
#demoApp .scope-company strong { font-size: 14px; font-weight: 500; }
#demoApp .demo-company-select { flex: 1; min-width: 210px; height: 36px; padding: 8px 12px; font: inherit; font-size: 13px; color: var(--surface-900); background: white; border: 1px solid var(--surface-200); border-radius: 10px; }
#demoApp .scope-description { flex: 1; min-width: 160px; font-size: 12px; color: var(--surface-500); }
#demoApp .page-view[data-page="faktury"] > .data-table { overflow-x: auto; flex-shrink: 0; }
#demoApp .page-view[data-page="faktury"] > .data-table .tr { min-width: 880px; grid-template-columns: 28px 135px 125px minmax(135px,1fr) 90px 95px 115px 130px; }
#demoApp .page-view[data-page="faktury"] > .data-table .tr > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#demoApp .form-grid { padding-left: var(--demo-padding); padding-right: var(--demo-padding); gap: 24px; grid-template-columns: minmax(0,2fr) minmax(280px,1fr); }
#demoApp .form-col { min-width: 0; }
#demoApp .form-section { padding: 24px; border-radius: 16px; margin-bottom: 24px; }
#demoApp .form-section .demo-h { display: block; font-size: 16px; font-weight: 600; text-transform: none; letter-spacing: -0.01em; margin-bottom: 16px; }
#demoApp .form-section .demo-h .hint { display: block; margin-top: 2px; font-size: 12px; color: var(--surface-500); }
#demoApp .field label { font-size: 12px; font-weight: 600; color: var(--surface-600); }
#demoApp .input { padding: 8px 12px; border-radius: 10px; font-size: 14px; }
#demoApp .summary-card { padding: 24px; border-radius: 16px; }
#demoApp .sum-label { font-size: 14px; font-weight: 600; }
#demoApp .demo-expand { display: grid; place-items: center; font-size: 14px; color: var(--surface-600); }
#demoApp .demo-expand:hover { background: var(--surface-200); }
#demoApp .demo-collapse { margin-left: auto; width: 28px; height: 28px; flex: 0 0 28px; color: rgba(255,255,255,0.5); border-radius: 8px; }
#demoApp .demo-collapse:hover { color: white; background: rgba(255,255,255,0.1); }
#demoApp .demo-collapse svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; }
#demoApp.is-side-collapsed .win-body { grid-template-columns: 72px minmax(0,1fr); }
#demoApp.is-side-collapsed .side-brand { padding: 0 20px; }
#demoApp.is-side-collapsed .side-brand-copy,
#demoApp.is-side-collapsed .side-label,
#demoApp.is-side-collapsed .side-foot { display: none; }
#demoApp.is-side-collapsed .demo-collapse { position: absolute; left: 53px; top: 45px; z-index: 5; width: 20px; background: #1f2636; }
#demoApp.is-side-collapsed .demo-collapse svg { transform: rotate(180deg); }
#demoApp.is-side-collapsed .side-section { padding-left: 8px; padding-right: 8px; }
#demoApp.is-side-collapsed .app-side a { justify-content: center; font-size: 0; gap: 0; padding: 0; }
#demoApp.is-expanded { position: fixed; inset: 16px; max-width: none; margin: 0; z-index: 1000; box-shadow: 0 0 0 100vmax rgba(10,14,26,0.7); }
#demoApp.is-expanded .win-body { height: calc(100% - 34px); width: 100%; zoom: 1; }
#demoApp .win-body { position: relative; }
#demoApp .demo-native-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--surface-50); }
#demoApp.has-native-demo .demo-native-frame { visibility: visible; z-index: 5; }
#demoApp.has-native-demo .win-body > :not(.demo-native-frame):not(.ms-launcher) { visibility: hidden; pointer-events: none; }
#demoApp .demo-mode-label { margin-left: auto; color: #6b7689; font-size: 10px; white-space: nowrap; }
#demoApp .demo-reset { padding: 3px 8px; margin-left: 8px; font: inherit; font-size: 11px; color: #4b5569; border-radius: 5px; transition: background 150ms; }
#demoApp .demo-reset:hover { background: #e8ecf1; color: #131826; }
.demo-safety-caption { max-width: 980px; margin: 12px auto 0; text-align: center; color: #6b7689; font-size: 12px; line-height: 1.6; }
html.demo-preview-open { overflow: hidden; }
.demo-preview-backdrop { display: none; position: fixed; inset: 0; z-index: 999; }
html.demo-preview-open .demo-preview-backdrop { display: block; }
@container invoice-canvas (max-width: 1050px) {
  #demoApp .dash-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #demoApp .dash-grid { grid-template-columns: 1fr; }
  #demoApp .quick-actions-card { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  #demoApp .quick-actions-card > .demo-h, #demoApp .quick-actions-card > p { grid-column: 1 / -1; }
  #demoApp .app-firm-switcher { position: static; transform: none; margin-left: auto; }
  #demoApp .app-firm-switcher small { display: none; }
  #demoApp .app-module-pill { display: none; }
  #demoApp .app-module-meta { margin-left: 0; }
}
@media (max-width: 700px) {
  #demoApp .demo-mode-label { display: none; }
  #demoApp { --demo-padding: 16px; }
  #demoApp .win-body { grid-template-columns: 1fr; width: 100%; height: var(--demo-window-height, 760px); zoom: 1; }
  #demoApp .app-global-topbar { padding: 0 12px; gap: 8px; }
  #demoApp .app-firm-switcher { max-width: 132px; font-size: 11px; }
  #demoApp .app-global-topbar .avatar { display: none; }
  #demoApp .app-back-program { font-size: 11px; padding: 0 8px; }
  #demoApp .page-header { padding-top: 20px; padding-bottom: 20px; }
  #demoApp .ph-title { font-size: 20px; line-height: 28px; }
  #demoApp .ph-sub { font-size: 12px; }
  #demoApp .ph-actions .btn { font-size: 12px; padding: 8px 10px; }
  #demoApp .dash-stats { gap: 10px; }
  #demoApp .dash-stats .stat { padding: 14px; }
  #demoApp .dash-stats .stat-ico { display: none; }
  #demoApp .dash-stats .stat-lbl { font-size: 10px; padding-right: 0; }
  #demoApp .dash-stats .stat-val { font-size: 18px; line-height: 26px; }
  #demoApp .dash-stats .stat-hint { font-size: 10px; line-height: 14px; }
  #demoApp .dash-grid { gap: 20px; padding-top: 20px; }
  #demoApp .dash-card-head { padding: 14px 16px; gap: 8px; }
  #demoApp .dash-card-head .demo-h { font-size: 14px; }
  #demoApp .dash-card-head p { font-size: 11px; }
  #demoApp .dash-link { font-size: 11px; }
  #demoApp .dash-card .tr { grid-template-columns: 132px 100px minmax(135px,1fr) 110px 110px 134px; }
  #demoApp .dash-card .tr > span { display: block !important; }
  #demoApp .dash-card .tr.head { display: grid !important; }
  #demoApp .quick-actions-card { grid-template-columns: 1fr; }
  #demoApp .demo-firma-scope { padding: 16px; }
  #demoApp .form-grid { grid-template-columns: 1fr; }
  #demoApp .form-section, #demoApp .summary-card { padding: 16px; }
  #demoApp.is-expanded { inset: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  #demoApp *, #demoApp *::before { animation: none !important; transition: none !important; }
}
