/* Mobile workspace: reserve the screen for records and editable fields. */
.compact-total,.mobile-more-button,.mobile-empty-hint{display:none}

@media screen and (max-width:900px){
  body{font-size:16px}
  .app-header{height:54px;padding:0 12px;gap:12px}
  .brand{font-size:18px;gap:8px;letter-spacing:1px}
  .brand-mark{width:28px;height:28px;padding:7px;gap:3px;border-radius:7px}
  .brand small,.header-backup,.desktop-help{display:none}
  .header-actions{gap:5px}
  .save-status{font-size:12px;gap:6px}
  .header-actions .icon-button{width:44px;height:44px}
  .mobile-more-button{display:inline-flex;font-size:14px;color:var(--accent)}

  .app-main{padding:8px 12px calc(86px + env(safe-area-inset-bottom))}
  .page-heading{display:block;margin-bottom:6px}
  .page-heading>div{min-width:0}
  .eyebrow,.page-description,.primary-actions{display:none}
  .title-line{gap:4px;min-height:44px}
  h1{font-size:23px;line-height:1.35;letter-spacing:.3px}
  .title-line .icon-button{width:44px;height:44px}
  .title-line svg{width:17px;height:17px}

  .mobile-tabs{display:flex;align-items:center;gap:10px;padding:0;margin-bottom:10px;border-bottom:1px solid var(--line)}
  .view-tabs{display:flex;gap:22px}
  .mobile-tabs button{font-size:16px;min-height:44px;padding:9px 2px 8px;color:var(--muted);background:transparent;border-bottom:3px solid transparent}
  .mobile-tabs button[aria-selected=true]{color:var(--accent);border-bottom-color:var(--accent);font-weight:600}
  .mobile-tabs .mobile-column-trigger{margin-left:auto;min-height:44px;padding:8px 0;gap:6px;font-size:14px;color:var(--accent);border:0}
  .workspace{display:block}
  .workspace[data-view=records] .preview-panel{display:none}
  .workspace[data-view=preview] .records-panel{display:none}

  .records-panel{padding:0 12px 6px;box-shadow:none;border-radius:10px}
  .panel-heading{min-height:52px;margin:0;gap:8px;border-bottom:1px solid var(--line)}
  .panel-heading>div:first-child{flex-shrink:0}
  .panel-heading p,.records-heading-label,.add-record,.record-summary,.storage-note,.app-footer{display:none}
  .panel-heading h2{font-size:14px;font-weight:400}
  .count{min-width:0;height:auto;margin:0;padding:0;background:transparent;font-size:14px;color:var(--muted);white-space:nowrap}
  .count:after{content:" 条记录"}
  .compact-total{display:flex;align-items:baseline;justify-content:flex-end;gap:6px;margin-left:auto;min-width:0;flex-wrap:wrap;line-height:1.4}
  .compact-total>span{font-size:12px;color:var(--muted)}
  .compact-total strong{font-size:20px;font-weight:500;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;min-width:0;text-align:right}
  .undo-button{width:44px;height:44px;flex-shrink:0}
  .undo-button svg{width:18px;height:18px}
  .search-box{margin-top:10px;min-height:44px;padding:0 10px}
  .search-box input{min-height:44px;font-size:16px}
  .records-panel[data-searchable=false] .search-box{display:none}
  .records-list{margin:0;max-height:none;overflow:visible}
  .record-item{border:0;border-bottom:1px solid var(--line);border-radius:0;box-shadow:none;margin:0;padding:13px 0;text-align:left;background:transparent}
  .record-item:last-child{border-bottom:0}
  .record-top{gap:8px;flex-wrap:wrap}
  .record-date{flex:1;min-width:100px;font-size:16px;font-weight:600;white-space:nowrap}
  .record-sum{max-width:100%;overflow-wrap:anywhere;font-size:16px;font-weight:500}
  .record-top:after{content:"›";font-size:24px;font-weight:400;line-height:1;color:var(--muted)}
  .record-detail{font-size:14px;line-height:1.6;margin-top:4px}
  .record-bottom{display:none}
  .empty-state{padding:21px 0 23px}
  .empty-drawing,.desktop-empty-hint{display:none}
  .empty-state h3{font-size:16px;line-height:1.5;margin:0 0 5px}
  .empty-state .mobile-empty-hint{display:block;font-size:14px;line-height:1.6}

  .preview-toolbar{min-height:44px;padding:0;margin-bottom:8px;gap:8px}
  .preview-label,.live-badge{display:none}
  .preview-controls{width:100%;justify-content:space-between;gap:8px}
  .print-settings-button,.preview-zoom{display:inline-flex;min-height:44px;font-size:14px;padding:8px 4px;gap:7px}
  .paper-canvas{padding:8px;min-height:0;border-radius:8px}
  .print-sheet{min-height:320px;padding:18px 16px;box-shadow:none}
  .paper-preview{min-width:540px}
  .mobile-preview-hint{display:block;font-size:12px;line-height:1.5;margin:7px 1px 0;color:var(--muted)}
  .preview-footer,.paper-note{display:none}

  .mobile-actionbar{display:flex;gap:10px;padding:9px 12px calc(9px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:#ffffffed;backdrop-filter:blur(10px);position:fixed;bottom:0;left:0;right:0;z-index:5}
  .mobile-actionbar .button{width:50%;min-height:48px;padding:10px 14px;font-size:16px}
  .toast{bottom:calc(78px + env(safe-area-inset-bottom));font-size:14px}
  .notice{font-size:14px;margin-bottom:8px;padding:10px 12px}

  .modal{width:100%;max-width:100%;max-height:calc(100dvh - 8px);margin:0;top:auto;bottom:0;border-radius:13px 13px 0 0;border-bottom:0}
  .modal[data-kind=editor]{height:100dvh;max-height:100dvh;top:0;border:0;border-radius:0}
  .modal-head{padding:10px 12px;gap:8px}
  .modal-head h2{font-size:20px;line-height:1.4}
  .modal-head p{font-size:12px;line-height:1.5;margin-top:2px}
  .modal-body{padding:8px 12px 12px}
  .modal-foot{padding:8px 12px calc(8px + env(safe-area-inset-bottom));gap:8px}
  .modal .button{min-height:46px;font-size:16px}
  .field{gap:4px;margin-bottom:8px}
  .field>label,.field-label{font-size:15px}
  .field input,.field textarea,.field select{font-size:17px;min-height:44px;padding:7px 11px}
  .field textarea{height:44px;min-height:44px;max-height:220px;line-height:1.5;resize:vertical}
  .expense-field{padding-top:8px;margin-top:0}
  .expense-field h3{font-size:16px;line-height:1.35;margin-bottom:4px}
  .expense-inputs{grid-template-columns:minmax(0,1fr) 110px;gap:9px}
  .expense-inputs .field>label{font-size:12px;line-height:1.3}
  .expense-inputs textarea{min-height:40px;height:40px}
  .amount-wrap input{padding-left:26px}
  .amount-wrap .currency{left:10px;top:9px}
  .editor-total{margin-top:14px;padding-top:12px}
  .editor-total strong{font-size:22px}
  .editor-foot{justify-content:space-between}
  .editor-foot .danger{width:44px;min-height:48px;padding:10px}
  .editor-foot .foot-actions{display:flex;gap:8px;justify-content:flex-end;flex:1}
  .editor-foot .foot-actions .button{padding:9px 12px;font-size:15px}
  .column-item{padding:8px 0;gap:4px}
  .column-item strong{font-size:15px;overflow-wrap:anywhere}
  .column-type{font-size:12px;margin:0}
  .column-actions{flex-shrink:0}
  .column-actions .icon-button{width:44px;height:44px}
  .column-actions svg{width:18px;height:18px}
  .column-list{margin-bottom:14px}
  .modal[data-kind=columns] .tip{display:none}
  .add-column-form{padding:12px}
  .add-column-form h3{margin-bottom:10px}
  .preset-chips{gap:6px;margin-bottom:10px}
  .preset-chips button{min-height:44px;font-size:14px;padding:7px 9px}
  .export-option{padding:12px;gap:12px;margin-bottom:10px}
  .export-option strong{font-size:17px}
  .export-option small{font-size:13px;line-height:1.5;margin-top:2px}
  .option-icon{width:40px;height:40px;border-radius:8px}
  .settings-grid{gap:0 12px}
  .tip{padding:10px 12px;font-size:13px;margin-bottom:12px}
  .checkbox-field{min-height:44px;margin:0 0 12px}
}

@media screen and (max-width:350px){
  .view-tabs{gap:16px}
  .mobile-tabs .mobile-column-trigger{font-size:13px}
  .compact-total strong{font-size:18px}
  .expense-inputs{grid-template-columns:minmax(0,1fr) 98px;gap:8px}
}
