/* TermToGo · 手机界面通用组件（取自设计稿 assets/mobile.css，去掉了手机外框，改成真实全屏 + 安全区） */
:root { --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { font-size: 15px; -webkit-tap-highlight-color: transparent; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.app { position: fixed; left: 0; right: 0; top: 0; height: 100%; height: 100dvh; display: flex; flex-direction: column; padding-top: var(--sat); padding-left: var(--sal); padding-right: var(--sar); background: var(--bg); color: var(--fg); }

/* top bar */
.tbar { height: 52px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 8px; position: relative; }
.tbar .ttl { flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 4px; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbar .ttl.center { justify-content: center; text-align: center; }
.ibtn { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--fg); flex: none; }
.ibtn svg { width: 22px; height: 22px; }
.ibtn:active { background: var(--fg-soft-2); }
.ibtn:disabled { opacity: .35; }
.tlink { height: 44px; padding: 0 10px; border-radius: 10px; font-size: 16px; color: var(--fg); font-weight: 500; }
.tlink.accent { color: color-mix(in oklch, var(--accent) 70%, var(--fg)); font-weight: 600; }
.tlink:active { background: var(--fg-soft); }
@media (hover: hover) { .ibtn:hover, .tlink:hover { background: var(--fg-soft); } }

/* buttons */
.btn { height: 48px; padding: 0 20px; border-radius: 14px; font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--accent-fill); color: var(--on-fill); }
.btn.primary:active { background: color-mix(in oklch, var(--accent-fill) 85%, black); }
.btn.secondary { background: var(--fg-soft); color: var(--fg); }
.btn.secondary:active { background: var(--fg-soft-2); }
.btn.danger { background: var(--danger); color: var(--on-fill); }
.btn.text { color: var(--fg); background: transparent; }
.btn.text:active { background: var(--fg-soft); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .4; }

/* list cells (settings) */
.mgroup-t { font-size: 13px; color: var(--muted); padding: 18px 20px 6px; font-weight: 500; }
.mgroup { margin: 0 16px; background: var(--surface); border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--border); }
.cell { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 52px; width: 100%; text-align: left; font-size: 16px; }
.cell + .cell { border-top: 1px solid var(--border); }
.cell .cl { flex: 1; min-width: 0; padding: 12px 0; }
.cell .cl .d { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.cell .cv { color: var(--muted); font-size: 15px; white-space: nowrap; }
.cell .chev { width: 16px; height: 16px; color: var(--muted); }
.cell .chev svg { width: 16px; height: 16px; }
button.cell:active { background: var(--fg-soft); }
.cell.danger { color: var(--danger); justify-content: center; }
.mgroup-n { font-size: 12.5px; color: var(--muted); padding: 8px 20px 0; line-height: 1.5; }

/* scrim + sheets + dialogs + menus（固定定位，盖在整个页面上） */
.mscrim { position: fixed; inset: 0; background: oklch(0% 0 0 / .4); z-index: 120; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; overflow-x: hidden; z-index: 130; background: var(--surface); color: var(--fg); border-radius: 22px 22px 0 0; padding: 8px var(--sar) calc(var(--sab) + 12px) var(--sal); animation: up .26s cubic-bezier(.2,.9,.3,1); box-shadow: 0 -8px 30px oklch(0% 0 0 / .15); max-height: 88%; overflow: auto; overscroll-behavior: contain; }
@media (min-width: 600px) { .sheet { left: 50%; width: 560px; margin-left: -280px; } }
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--fg-soft-2); margin: 0 auto 8px; }
.sheet h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin: 6px 20px 4px; }
.sheet .sd { font-size: 14px; color: var(--muted); margin: 0 20px 14px; }
@keyframes up { from { transform: translateY(100%); } }
.mdialog { position: fixed; left: 50%; top: 50%; width: min(300px, calc(100vw - 40px)); transform: translate(-50%, -50%); z-index: 130; background: var(--surface); color: var(--fg); border-radius: 20px; padding: 22px 20px 16px; box-shadow: 0 20px 50px oklch(0% 0 0 / .3); animation: pop .2s; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.94); opacity: 0; } }
.mdialog h3 { font-family: var(--font-display); margin: 0 0 8px; font-size: 18px; font-weight: 700; line-height: 1.35; word-break: break-all; }
.mdialog p { margin: 0 0 18px; font-size: 14.5px; color: var(--muted); line-height: 1.55; }
.mdialog .dbtns { display: flex; gap: 10px; }
.mdialog .dbtns .btn { flex: 1; height: 46px; padding: 0 10px; }
.mdialog .dbtns.stack { flex-direction: column; }
.mmenu { position: fixed; z-index: 130; min-width: 196px; max-width: calc(100vw - 16px); background: var(--surface); color: var(--fg); border-radius: 14px; box-shadow: 0 0 0 1px var(--border), 0 14px 40px oklch(0% 0 0 / .22); padding: 6px; animation: pop2 .16s; }
@keyframes pop2 { from { opacity: 0; transform: scale(.96); } }
.mmenu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 0 12px; border-radius: 10px; font-size: 15.5px; text-align: left; }
.mmenu button svg { width: 20px; height: 20px; color: var(--muted); }
.mmenu button:active { background: var(--fg-soft); }
.mmenu button.danger { color: var(--danger); }
.mmenu button.danger svg { color: var(--danger); }
.mmenu button:disabled { opacity: .4; }
.mmenu hr { border: 0; height: 1px; background: var(--border); margin: 4px 6px; }
.mmenu .fsx { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 6px 0 12px; font-size: 15.5px; }
.mmenu .fsx svg { width: 20px; height: 20px; color: var(--muted); }
.mmenu .fsx span.l { flex: 1; }
.mmenu .fsx button { width: 40px; min-height: 36px; height: 36px; padding: 0; justify-content: center; background: var(--fg-soft); font-family: var(--font-mono); font-size: 14px; }
.mmenu .fsx b { font-family: var(--font-mono); min-width: 24px; text-align: center; }
.mtoast { position: fixed; left: 50%; bottom: calc(var(--sab) + 96px); transform: translateX(-50%); background: color-mix(in oklch, var(--fg) 90%, transparent); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 160; white-space: nowrap; animation: fade .2s; max-width: 92%; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }

.mfield { width: 100%; height: 50px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--fg); padding: 0 14px; font-size: 16px; }
.mfield:focus { outline: none; border-color: var(--accent-fill); box-shadow: 0 0 0 3px var(--accent-soft); }
.ferr { color: var(--danger); font-size: 13px; min-height: 18px; }
