/* 2026 UI refinement: presentation only; data, form and print behaviour stay in their page modules. */
@media screen {
  body[data-ui-family] {
    --ui-accent: #2459bc;
    --ui-accent-soft: #eaf1ff;
    --ui-panel: #fff;
    --ui-border: #e2e7f0;
    --ui-shadow: 0 14px 42px rgba(28, 42, 75, .075);
    --ui-shadow-hover: 0 20px 46px rgba(28, 42, 75, .14);
    --ui-muted: #65728a;
    -webkit-font-smoothing: antialiased;
  }
  html[data-theme="dark"] body[data-ui-family] {
    --ui-accent: #70f0cb;
    --ui-accent-soft: #153c3a;
    --ui-panel: #111b30;
    --ui-border: #2a3957;
    --ui-shadow: 0 16px 44px rgba(0, 0, 0, .27);
    --ui-shadow-hover: 0 22px 56px rgba(0, 0, 0, .4);
    --ui-muted: #9dabca;
  }
  body[data-ui-family] ::selection { background: #75eac8; color: #071c25; }
  body[data-ui-family] :is(button, a, input, select, textarea, summary):focus-visible {
    outline: 3px solid var(--ui-accent);
    outline-offset: 3px;
  }
  body[data-ui-family] :is(button, a, input, select, textarea):disabled { cursor: not-allowed; }
  body[data-ui-family] :is(button, a) { -webkit-tap-highlight-color: transparent; }
  body[data-ui-family] .ui-icon { display: inline-grid; place-items: center; flex: none; width: 17px; height: 17px; vertical-align: -.2em; }
  body[data-ui-family] .ui-icon svg { display: block; width: 100%; height: 100%; }

  .ui-skip { position: fixed; z-index: 1000; top: -100px; left: 16px; padding: 11px 17px; border-radius: 12px; background: #70f0cb; color: #092020 !important; font-weight: 800; text-decoration: none; box-shadow: 0 8px 25px #0005; }
  .ui-skip:focus { top: 12px; }
  .ui-reading-progress { position: fixed; z-index: 1001; inset: 0 auto auto 0; width: 0; height: 3px; background: linear-gradient(90deg, #5a9df8, #70f0cb); box-shadow: 0 0 13px #70f0cb88; pointer-events: none; }
  .ui-back-top { position: fixed; z-index: 29; right: max(18px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 1px solid var(--ui-border); border-radius: 15px; background: var(--ui-panel); color: var(--ui-accent); box-shadow: var(--ui-shadow); font-size: 22px; font-weight: 800; line-height: 1; opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity .2s, transform .2s, visibility .2s, border-color .2s; }
  .ui-back-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
  .ui-back-top:hover { border-color: var(--ui-accent); transform: translateY(-3px); }
  .ui-back-top .ui-icon { width: 21px !important; height: 21px !important; }

  /* Community / defect / fee application pages */
  body[data-ui-family="app"] .shell { padding-top: clamp(24px, 3.2vw, 46px); }
  body[data-ui-family="app"] .page-head { position: relative; isolation: isolate; overflow: hidden; padding: clamp(22px, 3.1vw, 34px); border: 1px solid var(--ui-border); border-radius: 22px; background: linear-gradient(118deg, var(--ui-panel) 0%, var(--ui-panel) 62%, var(--ui-accent-soft) 100%); box-shadow: var(--ui-shadow); }
  body[data-ui-family="app"] .page-head::after { content: ""; position: absolute; z-index: -1; right: -76px; bottom: -155px; width: 310px; height: 310px; border: 1px solid var(--ui-accent); border-radius: 50%; opacity: .13; box-shadow: 0 0 0 42px var(--ui-accent-soft), 0 0 0 86px var(--ui-accent-soft); pointer-events: none; }
  body[data-ui-family="app"] .page-head > div:first-child { max-width: 780px; }
  body[data-ui-family="app"] .page-head h1 { margin: 12px 0 9px; font-size: clamp(27px, 3vw, 39px); line-height: 1.19; letter-spacing: -.035em; }
  body[data-ui-family="app"] .page-head p { max-width: 65ch; line-height: 1.8; }
  body[data-ui-family="app"] .page-head .actions { position: relative; z-index: 1; align-self: flex-start; }
  body[data-ui-family="app"] .page-head #logout { display: none !important; }
  .ui-context { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 19px; }
  .ui-context span { display: inline-flex; align-items: center; gap: 7px; min-height: 27px; padding: 3px 10px; border: 1px solid var(--ui-border); border-radius: 999px; background: color-mix(in srgb, var(--ui-panel) 85%, transparent); color: var(--ui-muted); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
  .ui-context span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ui-accent); }
  body[data-ui-family="app"] .hero { border: 1px solid #344a6a; border-radius: 24px; box-shadow: 0 28px 65px #101a3140; }
  body[data-ui-family="app"] .hero h1 { letter-spacing: -.04em; line-height: 1.17; }
  body[data-ui-family="app"] .hero .btn { min-height: 47px; }
  body[data-ui-page="home"] .distribution .panel-title h2 > .ui-icon { color: #57e1c7; background: #143c38; }
  body[data-ui-page="home"] .distribution .donut::before { width: 62%; height: 62%; }
  body[data-ui-page="home"] .distribution .donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
  body[data-ui-family="app"] .ui-process { display: grid; grid-template-columns: minmax(190px, .7fr) minmax(0, 2fr); gap: 20px; align-items: center; margin: 18px 0 2px; padding: 17px 22px; border: 1px solid var(--ui-border); border-radius: 17px; background: var(--ui-panel); box-shadow: var(--ui-shadow); }
  body[data-ui-family="app"] .ui-process-heading strong { display: block; margin-top: 8px; font-size: 15px; letter-spacing: -.02em; }
  body[data-ui-family="app"] .ui-process-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
  body[data-ui-family="app"] .ui-process-steps > li { position: relative; min-width: 0; padding: 10px 12px 10px 43px; border-left: 1px solid var(--ui-border); }
  body[data-ui-family="app"] .ui-process-steps span { position: absolute; top: 11px; left: 13px; color: var(--ui-accent); font-size: 11px; font-weight: 850; font-variant-numeric: tabular-nums; }
  body[data-ui-family="app"] .ui-process-steps strong, body[data-ui-family="app"] .ui-process-steps small { display: block; }
  body[data-ui-family="app"] .ui-process-steps strong { font-size: 13px; }
  body[data-ui-family="app"] .ui-process-steps small { margin-top: 3px; color: var(--ui-muted); font-size: 11px; }
  body[data-ui-family="app"] .stats { gap: clamp(10px, 1.35vw, 19px); }
  body[data-ui-family="app"] .stat { position: relative; min-width: 0; overflow: hidden; padding: 21px 22px; border: 1px solid var(--ui-border); border-radius: 17px; box-shadow: var(--ui-shadow); transition: transform .2s, box-shadow .2s, border-color .2s; }
  body[data-ui-family="app"] .stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--ui-accent), #78a7ff); opacity: .85; }
  body[data-ui-family="app"] .stat.warn::before { background: linear-gradient(90deg, #eaa95a, #ff8a8a); }
  body[data-ui-family="app"] .stat:hover { transform: translateY(-2px); border-color: var(--ui-accent); box-shadow: var(--ui-shadow-hover); }
  body[data-ui-family="app"] .stat strong { font-size: clamp(29px, 3vw, 40px); line-height: 1.25; font-variant-numeric: tabular-nums; }
  body[data-ui-family="app"] .stat label > .ui-icon, body[data-ui-family="app"] .panel-title h2 > .ui-icon, body[data-ui-family="app"] .section-label > .ui-icon { box-sizing: border-box; width: 23px; height: 23px; padding: 4px; color: #116b61; background: #e3f5ef; border: 1px solid #b8e9db; border-radius: 8px; }
  body[data-ui-family="app"] .stat label > .ui-icon { width: 21px; height: 21px; padding: 3px; }
  body[data-ui-family="app"] .entry h2 > .ui-icon { box-sizing: border-box; width: 34px; height: 34px; padding: 8px; color: #073d3a; background: linear-gradient(140deg, #9becd1, #b7d8f0); box-shadow: 0 7px 16px #5dc2ad29; border-radius: 11px; }
  body[data-ui-family="app"] .btn > .ui-icon { width: 16px; height: 16px; }
  body[data-ui-family="app"] .mode-icon > .ui-icon { width: 21px; height: 21px; }
  body[data-ui-family="app"] .panel, body[data-ui-family="app"] .entry { border-radius: 18px; border-color: var(--ui-border); box-shadow: var(--ui-shadow); }
  body[data-ui-family="app"] .panel-title { min-height: 69px; padding: 18px clamp(18px, 2.2vw, 28px); gap: 14px; }
  body[data-ui-family="app"] .panel-title h2 { font-size: 17px; letter-spacing: -.015em; }
  body[data-ui-family="app"] .entry { padding: 25px; transition: transform .2s, box-shadow .2s, border-color .2s; }
  body[data-ui-family="app"] .entry:hover { box-shadow: var(--ui-shadow-hover); }
  body[data-ui-family="app"] .entry .arrow { font-weight: 700; }
  body[data-ui-family="app"] .btn { min-height: 41px; border-radius: 10px; font-weight: 700; transition: transform .18s, box-shadow .18s, border-color .18s, background .18s; }
  body[data-ui-family="app"] .btn:hover:not(:disabled) { transform: translateY(-2px); }
  body[data-ui-family="app"] .btn:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
  body[data-ui-family="app"] :is(.field input, .field select, .field textarea) { min-height: 42px; border-radius: 10px; transition: border-color .18s, box-shadow .18s; }
  body[data-ui-family="app"] .field label { font-size: 12px; font-weight: 750; }
  body[data-ui-family="app"] .filters { gap: 16px; }
  body[data-ui-family="app"] :is(.upload, .fa-drop) { border-radius: 15px; transition: border-color .2s, background .2s, transform .2s; }
  body[data-ui-family="app"] :is(.upload, .fa-drop):hover { transform: translateY(-2px); }
  body[data-ui-family="app"] :is(.table-wrap, .fa-matrix-wrap) { scrollbar-color: var(--ui-border) transparent; scrollbar-width: thin; }
  body[data-ui-family="app"] table th { font-weight: 750; letter-spacing: .025em; }
  body[data-ui-family="app"] table td { line-height: 1.55; }
  body[data-ui-family="app"] .empty { padding: 48px 22px; line-height: 1.8; }
  body[data-ui-family="app"] .notice:not(:empty) { line-height: 1.7; }
  body[data-ui-family="app"] .notice:empty { margin: 0; padding: 0; border: 0; }
  body[data-ui-family="app"] :is(.notice.error, .notice.success):not(:empty) { padding: 10px 13px; border-radius: 10px; border: 1px solid currentColor; background: color-mix(in srgb, currentColor 8%, transparent); }
  body[data-ui-family="app"] .login { border-radius: 20px; box-shadow: var(--ui-shadow-hover); }
  body[data-ui-family="app"] dialog { border-radius: 20px; }
  body[data-ui-family="app"] .fa-view-switch { padding: 5px; border: 1px solid var(--ui-border); border-radius: 13px; background: var(--ui-panel); box-shadow: var(--ui-shadow); width: fit-content; }
  body[data-ui-family="app"] .fa-view-switch .btn { border-radius: 9px; }
  body[data-ui-family="app"] .fa-note { line-height: 1.75; }
  body[data-ui-family="app"] .fa-matrix td, body[data-ui-family="app"] .fa-matrix th { font-variant-numeric: tabular-nums; }
  /* Preserve the fee workspace's explicit large-text control and touch targets. */
  body.fee-wide[data-ui-family="app"] .page-head h1 { font-size: calc(38px * var(--fs)); }
  body.fee-wide[data-ui-family="app"] .panel-title h2 { font-size: calc(24px * var(--fs)); }
  body.fee-wide[data-ui-family="app"] .stat { padding: 24px 28px; }
  body.fee-wide[data-ui-family="app"] .stat strong { font-size: calc(64px * var(--fs)); line-height: 1.1; }
  body.fee-wide[data-ui-family="app"] .btn { min-height: 48px; }
  body.fee-wide[data-ui-family="app"] .btn.small { min-height: 44px; }
  body.fee-wide[data-ui-family="app"] .field label { font-size: calc(15px * var(--fs)); }
  body.fee-wide[data-ui-family="app"] :is(.field input, .field select, .field textarea) { min-height: 46px; }
  html[data-theme="dark"] body[data-ui-family="app"] .page-head { background: linear-gradient(116deg, #15223b 0%, #111b30 67%, #143634 100%); }
  html[data-theme="dark"] body[data-ui-family="app"] .ui-context span { background: #1a2944; }
  html[data-theme="dark"] body[data-ui-family="app"] .stat label > .ui-icon, html[data-theme="dark"] body[data-ui-family="app"] .panel-title h2 > .ui-icon, html[data-theme="dark"] body[data-ui-family="app"] .section-label > .ui-icon { color: #8ce8d1; background: #173d3a; border-color: #2b7468; }

  /* Financial report: polished, but retain the underlying printable tables. */
  body[data-ui-family="report"] > .max-w-6xl { max-width: 1220px; }
  body[data-ui-family="report"] > .max-w-6xl > header { position: relative; overflow: hidden; padding: clamp(22px, 3vw, 34px); border: 1px solid var(--ui-border); border-radius: 22px; background: linear-gradient(118deg, var(--ui-panel), var(--ui-accent-soft)); box-shadow: var(--ui-shadow); }
  body[data-ui-family="report"] > .max-w-6xl > header::after { content: ""; position: absolute; right: -55px; top: -100px; width: 240px; height: 240px; border: 1px solid var(--ui-accent); border-radius: 50%; opacity: .18; box-shadow: 0 0 0 34px var(--ui-accent-soft); }
  body[data-ui-family="report"] > .max-w-6xl > header h1 { position: relative; z-index: 1; font-size: clamp(27px, 3vw, 39px); letter-spacing: -.035em; }
  body[data-ui-family="report"] > .max-w-6xl > header p { position: relative; z-index: 1; margin-top: 7px; line-height: 1.7; }
  body[data-ui-family="report"] .rounded-2xl.bg-white { border: 1px solid var(--ui-border); box-shadow: var(--ui-shadow); }
  body[data-ui-family="report"] .rounded-2xl.bg-white h2 { letter-spacing: -.02em; }
  body[data-ui-family="report"] > .max-w-6xl > header h1 > .ui-icon { width: 39px; height: 39px; margin-right: 11px; padding: 8px; color: #0f7165; background: #dff5ec; border: 1px solid #c2e9d9; border-radius: 12px; vertical-align: -.22em; }
  body[data-ui-family="report"] .rounded-2xl.bg-white h2 > .ui-icon { width: 25px; height: 25px; margin-right: 8px; padding: 5px; color: #0f7165; background: #e8f5ef; border-radius: 8px; }
  body[data-ui-family="report"] .scenario-btn > .ui-icon { width: 17px; height: 17px; margin-right: 5px; color: #168472; }
  body[data-ui-family="report"] .scenario-btn, body[data-ui-family="report"] .wage-year { transition: transform .18s, border-color .18s, box-shadow .18s; }
  body[data-ui-family="report"] .scenario-btn:hover, body[data-ui-family="report"] .wage-year:hover { transform: translateY(-2px); border-color: var(--ui-accent); }
  body[data-ui-family="report"] :is(.scenario-btn, .wage-year)[aria-pressed="true"] { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ui-accent) 32%, transparent); }
  body[data-ui-family="report"] table { font-variant-numeric: tabular-nums; }
  body[data-ui-family="report"] .floorplan-frame { border-radius: 16px; }
  html[data-theme="dark"] body[data-ui-family="report"] > .max-w-6xl > header { background: linear-gradient(118deg, #15223b, #111b30 68%, #143634); }
  html[data-theme="dark"] body[data-ui-family="report"] :is(header h1, .rounded-2xl.bg-white h2) > .ui-icon { color: #80e7c9; background: #173e39; border-color: #2b7468; }

  /* Print-friendly document pages: only their screen frames are enhanced. */
  body[data-ui-page="sop"] .control-panel { border: 1px solid var(--ui-border); box-shadow: var(--ui-shadow); }
  body[data-ui-page="sop"] .control-panel h3 { letter-spacing: -.02em; }
  body[data-ui-page="sop"] .control-panel :is(h3, button) > .ui-icon { width: 17px; height: 17px; margin-right: 6px; color: #9cf0d4; }
  body[data-ui-page="sop"] .control-panel :is(input, select, button) { min-height: 42px; border-radius: 10px; }
  body[data-ui-page="sop"] .control-panel button { transition: transform .18s, filter .18s, box-shadow .18s; }
  body[data-ui-page="sop"] .control-panel button:hover { transform: translateY(-2px); filter: brightness(1.08); }
  body[data-ui-page="sop"] #main-page { box-shadow: 0 20px 64px #0002; }
  body[data-ui-page="gym"] main.page { box-shadow: 0 20px 60px #0002; }
  body[data-ui-page="gym"] .hero { position: relative; overflow: hidden; }
  body[data-ui-page="gym"] .hero::after { content: ""; position: absolute; right: -80px; top: -95px; width: 270px; height: 270px; border: 1px solid #ffffff50; border-radius: 50%; box-shadow: 0 0 0 35px #ffffff0b, 0 0 0 70px #ffffff09; pointer-events: none; }
  body[data-ui-page="gym"] .hero h1 > .ui-icon { width: 36px; height: 36px; margin-right: 9px; padding: 7px; border-radius: 11px; background: #ffffff2b; color: #fff; }
  body[data-ui-page="gym"] .section { scroll-margin-top: 90px; }
  body[data-ui-page="gym"] .time-box { font-variant-numeric: tabular-nums; letter-spacing: .035em; }
  body[data-ui-page="gym"] :is(.highlight, .mini-card, .time-box) { border-radius: 13px; }

  /* Author portfolio keeps its fixed dark identity. */
  body[data-ui-family="portfolio"] { --ui-accent: #70f0cb; --ui-accent-soft: #143c38; --ui-panel: #111b30; --ui-border: #2a3957; --ui-shadow: 0 16px 46px #0005; --ui-muted: #9dabca; }
  body[data-ui-family="portfolio"] .site-topbar { background: #0d1728f2 !important; border-bottom-color: #263451 !important; }
  body[data-ui-family="portfolio"] .hero { position: relative; }
  body[data-ui-family="portfolio"] .terminal { box-shadow: 0 30px 80px #0008, 0 0 0 1px #70f0cb22; }
  body[data-ui-family="portfolio"] .stat { border-top: 3px solid #70f0cb; box-shadow: var(--ui-shadow); }
  body[data-ui-family="portfolio"] .card { box-shadow: var(--ui-shadow); }
  body[data-ui-family="portfolio"] .tag { border-radius: 999px; }
  body[data-ui-family="portfolio"] .pagenav a:hover { transform: translateY(-2px); background: #17332f; }
  body[data-ui-family="portfolio"] :is(.hero .actions .btn, .pagenav a) > .ui-icon { margin-right: 7px; color: #91e8d3; }
  body[data-ui-family="portfolio"] .sectionHead h2 > .ui-icon { width: 26px; height: 26px; margin-right: 9px; padding: 5px; border-radius: 8px; color: #91e8d3; background: #183936; }

  /* Accessible fallback for the legacy monthly-fee redirect. */
  body[data-ui-page="fee-monthly"] { display: grid; min-height: 100vh; place-items: center; margin: 0; padding: 20px; background: radial-gradient(circle at 80% 0%, #192c51, transparent 38%), #090e1d; color: #eaf2ff; font: 15px/1.7 system-ui, "Microsoft JhengHei", sans-serif; }
  body[data-ui-page="fee-monthly"] .ui-redirect-card { width: min(100%, 480px); padding: 32px; border: 1px solid #2a3957; border-radius: 20px; background: #111b30; box-shadow: 0 24px 60px #0006; }
  body[data-ui-page="fee-monthly"] .ui-redirect-card span { color: #70f0cb; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
  body[data-ui-page="fee-monthly"] .ui-redirect-card h1 { margin: 8px 0; font-size: 27px; }
  body[data-ui-page="fee-monthly"] .ui-redirect-card p { margin: 0 0 22px; color: #9dabca; }
  body[data-ui-page="fee-monthly"] .ui-redirect-card a { display: inline-flex; padding: 10px 17px; border-radius: 10px; background: #70f0cb; color: #092020; font-weight: 800; text-decoration: none; }
}

@media screen and (max-width: 1100px) {
  body.fee-wide[data-ui-family="app"] .stat strong { font-size: calc(52px * var(--fs)); }
}
@media screen and (max-width: 820px) {
  body[data-ui-family="app"] .page-head { flex-direction: column; align-items: flex-start; }
  body[data-ui-family="app"] .page-head .actions { width: 100%; }
  body[data-ui-page="home"] .hero { flex-direction: column; gap: 0; padding: 0; }
  body[data-ui-page="home"] .hero > div { width: 100%; margin-right: 0; padding: clamp(24px, 5vw, 34px); background: transparent; }
  body[data-ui-page="home"] .hero-photo { width: 100%; height: 240px; min-height: 240px; }
  body[data-ui-page="home"] .hero-photo::after { background: linear-gradient(180deg, #15223b 0%, transparent 42%, #09152155 100%); }
}
@media screen and (max-width: 700px) {
  body.fee-wide[data-ui-family="app"] .page-head h1 { font-size: calc(28px * var(--fs)); }
  body.fee-wide[data-ui-family="app"] .stat strong { font-size: calc(40px * var(--fs)); }
  body.fee-wide[data-ui-family="app"] .stat { padding: 18px; }
  body[data-ui-family="app"] .ui-process { grid-template-columns: 1fr; gap: 10px; }
  body[data-ui-family="app"] .ui-process-steps { grid-template-columns: 1fr; gap: 0; }
  body[data-ui-family="app"] .ui-process-steps > li { padding-top: 8px; padding-bottom: 8px; }
  body[data-ui-family="app"] .ui-process-steps span { top: 9px; }
  body[data-ui-family="app"] .page-head { padding: 21px; border-radius: 17px; }
  body[data-ui-family="app"] .page-head .actions { width: 100%; }
  body[data-ui-family="app"] .page-head .actions .btn { flex: 1 1 auto; }
  body[data-ui-family="app"] .stat { padding: 16px; }
  body[data-ui-family="app"] .panel-title { align-items: flex-start; flex-wrap: wrap; }
  body[data-ui-family="app"] .panel-title .actions { width: 100%; }
  body[data-ui-family="report"] > .max-w-6xl > header { border-radius: 17px; }
  .ui-back-top { width: 43px; height: 43px; }
}

@media print {
  .ui-icon { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-ui-family] *, body[data-ui-family] *::before, body[data-ui-family] *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .ui-skip, .ui-reading-progress, .ui-back-top, .ui-context { display: none !important; }
}
