/* RPA-inspired shell and shared components. Feature files retain business layout/state. */
body[data-ui-theme] { margin: 0; padding: 0; background: var(--lp-surface); color: var(--ui-text); font: 14px/1.6 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; -webkit-font-smoothing: antialiased; font-synthesis: none; }
body[data-ui-theme] .container { max-width: none; min-height: 100vh; margin: 0; padding: 86px 24px 32px calc(var(--lp-sidebar-width) + 24px); }
body[data-ui-theme] .header { position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 24px; width: var(--lp-sidebar-width); margin: 0; padding: 25px 18px 18px; border-right: 1px solid var(--ui-line); background: var(--ui-sidebar); overflow: hidden; overscroll-behavior: contain; }
body[data-ui-theme] .header .brand-logo { gap: 9px; padding: 0 1px; }
body[data-ui-theme] .header .brand-logo img { width: 38px; height: 38px; flex-basis: 38px; }
body[data-ui-theme] .header .brand-copy strong { font-size: 14px; }
body[data-ui-theme] .header .brand-copy small { font-size: 10px; }
body[data-ui-theme] .userbar { display: flex; flex: 1; flex-direction: column; align-items: stretch; gap: 10px; width: 100%; min-height: 0; }
body[data-ui-theme] .mobile-task-nav { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 3px; padding: 0; overflow-y: auto; scrollbar-width: thin; }
body[data-ui-theme] .page-nav-button.btn-secondary { position: relative; display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; min-width: 0; min-height: 43px; margin: 0; padding: 10px 13px; border: 0; border-radius: 5px; background: transparent; color: var(--ui-muted); font-size: 13px; font-weight: 500; white-space: normal; box-shadow: none; }
body[data-ui-theme] .page-nav-button.btn-secondary:hover:not(:disabled) { background: var(--ui-nav-active); color: var(--ui-primary); }
body[data-ui-theme] .page-nav-button.btn-secondary.active { background: var(--ui-nav-active); color: var(--ui-primary); font-weight: 600; box-shadow: inset 3px 0 var(--ui-primary); }
#btnOpenSettings { order: 12; }
#btnOpenUserManagement { order: 13; }
#btnOpenBatchRecognitionTest { order: 14; }
#btnOpenRecognitionFeedback { order: 15; }
body[data-ui-theme] .userbar > :not(.mobile-task-nav) { flex-shrink: 0; }
body[data-ui-theme] .session-user-name { order: 20; display: flex; gap: 10px; min-height: 56px; padding: 15px 0 4px; margin-top: 8px; border: 0; border-top: 1px solid var(--ui-primary-line); border-radius: 0; background: transparent; box-shadow: none; }
.session-user-avatar { flex: 0 0 32px; border-radius: 8px; background: #0755f5; box-shadow: none; font-weight: 600; }
.session-user-main { gap: 6px; }
.session-user-title-row { flex-wrap: wrap; gap: 5px 7px; white-space: normal; line-height: 1.4; }
.session-user-display { font-size: 13px; font-weight: 600; color: var(--ui-text); overflow-wrap: anywhere; }
.session-user-role { font-size: 9px; font-weight: 500; color: var(--ui-muted); }
.session-user-template-row { max-width: 150px; }
.session-user-template { font-size: 10px; color: var(--ui-muted); font-weight: 400; }
.session-user-quota { font-size: 10px; font-weight: 500; }
body[data-ui-theme] .ui-theme-control { order: 30; display: flex; justify-content: space-between; width: 100%; min-height: 36px; padding: 0; border: 0; background: transparent; box-shadow: none; font-weight: 400; }
body[data-ui-theme] .ui-theme-control label { font-size: 11px; color: var(--ui-muted); }
body[data-ui-theme] .ui-theme-select { width: 102px; min-width: 0; min-height: 34px; font-size: 12px; font-weight: 400; }
body[data-ui-theme] .userbar > button:not(.page-nav-button) { order: 40; width: 100%; border: 1px solid var(--ui-primary-line); background: transparent; color: var(--ui-muted); }
body[data-ui-theme] .page-nav-button.mobile-work-nav { display: none; }
.workspace-topbar { position: fixed; inset: 0 0 auto var(--lp-sidebar-width); z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 66px; padding: 0 38px; border-bottom: 1px solid var(--ui-line); background: var(--lp-surface); }
.workspace-context { display: flex; align-items: baseline; gap: 13px; min-width: 0; }
.workspace-context span { color: var(--ui-muted); font-size: 12px; }
.workspace-context strong { font-size: 16px; font-weight: 600; color: var(--ui-text); }
.workspace-edition { color: var(--ui-muted); font-size: 11px; letter-spacing: .6px; }
.mobile-menu-toggle, .mobile-menu-close, .navigation-backdrop { display: none; }
.xvantage-login-screen .workspace-topbar, .xvantage-login-screen .navigation-backdrop { display: none; }
body[data-ui-theme] #authMessage { margin: 0 0 18px; }
body[data-ui-theme] :is(h2,h3,h4,strong,b) { font-weight: 600; }
body[data-ui-theme] :is(h2,h3,h4) { color: var(--ui-text); }
body[data-ui-theme] .card { border: 0; border-radius: 0; background: var(--lp-surface); box-shadow: none; margin-bottom: 22px; min-width: 0; }
body[data-ui-theme] .card-header { padding: 0 0 16px; background: var(--lp-surface); border-bottom: 0; gap: 12px 20px; }
body[data-ui-theme] .card-header h2 { font-size: 20px; font-weight: 600; line-height: 1.5; letter-spacing: -.3px; }
body[data-ui-theme] .card-body { padding: 0; }
body[data-ui-theme] .card-body > .message:first-child { margin: 0 0 12px; }
body[data-ui-theme] .card-header :is(.auth-hint,p) { max-width: 860px; margin-top: 6px; margin-bottom: 0; color: var(--ui-muted); font-size: 13px; line-height: 1.8; }
body[data-ui-theme] :is(.mini-panel,.template-step,.settings-nav,.report-section,.report-metric,.report-mini,.mailbox-protocol-panel,.internal-reminder-task-card,.mail-task-card,.invoice-task-card,.payment-application-card,.bank-task-card,.mobile-work-card) { border-radius: 10px; box-shadow: none; }
body[data-ui-theme] :is(.rpa-profile-workspace,.management-heading,.batch-recognition-upload,.session-user-name) { background-image: none; }
body[data-ui-theme] :is(.management-heading,.rpa-profile-workspace) { background-color: var(--ui-soft); }
body[data-ui-theme] .auth-hint, body[data-ui-theme] .field-hint { color: var(--ui-muted); line-height: 1.8; }
body[data-ui-theme] button { min-height: 39px; padding: 9px 15px; border-radius: 6px; font-family: inherit; font-weight: 500; font-size: 13px; line-height: 1.5; transition: background-color .16s, border-color .16s; }
body[data-ui-theme] button:hover:not(:disabled) { transform: none; box-shadow: none; }
body[data-ui-theme] button:focus-visible, body[data-ui-theme] a:focus-visible, body[data-ui-theme] summary:focus-visible { outline: 3px solid #93b7fb; outline-offset: 3px; }
body[data-ui-theme] button:disabled { opacity: .48; cursor: not-allowed; }
body[data-ui-theme] .btn-primary, body[data-ui-theme] .btn-green { background: #0755f5; color: #fff; border: 1px solid #0755f5; box-shadow: none; }
body[data-ui-theme] .btn-primary:hover:not(:disabled), body[data-ui-theme] .btn-green:hover:not(:disabled) { background: #0048dd; border-color: #0048dd; }
body[data-ui-theme] .btn-secondary { border: 1px solid var(--ui-primary-line); background: var(--ui-primary-soft); color: var(--ui-primary-ink); }
body[data-ui-theme] .btn-secondary:hover:not(:disabled) { background: var(--ui-nav-active); }
body[data-ui-theme] .btn-dark { background: var(--ui-soft); color: var(--ui-text); border: 1px solid var(--ui-line); }
body[data-ui-theme] .btn-danger, body[data-ui-theme] .btn-report { background: var(--ui-danger-soft); color: var(--ui-danger); border: 1px solid var(--ui-danger-line); }
body[data-ui-theme] .btn-orange, body[data-ui-theme] .btn-notification { background: var(--ui-warning-soft); color: var(--ui-warning); border: 1px solid var(--ui-warning-line); }
body[data-ui-theme] :is(.btn-small,.small-action) { min-height: 32px; padding: 5px 10px; font-size: 12px; }
body[data-ui-theme] :is(input,select,textarea) { max-width: 100%; min-width: 0; min-height: 40px; border: 1px solid var(--ui-primary-line); border-radius: 6px; padding: 9px 12px; background: var(--lp-surface); color: var(--ui-text); font: inherit; font-size: 13px; line-height: 1.5; box-shadow: none; }
body[data-ui-theme] textarea { min-height: 96px; resize: vertical; }
body[data-ui-theme] :is(input,select,textarea):focus { outline: none; border-color: var(--ui-primary); box-shadow: 0 0 0 3px rgba(7,85,245,.12); }
body[data-ui-theme] :is(input,textarea)::placeholder { color: var(--ui-muted); opacity: .8; }
body[data-ui-theme] :is(input,select,textarea):disabled { background: var(--ui-soft); color: var(--ui-muted); cursor: not-allowed; }
body[data-ui-theme] input:is([type=checkbox],[type=radio]) { min-height: 0; width: 16px; height: 16px; padding: 0; flex: 0 0 16px; accent-color: #0755f5; }
body[data-ui-theme] input[type=file] { padding: 5px; height: auto; }
body[data-ui-theme] input[type=file]::file-selector-button { border: 0; border-radius: 4px; padding: 6px 10px; margin-right: 10px; background: var(--ui-primary-soft); color: var(--ui-primary-ink); cursor: pointer; font-family: inherit; }
body[data-ui-theme] label { font-size: 12px; font-weight: 500; color: var(--ui-muted); }
body[data-ui-theme] .form-item { gap: 8px; }
body[data-ui-theme] .actions { gap: 9px; }
body[data-ui-theme] .primary-actions { padding-top: 18px; border-top: 1px solid var(--ui-line); }
body[data-ui-theme] .table-wrap { max-width: 100%; border: 0; border-radius: 0; overscroll-behavior-x: contain; scrollbar-width: thin; }
body[data-ui-theme] th { background: var(--ui-soft); color: var(--ui-muted); padding: 12px 14px; border-bottom: 1px solid var(--ui-line); font-size: 12px; font-weight: 500; }
body[data-ui-theme] td { padding: 13px 14px; border-bottom: 1px solid var(--ui-line); font-size: 13px; line-height: 1.6; }
body[data-ui-theme] tbody tr:last-child td { border-bottom: 0; }
body[data-ui-theme] tbody tr:hover { background: var(--ui-soft); }
body[data-ui-theme] .table-wrap button { margin-top: 3px; margin-bottom: 3px; }
body[data-ui-theme] .summary-grid { grid-template-columns: repeat(auto-fit,minmax(115px,1fr)); gap: 12px; }
body[data-ui-theme] .summary-item { min-width: 0; padding: 16px; border-color: var(--ui-line); border-radius: 8px; background: var(--ui-soft); }
body[data-ui-theme] .summary-item strong { font-size: 25px; font-weight: 600; }
body[data-ui-theme] .summary-totals { background: var(--ui-primary-soft); color: var(--ui-primary-ink); border-color: var(--ui-primary-line); }
body[data-ui-theme] .empty { padding: 48px 20px; color: var(--ui-muted); line-height: 1.8; font-size: 13px; }
body[data-ui-theme] .message { padding: 12px 15px; border: 1px solid var(--ui-primary-line); border-radius: 7px; line-height: 1.7; overflow-wrap: anywhere; }
body[data-ui-theme] .message.info { background: var(--ui-primary-soft); color: var(--ui-primary-ink); }
body[data-ui-theme] .message.success { background: var(--ui-success-soft); color: var(--ui-success); border-color: var(--ui-success-line); }
body[data-ui-theme] .message.error { background: var(--ui-danger-soft); color: var(--ui-danger); border-color: var(--ui-danger-line); }
body[data-ui-theme] .settings-nav { padding: 12px; background: var(--ui-soft); border-color: var(--ui-line); }
body[data-ui-theme] .settings-nav-button { background: transparent; color: var(--ui-text); box-shadow: none; }
body[data-ui-theme] .settings-nav-button.active { background: var(--ui-nav-active); box-shadow: inset 3px 0 var(--ui-primary); color: var(--ui-primary); }
body[data-ui-theme] :is(.paid-company-tab-button,.paid-company-mail-tab,.paid-company-mail-default-mode-button).active { background: var(--ui-primary-soft); color: var(--ui-primary); border-color: var(--ui-primary-line); }
body[data-ui-theme] .nav-badge { min-width: 18px; height: 18px; font-size: 10px; font-weight: 600; background: var(--ui-danger); color: var(--lp-surface); }
body[data-ui-theme] :is(.batch-preview-overlay,.notification-editor-backdrop,.modal-backdrop,.reconciliation-report-backdrop) { backdrop-filter: blur(3px); background: rgba(17,35,60,.36); padding: 20px; }
body[data-ui-theme] :is(.batch-preview-dialog,.notification-editor,.modal-dialog,.reconciliation-report-dialog) { max-width: 100%; max-height: calc(100dvh - 40px); overflow: auto; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--lp-surface); color: var(--ui-text); box-shadow: 0 18px 65px rgba(17,35,60,.18); }
body[data-ui-theme] .reconciliation-report-close { min-height: 34px; padding: 0; }
.app-boot-screen { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: var(--lp-surface); color: var(--ui-muted); }
.app-boot-screen img { width: 56px; height: 56px; object-fit: contain; }
.app-boot-screen strong { color: var(--ui-text); font-size: 18px; }
.app-boot-screen p { font-size: 13px; }
body[data-app-booting="0"] .app-boot-screen { display: none; }
.boot-retry { margin-top: 8px; text-align: center; }
.boot-retry a { display: inline-block; margin-top: 12px; color: var(--ui-primary); }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 200; padding: 10px 16px; background: var(--lp-surface); color: var(--ui-primary); }
.skip-link:focus { top: 12px; }
@media (min-width: 901px) and (max-width: 1190px) { .erp-control-grid, .erp-control-grid.rpa-mode { grid-template-columns: repeat(2,minmax(0,1fr)); } .settings-shell { grid-template-columns: 190px minmax(0,1fr); } .mailbox-protocol-grid,.mailbox-basics-grid { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 900px) {
  body[data-ui-theme] .container { padding: 86px 20px 24px; }
  body[data-ui-theme] .header { inset: 0 auto 0 0; width: min(290px,85vw); max-width: 100%; padding: 24px 20px; visibility: hidden; transform: translateX(-100%); transition: none; gap: 20px; }
  body[data-ui-theme].navigation-open .header { visibility: visible; transform: translateX(0); }
  body[data-ui-theme].navigation-open { overflow: hidden; }
  .navigation-open .navigation-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(17,35,60,.32); }
  .workspace-topbar { inset: 0 0 auto 0; height: 64px; padding: 0 20px; gap: 12px; }
  .workspace-context { flex: 1; gap: 10px; }
  .workspace-context span, .workspace-edition { display: none; }
  .workspace-context strong { font-size: 15px; }
  .mobile-menu-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 0; border: 0; background: transparent; color: var(--ui-muted); }
  .mobile-menu-toggle img { width: 26px; height: 26px; }
  .mobile-menu-close { display: block; align-self: flex-end; background: transparent; color: var(--ui-muted); padding: 4px 8px; }
  body[data-ui-theme] .mobile-task-nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
  body[data-ui-theme] .userbar { display: flex; }
  body[data-ui-theme] .page-nav-button.btn-secondary { width: 100%; min-width: 0; min-height: 44px; border-radius: 5px; justify-content: flex-start; white-space: normal; }
  body[data-ui-theme] .session-user-name { order: 20; }
  body[data-ui-theme] #uiThemeControl { display: flex; order: 30; width: 100%; }
  body[data-ui-theme] #uiThemeControl label { display: block; }
  body[data-ui-theme] #uiThemeSelect { width: 102px; font-size: 13px; }
  body[data-ui-theme] .userbar > button:not(.page-nav-button) { order: 40; width: 100%; min-height: 44px; }
  body[data-ui-theme] .mobile-work-nav:not(.hidden) { display: inline-flex; order: -1; }
  .bank-upload-panel,.customer-title-tool-controls,.internal-reminder-item { grid-template-columns: minmax(0,1fr); }
  .invoice-task-list,.payment-application-list,.bank-task-list,.internal-reminder-task-grid { grid-template-columns: repeat(auto-fit,minmax(min(280px,100%),1fr)); }
  .erp-control-grid.rpa-mode,.split-panels.single-panel { grid-template-columns: minmax(0,1fr); }
  .mailbox-inline-fields { grid-template-columns: minmax(0,1fr); }
  .settings-nav { position: static; }
}
@media (max-width: 600px) {
  body[data-ui-theme] .container { padding: 80px 12px 24px; }
  .workspace-topbar { padding: 0 16px; }
  body[data-ui-theme] .card { margin-bottom: 16px; }
  body[data-ui-theme] .card-header h2 { font-size: 19px; }
  body[data-ui-theme] button { min-height: 42px; }
  body[data-ui-theme] :is(input,select,textarea) { font-size: 16px; min-height: 44px; }
  body[data-ui-theme] input:is([type=checkbox],[type=radio]) { min-height: 0; }
  body[data-ui-theme] .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .summary-total-group { white-space: normal; }
  .summary-totals { gap: 12px; }
  .mode-preference-control { grid-template-columns: minmax(0,1fr) auto; }
  .mode-preference-control .btn-secondary { min-width: 0; padding: 8px; }
  .card-header > .actions, .card-header > .history-head-actions { width: 100%; }
  .form-item, .settings-content, .card-body > div { min-width: 0; }
  .auth-grid,.mapping-grid,.erp-settings-grid,.erp-connection-form { grid-template-columns: minmax(0,1fr); }
  .rpa-editor-footer,.rpa-login-account-head { flex-wrap: wrap; }
  .paid-company-branch-context select { min-width: 0; }
  .paid-company-list table,.paid-company-branch-table table { min-width: 580px; }
  .report-period-fields { flex-wrap: wrap; }
  body[data-ui-theme] .empty { padding: 36px 14px; }
  body[data-ui-theme] :is(.batch-preview-overlay,.notification-editor-backdrop,.modal-backdrop,.reconciliation-report-backdrop) { padding: 12px; }
  body[data-ui-theme] :is(.batch-preview-dialog,.notification-editor,.modal-dialog,.reconciliation-report-dialog) { max-height: calc(100dvh - 24px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media print { .workspace-topbar,.header,.app-boot-screen,.navigation-backdrop { display: none !important; } }

@media print {
  body[data-ui-theme] #paymentApplicationPrintArea { color: #111827; background: #fff; }
  body[data-ui-theme] #paymentApplicationPrintArea table { min-width: 0; width: 100%; }
  body[data-ui-theme] #paymentApplicationPrintArea th, body[data-ui-theme] #paymentApplicationPrintArea td { border: 1px solid #d1d5db; padding: 7px; color: #111827; background: #fff; }
  body[data-ui-theme] #paymentApplicationPrintArea th { background: #f3f4f6; }
}

body[data-ui-theme] :is(.report-period-toggle,.report-group-tabs,.recognition-feedback-filter,.batch-preview-sheet-tabs) button.active { background: var(--ui-primary-soft); color: var(--ui-primary); border-color: var(--ui-primary-line); box-shadow: none; }
body[data-ui-theme] .management-heading { background: transparent; }
@media (min-width: 1200px) { .reconciliation-file-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; } }
