/* A compact mobile page. Optional inputs open in a separate panel. */
:root{--background:#f3f6fb;--foreground:#26354a;--card:#fff;--card-foreground:#26354a;--primary:#376fd5;--primary-foreground:#fff;--secondary:#eaf0fb;--secondary-foreground:#315f9f;--border:#e1e7f0;--field:#f8fafd;--muted-foreground:#67768c;--soft-shadow:none}
.dark{--background:#171c25;--foreground:#e8edf5;--card:#202733;--card-foreground:#e8edf5;--popover:#252d3b;--popover-foreground:#e8edf5;--primary:#78a5f0;--primary-foreground:#17263d;--secondary:#29364a;--secondary-foreground:#bfd5f9;--muted:#242d3b;--muted-foreground:#a2b0c4;--accent:#29364a;--accent-foreground:#e8edf5;--border:#333e4d;--input:#3b4758;--ring:#78a5f0;--field:#1b222d;--soft-shadow:none;color-scheme:dark}
html,body,#root{height:100%;width:100%;overflow:hidden;overscroll-behavior:none}
body{margin:0;background:var(--background)}
.app-shell{position:fixed;top:var(--app-top,0px);left:50%;transform:translateX(-50%);height:var(--app-height,100dvh);max-width:620px;width:100%;margin:0 auto;padding:0 16px max(8px,env(safe-area-inset-bottom));display:flex;flex-direction:column;overflow:hidden}
.app-header{height:66px;min-height:66px;gap:6px;margin:0;flex:none}
.brand{gap:9px}.brand-icon{width:36px;height:36px;border-radius:12px;background:var(--primary);color:var(--primary-foreground)}
.brand strong{font-size:21px;line-height:1.25}.brand strong span{font-size:13px;padding-left:9px;margin-left:9px;letter-spacing:0}.app-header .theme-button{width:40px;height:44px}
.app-shell>main{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}
.journal-tabs{display:flex;flex-direction:column;flex:1;min-height:0;gap:10px}
.main-tabs{height:46px;min-height:46px;padding:4px;flex:none;border-radius:14px;background:var(--muted);margin:0}
.main-tabs [data-slot=tabs-trigger]{height:38px;border-radius:10px;gap:6px;font-size:14px}
.write-panel[data-state=active]{display:flex;flex:1;min-height:0;flex-direction:column;gap:8px;margin:0}
.write-panel>.paper-card{display:flex;flex:1;min-height:0;max-height:560px;margin:0;border-radius:18px;padding:18px;background:var(--card);box-shadow:none}
.entry-form{width:100%;min-height:0;display:flex;flex-direction:column;flex:1}
.entry-form>fieldset{border:0;padding:0;margin:0;display:flex;flex-direction:column;gap:16px;min-width:0;min-height:0;flex:1}
.entry-form .form-pair{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;flex:none}
.entry-form .field{margin:0;min-width:0}
.field label,.field-label{font-size:13px;line-height:1.5;margin:0 0 7px;display:block;color:var(--foreground)}
.field input{height:46px;min-width:0;width:100%;padding:10px 11px;font-size:16px;border-radius:10px}
.direction-group{height:46px;gap:6px}.direction-group .direction{min-height:46px;height:46px;border-radius:10px;font-size:14px!important;padding:0 4px}
.direction-group .direction.active{background:var(--primary);color:var(--primary-foreground);border-color:var(--primary)}
.entry-form .reason-field{display:flex;flex-direction:column;flex:1;min-height:95px}
.entry-form .reason-input{flex:1;height:0;min-height:60px;max-height:none;resize:none;padding:12px;border-radius:12px;font-size:16px;line-height:1.65}
.optional-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;flex:none}
.optional-fields button{height:56px;min-width:0;padding:6px;border:1px solid var(--border);border-radius:10px;background:var(--field);color:var(--foreground);text-align:center;touch-action:manipulation}
.optional-fields button span{display:block;font-size:13px;line-height:1.5}.optional-fields small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--muted-foreground);font-size:11px;line-height:1.5}
.optional-fields button:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.entry-form .save-area{display:flex;gap:8px;margin:0;flex:none}.entry-form .save-button{height:48px;border-radius:11px;flex:1;width:auto;font-size:15px}.entry-form .cancel-button{height:48px;width:auto;margin:0}
.quiet-footer{display:block;flex:none;text-align:center;margin:0;font-size:11px;line-height:18px;color:var(--muted-foreground)}
.update-strip{display:flex;align-items:center;gap:8px;flex:none;min-height:44px;font-size:12px;color:var(--muted-foreground)}.update-strip span{flex:1}.update-strip button{height:40px;min-width:64px}
.records-panel[data-state=active]{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;margin:0;padding:0 0 8px;scrollbar-width:thin}
.records-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:6px 0 14px}.records-heading h1{font-size:21px}.excel-button{height:42px;background:var(--card);font-size:13px;padding:0 11px;border-radius:10px}
.records-panel .search-box{margin-bottom:12px}.records-panel .record-card{padding:15px;border-radius:14px}.records-panel .record-list{gap:10px}
.records-panel .detail-toolbar{margin:0 0 8px}.records-panel .detail-title{margin:0 0 14px}.records-panel .detail-title h1{font-size:23px}.records-panel .paper-card{padding:18px;border-radius:16px}.records-panel .detail-section p{font-size:15px;line-height:1.7}
.is-editing .records-panel[data-state=active]{display:flex;flex-direction:column;overflow:hidden}.is-editing .detail-view{display:flex;flex:1;min-height:0;flex-direction:column}.is-editing .detail-title{display:none}.is-editing .detail-view>.paper-card{display:flex;flex:1;min-height:0;margin:0}
[data-slot=dialog-content].entry-dialog{top:calc(var(--app-top,0px) + var(--app-height,100dvh)/2);display:flex;flex-direction:column;gap:16px;padding:20px;width:calc(100% - 28px);max-width:460px;max-height:calc(var(--app-height,100dvh) - 28px);overflow:hidden;border-radius:18px}
.entry-dialog [data-slot=dialog-title]{font-size:18px}.entry-dialog [data-slot=dialog-description]{font-size:12px;margin-top:4px}
.entry-dialog-body{display:flex;flex-direction:column;gap:14px;min-height:0;overflow-y:auto;overscroll-behavior:contain}
.entry-dialog-body .field{margin:0;min-width:0}.entry-dialog .emotion-field{display:flex;flex-direction:column;min-height:0}.entry-dialog textarea{height:clamp(90px,27dvh,230px);max-height:calc(var(--app-height,100dvh) - 210px);min-height:65px;resize:none;font-size:16px;line-height:1.65;padding:12px}
.entry-dialog .price-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 12px}.entry-dialog .field small{font-size:11px;margin-top:5px;color:var(--muted-foreground)}
.dialog-done{height:46px;min-height:46px;width:100%;flex:none;border-radius:11px}
.pwa-dialog{top:calc(var(--app-top,0px) + var(--app-height,100dvh)/2);max-height:calc(var(--app-height,100dvh) - 28px);padding:22px!important}.export-tools .small-note{margin-top:8px}.pwa-dialog .tool-action{margin-top:8px}.pwa-dialog .small-note{font-size:12px;line-height:1.65}
.error-message{flex:none;margin:0;padding:8px 12px;font-size:12px;max-height:65px;overflow:auto}
.keyboard-open .app-header,.keyboard-open .main-tabs,.keyboard-open .quiet-footer{display:none}
.keyboard-open .app-shell{padding-top:6px}.keyboard-open .write-panel>.paper-card{padding:12px}
.keyboard-open .entry-form>fieldset{gap:9px}.keyboard-open .optional-fields button{height:44px}.keyboard-open .entry-form .reason-field{min-height:70px}
@media(max-height:680px){.app-header{height:56px;min-height:56px}.journal-tabs{gap:8px}.write-panel>.paper-card{padding:14px}.entry-form>fieldset{gap:12px}.optional-fields button{height:48px}.quiet-footer{font-size:10px}}
@media(max-width:360px){.app-shell{padding-left:10px;padding-right:10px}.brand strong span{font-size:12px;padding-left:7px;margin-left:7px}.brand-icon{width:32px;height:32px}.brand strong{font-size:19px}.entry-form .form-pair{gap:8px}.optional-fields{gap:5px}.optional-fields button span{font-size:12px}}

/* Keep the save action visible when a mobile keyboard uses most of the screen. */
.keyboard-open .update-strip{display:none}
.keyboard-open .entry-form .reason-field{min-height:87px}
.short-viewport .app-header,.short-viewport .main-tabs,.short-viewport .quiet-footer,.short-viewport .update-strip{display:none}
.short-viewport .app-shell{padding-top:4px;padding-bottom:4px}
.short-viewport .journal-tabs{gap:6px}
.short-viewport .write-panel>.paper-card,.short-viewport .detail-view>.paper-card{padding:8px}
.short-viewport .entry-form>fieldset{gap:6px}
.short-viewport .entry-form .field label,.short-viewport .entry-form .field-label{font-size:12px;line-height:18px;margin-bottom:4px}
.short-viewport .entry-form .field input,.short-viewport .direction-group,.short-viewport .direction-group .direction{height:44px;min-height:44px}
.short-viewport .entry-form .reason-field{min-height:62px}
.short-viewport .entry-form .reason-input{min-height:40px;padding:6px 10px;line-height:1.4}
.short-viewport .optional-fields button{height:40px;padding:5px}
.short-viewport .optional-fields small{display:none}
.short-viewport .entry-form .save-button,.short-viewport .entry-form .cancel-button{height:44px}
.short-viewport .error-message{max-height:36px;padding:5px 9px}
.short-viewport .is-editing .detail-toolbar{margin:0;height:36px;min-height:36px}.short-viewport .is-editing .detail-toolbar button{height:36px}
