
    :root { color-scheme: light dark; }
    body { margin: 0; background: light-dark(#f2f4f6,#17212b); }
    #app { padding: env(safe-area-inset-top,0px) 0 env(safe-area-inset-bottom,0px); }
    #app .ki-app { min-height: 100vh; border-radius: 0; border: 0; box-shadow: none; max-width: 580px; }
    #app .ki-brand { font-size: 22px; font-weight: 600; }
    #app button, #app a { cursor: pointer; }
    #app button:disabled { cursor: wait; opacity: .55; }
    #app input:not([type=file]), #app textarea { font-size: 16px; }
    #app fieldset { min-width: 0; margin-inline: 0; }
    #app p { margin: 12px 0; }
    #app .ki-actions { display: grid; gap: 8px; }
    #app .ki-link { display: block; box-sizing: border-box; text-align: center; text-decoration: none; }
    #app .ki-notice { padding: 12px 18px; background: var(--ki-soft); color: var(--ki-blue); font-size: 13px; overflow-wrap: anywhere; }
    #app .ki-error-banner { padding: 12px 18px; background: light-dark(#fdecee,#482e38); color: var(--ki-alert); font-size: 13px; overflow-wrap: anywhere; }
    #app .ki-document-label { display: block; }
    #app .ki-empty { padding: 22px 4px; color: var(--ki-muted); }
    #app .ki-pdf { width: 100%; height: 65vh; border: 1px solid var(--ki-line); border-radius: 8px; background: var(--ki-surface); }
    #app .ki-image { width: 100%; height: auto; border-radius: 8px; }
    #app .ki-state { max-width: 100%; white-space: normal; }
    #app .ki-state[data-status="publishing"], #app .ki-state[data-status="legacy"] { background: var(--ki-soft); color: var(--ki-blue); }
    #app .ki-state[data-status="publication_error"], #app .ki-state[data-status="publication_unknown"] { background: light-dark(#fdecee,#482e38); color: var(--ki-alert); }
    #app .ki-app { --ki-bg: light-dark(#f2f4f6,#17212b); --ki-surface: light-dark(#ffffff,#202d3a); --ki-text: light-dark(#17212b,#f2f5f7); --ki-muted: light-dark(#627183,#a6b6c5); --ki-line: light-dark(#e3e8ee,#384756); --ki-blue: light-dark(#2382c6,#51a5e5); --ki-soft: light-dark(#eaf4fc,#263e53); --ki-alert: light-dark(#b52f3c,#ff8993); font: 400 14px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif; color: var(--ki-text); background: var(--ki-bg); max-width: 470px; margin: 0 auto; border: 1px solid var(--ki-line); border-radius: 20px; overflow: hidden; box-shadow: 0 8px 32px light-dark(#1c334010,#00000025); }
    #app * { box-sizing: border-box; }
    #app .ki-header { padding: 18px 20px 16px; background: var(--ki-surface); border-bottom: 1px solid var(--ki-line); display: flex; align-items: center; gap: 12px; }
    #app .ki-brand { width: 40px; height: 40px; display: grid; place-items: center; background: var(--ki-soft); color: var(--ki-blue); border-radius: 12px; flex-shrink: 0; }
    #app .ki-brand svg { width: 22px; height: 22px; }
    #app .ki-title { font-size: 15px; font-weight: 500; }
    #app .ki-small { font-size: 12px; color: var(--ki-muted); }
    #app .ki-content { padding: 20px; }
    #app .ki-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
    #app h2 { margin: 0; font-size: 21px; line-height: 1.3; font-weight: 500; }
    #app .ki-badge { background: var(--ki-soft); color: var(--ki-blue); font-size: 12px; padding: 5px 10px; border-radius: 20px; white-space: nowrap; }
    #app .ki-section { background: var(--ki-surface); border: 1px solid var(--ki-line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
    #app .ki-fields { display: grid; gap: 15px; }
    #app .ki-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
    #app label { display: block; font-size: 12px; font-weight: 500; color: var(--ki-muted); }
    #app input:not([type=file]), #app textarea { display: block; margin-top: 6px; width: 100%; min-width: 0; border: 1px solid var(--ki-line); border-radius: 9px; padding: 10px 11px; color: var(--ki-text); background: var(--ki-surface); font: 400 14px/1.4 system-ui,-apple-system,"Segoe UI",sans-serif; }
    #app textarea { resize: vertical; min-height: 66px; }
    #app .ki-money { position: relative; }
    #app .ki-money input { padding-right: 30px; }
    #app .ki-money span { position: absolute; right: 12px; top: 11px; color: var(--ki-muted); }
    #app .ki-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
    #app h3 { font-size: 14px; font-weight: 500; margin: 0; }
    #app .ki-doc { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--ki-line); }
    #app .ki-doc:first-child { border-top: 0; padding-top: 0; }
    #app .ki-file-icon { width: 36px; height: 42px; flex-shrink: 0; display: grid; place-items: center; color: var(--ki-blue); background: var(--ki-soft); border-radius: 8px; }
    #app .ki-file-icon svg { width: 19px; height: 19px; }
    #app .ki-file-name { min-width: 0; flex: 1; overflow-wrap: anywhere; }
    #app button { border: 0; font: inherit; }
    #app .ki-remove { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; background: transparent; color: var(--ki-muted); border-radius: 8px; }
    #app .ki-remove:hover { background: var(--ki-bg); }
    #app .ki-add { display: flex; gap: 8px; align-items: center; justify-content: center; width: 100%; color: var(--ki-blue); background: var(--ki-soft); border-radius: 9px; padding: 11px; margin-top: 6px; }
    #app .ki-note { margin-top: 9px; font-size: 12px; color: var(--ki-muted); }
    #app .ki-footer { background: var(--ki-surface); border-top: 1px solid var(--ki-line); padding: 15px 20px 18px; display: grid; gap: 10px; }
    #app .ki-primary { width: 100%; min-height: 46px; padding: 12px 16px; border-radius: 11px; background: var(--ki-blue); color: #fff; font-weight: 500; }
    #app .ki-secondary { width: 100%; min-height: 40px; padding: 9px 12px; background: transparent; color: var(--ki-blue); border-radius: 10px; }
    #app .ki-feedback { font-size: 12px; color: var(--ki-muted); text-align: center; min-height: 18px; }
    #app .ki-error { color: var(--ki-alert); font-size: 12px; margin: 0 0 12px; }
    #app .ki-preview-meta { margin-bottom: 13px; display: flex; align-items: center; gap: 8px; color: var(--ki-muted); font-size: 12px; }
    #app .ki-message { background: var(--ki-surface); border: 1px solid var(--ki-line); border-radius: 14px 14px 14px 4px; padding: 16px; }
    #app .ki-bot-name { font-weight: 500; color: var(--ki-blue); margin-bottom: 10px; }
    #app .ki-message h3 { font-size: 16px; margin-bottom: 14px; }
    #app .ki-details { margin: 0; display: grid; gap: 11px; }
    #app .ki-details dt { color: var(--ki-muted); font-size: 12px; }
    #app .ki-details dd { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
    #app .ki-total { font-size: 22px; font-weight: 500; }
    #app .ki-message-files { margin: 14px 0; padding-top: 14px; border-top: 1px solid var(--ki-line); }
    #app .ki-status { font-size: 12px; color: var(--ki-muted); padding-top: 12px; border-top: 1px solid var(--ki-line); }
    #app .ki-approval { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
    #app .ki-approval button { color: var(--ki-blue); background: var(--ki-soft); min-height: 42px; border-radius: 9px; }
    #app .ki-approval .ki-reject { color: var(--ki-alert); }
    #app .ki-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 12px 14px; background: var(--ki-surface); border-bottom: 1px solid var(--ki-line); }
    #app .ki-nav button { min-height: 48px; padding: 10px 8px; border-radius: 10px; color: var(--ki-muted); background: transparent; font-size: 13px; font-weight: 500; display: flex; justify-content: center; align-items: center; gap: 7px; }
    #app .ki-nav button[aria-pressed="true"] { color: var(--ki-blue); background: var(--ki-soft); }
    #app .ki-nav svg { width: 17px; height: 17px; flex-shrink: 0; }
    #app .ki-history-head { margin-bottom: 16px; }
    #app .ki-history-head .ki-small { margin-top: 5px; }
    #app .ki-history-list { display: grid; gap: 11px; }
    #app .ki-history-item { display: grid; gap: 10px; width: 100%; min-width: 0; padding: 16px; text-align: left; color: var(--ki-text); background: var(--ki-surface); border: 1px solid var(--ki-line); border-radius: 13px; }
    #app .ki-history-item:hover { border-color: var(--ki-blue); }
    #app .ki-history-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
    #app .ki-history-number { font-weight: 500; overflow-wrap: anywhere; }
    #app .ki-history-field { display: grid; gap: 2px; overflow-wrap: anywhere; }
    #app .ki-history-bottom { display: flex; justify-content: space-between; align-items: center; color: var(--ki-muted); font-size: 12px; padding-top: 3px; }
    #app .ki-state { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 7px; font-size: 11px; font-weight: 500; }
    #app .ki-state[data-status="draft"] { background: var(--ki-bg); color: var(--ki-muted); }
    #app .ki-state[data-status="pending"] { background: light-dark(#fff2d8,#493a20); color: light-dark(#875714,#f5cd83); }
    #app .ki-state[data-status="approved"] { background: light-dark(#e7f5ec,#213e32); color: light-dark(#226a43,#8ed6ae); }
    #app .ki-state[data-status="rejected"] { background: light-dark(#fdecee,#482e38); color: var(--ki-alert); }
    #app .ki-back-link { display: inline-flex; gap: 7px; align-items: center; min-height: 44px; margin: -6px 0 10px; padding: 5px 0; background: transparent; color: var(--ki-blue); }
    #app .ki-detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
    #app .ki-detail-title h2 { overflow-wrap: anywhere; }
    #app .ki-detail-doc { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: transparent; color: var(--ki-text); padding: 12px 0; min-height: 56px; border-top: 1px solid var(--ki-line); }
    #app .ki-detail-doc:first-child { border-top: 0; }
    #app .ki-doc-action { color: var(--ki-blue); flex-shrink: 0; }
    #app .ki-paper { background: var(--ki-surface); border: 1px solid var(--ki-line); border-radius: 6px; padding: 22px 17px; }
    #app .ki-paper .ki-paper-title { font-size: 19px; font-weight: 500; margin: 16px 0 20px; overflow-wrap: anywhere; }
    #app .ki-paper table { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: 12px; }
    #app .ki-paper th, #app .ki-paper td { text-align: left; vertical-align: top; padding: 10px 4px; border-bottom: 1px solid var(--ki-line); overflow-wrap: anywhere; }
    #app .ki-paper th { font-weight: 500; color: var(--ki-muted); }
    #app .ki-paper .ki-paper-amount { text-align: right; white-space: nowrap; }
    #app .ki-paper-total { margin-top: 24px; display: grid; gap: 5px; text-align: right; }
    #app .ki-document-name { overflow-wrap: anywhere; margin-bottom: 14px; font-weight: 500; }
    #app .ki-paper-foot { border-top: 1px solid var(--ki-line); padding-top: 14px; margin-top: 32px; }
    @media (pointer: coarse) { #app .ki-remove { width: 44px; height: 44px; } }
    #app [hidden] { display: none !important; }
    @media (max-width: 400px) {
      #app { padding: 12px 0; }
      #app .ki-content { padding: 16px 12px; }
      #app .ki-header, #app .ki-footer { padding-left: 14px; padding-right: 14px; }
      #app .ki-section { padding: 12px; }
      #app input:not([type=file]), #app textarea { font-size: 16px; }
      #app .ki-row { grid-template-columns: minmax(0,1fr); }
    }
    #app { padding: env(safe-area-inset-top,0px) 0 env(safe-area-inset-bottom,0px); }
    #app .ki-app { min-height: 100vh; max-width: 580px; border: 0; border-radius: 0; box-shadow: none; }
    #app input:not([type=file]), #app textarea { font-size: 16px; }
    #app .ki-state { max-width: 100%; white-space: normal; }
  
