/* 全站共用尺寸與色彩變數 */
:root {
  --app-sidebar-width: 270px;
  --app-radius: 18px;
  --app-bg: #f5f7fb;
  --app-panel: #ffffff;
  --app-text: #172033;
  --app-muted: #64748b;
  --app-border: #e2e8f0;
  --app-accent: #315efb;
}
html, body { min-height: 100%; }
body { background: var(--app-bg); color: var(--app-text); }
/* 桌面版採固定側欄與內容區配置 */
.app-shell { min-height: 100vh; }
.app-sidebar { width: var(--app-sidebar-width); position: fixed; inset: 0 auto 0 0; background: #111827; color: #fff; padding: 1rem; overflow-y: auto; z-index: 1030; }
.app-main { margin-left: var(--app-sidebar-width); min-height: 100vh; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: rgba(255,255,255,.12); }
.app-nav .nav-link { color: #cbd5e1; border-radius: 12px; padding: .72rem .8rem; display: flex; gap: .7rem; align-items: center; }
.app-nav .nav-link:hover, .app-nav .nav-link.active { color: #fff; background: rgba(255,255,255,.1); }
.app-nav .nav-link i { width: 22px; text-align: center; }
.app-card { border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-panel); box-shadow: 0 8px 28px rgba(15,23,42,.04); }
.form-label { font-weight: 650; }
.form-text { color: var(--app-muted); }
textarea.form-control, pre.output-box { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .875rem; }
textarea.form-control { min-height: 150px; resize: vertical; }
.output-box { background: #0f172a; color: #dbeafe; border-radius: 14px; padding: 1rem; min-height: 120px; max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.action-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.field-tools { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .45rem; }
.field-tools .btn { --bs-btn-padding-y: .2rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .78rem; }
.status-dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; background: #94a3b8; }
.status-dot.ok { background: #16a34a; }
.footer-tech { border-top: 1px solid var(--app-border); background: #fff; }
.footer-tech .collapse-body { padding: 1rem 0 1.4rem; }
.mobile-topbar { display: none; }
.badge-soft { background: #eef2ff; color: #3730a3; }
.toast-container { z-index: 2000; }
.section-pane { display: none; }
.section-pane.active { display: block; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .75rem; }
.kv-item { border: 1px solid var(--app-border); border-radius: 12px; padding: .8rem; }
.kv-item .k { color: var(--app-muted); font-size: .8rem; }
.kv-item .v { font-weight: 650; overflow-wrap: anywhere; }
.help-callout { border-left: 4px solid var(--app-accent); background: #eef4ff; border-radius: 0 12px 12px 0; padding: .8rem 1rem; }
.spinner-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.25); display: none; align-items: center; justify-content: center; z-index: 1990; backdrop-filter: blur(2px); }
.spinner-overlay.show { display: flex; }
.spinner-card { background: #fff; border-radius: 16px; padding: 1.2rem 1.5rem; box-shadow: 0 15px 45px rgba(0,0,0,.16); }
/* 平板與手機改用頂部工具列與橫向功能選單 */
@media (max-width: 991.98px) {
  .app-sidebar { display: none; }
  .app-main { margin-left: 0; padding-top: 64px; }
  .mobile-topbar { display: flex; position: fixed; inset: 0 0 auto 0; height: 64px; z-index: 1040; background: #111827; color: #fff; align-items: center; padding: .5rem .75rem; gap: .6rem; }
  .mobile-nav { overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav .btn { white-space: nowrap; }
  .kv-grid { grid-template-columns: 1fr; }
  textarea.form-control { min-height: 130px; }
}
/* 窄螢幕放大可點擊區域並減少邊距 */
@media (max-width: 575.98px) {
  .container-fluid.app-content { padding-left: .75rem; padding-right: .75rem; }
  .app-card { border-radius: 14px; }
  .action-row .btn { flex: 1 1 calc(50% - .5rem); }
  .field-tools .btn { flex: 1 1 auto; }
  .display-6 { font-size: 1.65rem; }
}
