/* 嘉原顧客管理｜WordPress 風格後台
 * 全站最小字級 13px；一般文字 15px，表單輸入 16px。
 * 不使用外部字型、CDN 或前端框架。
 */
:root {
    --ink: #1d2327;
    --muted: #50575e;
    --primary: #2271b1;
    --primary-hover: #135e96;
    --primary-light: #f0f6fc;
    --paper: #f0f0f1;
    --line: #c3c4c7;
    --sidebar: #1d2327;
    --radius: 3px;
}

/* 基本樣式與文字 */
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    font-size: 15px;
    line-height: 1.65;
}
a {
    color: inherit;
    text-decoration: none;
}
button,
input,
select,
textarea {
    font: inherit;
}
button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}
button,
select {
    cursor: pointer;
}
button {
    color: inherit;
}
button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}
h1,
h2,
h3,
p {
    margin-top: 0;
}
h1 {
    margin-bottom: 8px;
    font-size: 28px;
    font-weight: 500;
    line-height: 1.4;
}
h2 {
    margin-bottom: 0;
    font-size: 17px;
    font-weight: 600;
}
h3 {
    margin-bottom: 8px;
    font-size: 17px;
}
small {
    font-size: 13px;
}
.muted {
    color: var(--muted);
}
.eyebrow {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.035em;
}
.pre-line {
    white-space: pre-line;
    overflow-wrap: anywhere;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}
.skip-link {
    position: fixed;
    top: -100px;
    left: 20px;
    z-index: 100;
    padding: 12px;
    background: #fff;
}
.skip-link:focus {
    top: 10px;
}
.ui-icon {
    display: inline-block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: middle;
}

/* 固定管理工具列與側邊導覽 */
.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 40;
    height: 56px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #101517;
    border-bottom: 1px solid #343a40;
    color: #f0f0f1;
}
.breadcrumb {
    font-size: 14px;
    color: #dcdcde;
}
.breadcrumb span {
    margin: 0 12px;
    color: #8c8f94;
}
.breadcrumb strong {
    color: #fff;
    font-weight: 500;
}
.account {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.account > a {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
}
.account small {
    display: block;
    color: #b7bcc2;
    font-size: 13px;
    font-weight: 400;
}
.avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 3px;
    background: #38566e;
    color: #fff;
    font-size: 14px;
}
.avatar.soft {
    border-radius: 50%;
    background: #f0f0f1;
    color: #50575e;
}
.text-button {
    min-height: 44px;
    padding: 8px;
    border: 0;
    background: transparent;
    color: #dcdcde;
    font-size: 13px;
}
.text-button:hover {
    color: #72aee6;
}
.menu-button {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 8px;
    border: 1px solid #646970;
    border-radius: 3px;
    background: transparent;
    color: #fff;
}
.sidebar {
    position: fixed;
    inset: 56px auto 0 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    width: 224px;
    padding: 24px 0 18px;
    overflow-y: auto;
    background: var(--sidebar);
    color: #f0f0f1;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 20px 25px;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 3px;
    background: var(--primary);
    color: #fff;
    font-size: 25px;
    font-weight: 600;
}
.brand strong {
    display: block;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.08em;
}
.brand small {
    display: block;
    margin-top: 4px;
    color: #b7bcc2;
    font-size: 13px;
}
.nav-caption {
    margin: 23px 0 8px;
    padding: 0 20px;
    color: #a7aaad;
    font-size: 13px;
}
.sidebar > .nav-caption {
    margin-top: 0;
}
.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 11px 20px;
    color: #dcdcde;
    font-size: 15px;
}
.nav-link .ui-icon {
    color: #a7aaad;
}
.nav-link:hover {
    background: #2c3338;
    color: #72aee6;
}
.nav-link:hover .ui-icon {
    color: #72aee6;
}
.nav-link.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}
.nav-link.active .ui-icon {
    color: #fff;
}
.nav-link.active::after {
    position: absolute;
    right: 0;
    top: 17px;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 7px solid var(--paper);
    content: '';
}
.sidebar-bottom {
    margin: auto 20px 0;
    padding-top: 30px;
    color: #c3c4c7;
    font-size: 13px;
}
.sidebar-bottom small {
    display: block;
    margin-top: 4px;
    color: #a7aaad;
    font-size: 13px;
}
.status-dot,
.amber-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: #00a32a;
    vertical-align: middle;
}
.amber-dot {
    background: #dba617;
}
.app-shell {
    margin-left: 224px;
    padding-top: 56px;
}
.main-content {
    max-width: 1680px;
    margin: 0 auto;
    padding: 28px;
}
.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}
.page-heading p:last-child {
    margin-bottom: 0;
    font-size: 14px;
}
.dot-separator {
    margin: 0 8px;
    color: #8c8f94;
}

/* 操作按鈕 */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}
.button.primary:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
}
.button.secondary {
    border-color: var(--primary);
    background: #f6f7f7;
    color: var(--primary);
}
.button.secondary:hover {
    border-color: var(--primary-hover);
    background: #f0f6fc;
    color: var(--primary-hover);
}
.button.ghost {
    color: var(--primary);
}
.button.small {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
}
.button.full {
    width: 100%;
}
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.text-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}
.text-link:hover,
.customer-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* 資料面板、統計及表格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}
.stat-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--primary);
    border-radius: var(--radius);
    background: #fff;
}
a.stat-card:hover {
    border-color: var(--primary);
    box-shadow: 0 1px 3px #00000012;
}
.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 28px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}
.stat-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 3px;
    background: var(--primary-light);
    color: var(--primary);
}
.stat-card > strong {
    display: block;
    margin: 10px 0 8px;
    font-size: 36px;
    font-weight: 600;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}
.stat-card > strong small {
    margin-left: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
}
.stat-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}
.stat-card.warm {
    border-top-color: #dba617;
}
.stat-card.warm .stat-icon {
    background: #fcf9e8;
    color: #8a6500;
}
.stat-card .amount-stat {
    font-size: clamp(22px, 2.3vw, 34px);
    overflow-wrap: anywhere;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}
.panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 1px 1px #00000004;
}
.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 17px 20px;
    border-bottom: 1px solid #dcdcde;
}
.panel-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}
.panel-heading h2 .badge {
    margin-left: 8px;
    vertical-align: middle;
}
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}
th {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    background: #f6f7f7;
    color: #2c3338;
    font-size: 14px;
    font-weight: 600;
}
td {
    padding: 15px 16px;
    border-bottom: 1px solid #dcdcde;
    color: #2c3338;
    font-size: 14px;
}
tr:last-child td {
    border-bottom: 0;
}
tbody tr:nth-child(even) {
    background: #f9fafb;
}
tbody tr:hover {
    background: var(--primary-light);
}
td strong {
    color: var(--ink);
    font-weight: 600;
}
.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.customer-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    color: var(--primary);
    font-size: 15px;
    font-weight: 600;
}
.cell-sub {
    display: block;
    margin-top: 3px;
    color: #646970;
    font-size: 13px;
}
.ellipsis {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.address-cell {
    min-width: 180px;
    max-width: 300px;
    white-space: normal;
    overflow-wrap: anywhere;
}
.badge {
    display: inline-block;
    padding: 3px 9px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}
.badge.completed {
    border-color: #b8d9be;
    background: #edfaef;
    color: #17652b;
}
.badge.scheduled {
    border-color: #e5d69e;
    background: #fcf9e8;
    color: #805b00;
}
.badge.cancelled,
.badge.expired {
    border-color: #dcdcde;
    background: #f0f0f1;
    color: #50575e;
}
.warranty-panel {
    display: flex;
    flex-direction: column;
}
.reminder-list {
    padding: 0 20px;
}
.reminder {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 0;
    border-bottom: 1px solid #dcdcde;
}
.reminder:last-child {
    border-bottom: 0;
}
.reminder-name {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
}
.reminder-name strong {
    display: block;
    color: var(--primary);
    font-size: 15px;
    font-weight: 600;
}
.reminder-name small {
    display: block;
    color: var(--muted);
    font-size: 13px;
}
.days-left {
    flex-shrink: 0;
    color: #805b00;
    text-align: right;
    font-size: 14px;
}
.days-left small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}
.panel-footer-link {
    display: block;
    margin-top: auto;
    padding: 13px 20px;
    border-top: 1px solid #dcdcde;
    background: #f6f7f7;
    color: var(--primary);
    text-align: center;
    font-size: 14px;
}
.care-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 24px;
    padding: 22px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--primary);
    background: #fff;
}
.care-symbol {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    background: var(--primary-light);
    color: var(--primary);
}
.care-banner h2 {
    margin-bottom: 4px;
    font-size: 17px;
}
.care-banner p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}
.care-banner .button {
    margin-left: auto;
}
.empty-state {
    padding: 50px 24px;
    color: var(--muted);
    text-align: center;
}
.empty-state p {
    margin-bottom: 20px;
    font-size: 14px;
}
.empty-state h3 {
    color: var(--ink);
    font-size: 17px;
}
.empty-icon {
    display: block;
    margin-bottom: 14px;
    color: #646970;
    font-size: 34px;
}
.empty-state.compact {
    margin: auto 0;
    padding: 34px 20px;
}

/* 搜尋、表單與客戶明細 */
.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 20px;
}
.filter-bar label {
    margin: 0;
}
.search-field {
    min-width: 180px;
    flex: 1;
}
label {
    display: block;
    color: #2c3338;
    font-size: 14px;
    font-weight: 500;
}
input:not([type='checkbox']),
select,
textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    outline: none;
    background: #fff;
    color: var(--ink);
    font-size: 16px;
}
input:not([type='checkbox']):focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}
input::placeholder,
textarea::placeholder {
    color: #646970;
    font-size: 14px;
    font-weight: 400;
}
label > input,
label > select,
label > textarea {
    margin-top: 7px;
}
.filter-bar input,
.filter-bar select {
    margin-top: 0;
}
label > small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}
textarea {
    resize: vertical;
    line-height: 1.8;
}
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 20px;
    border-top: 1px solid #dcdcde;
    background: #f6f7f7;
    color: var(--muted);
    font-size: 13px;
}
.pagination > div {
    display: flex;
    gap: 8px;
}
.form-panel {
    padding: 24px;
}
.form-panel > h2 {
    margin-bottom: 22px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}
.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.span-2 {
    grid-column: span 2;
}
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid #dcdcde;
    font-size: 13px;
}
.detail-grid {
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.7fr);
    align-items: start;
    gap: 24px;
}
.details {
    margin: 0;
    padding: 0 22px 24px;
}
.details dt {
    margin-top: 18px;
    color: #646970;
    font-size: 13px;
}
.details dd {
    margin: 5px 0 0;
    font-size: 15px;
    overflow-wrap: anywhere;
}
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 18px;
}
.section-heading > .muted {
    font-size: 14px;
}
.service-card {
    margin-bottom: 20px;
}
.service-line-list {
    padding: 0 22px;
}
.service-line {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid #dcdcde;
    font-size: 15px;
}
.service-line:last-child {
    border-bottom: 0;
}
.service-line small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}
.line-warranty {
    flex-shrink: 0;
    text-align: right;
}
.service-note {
    margin: 0 22px 20px;
    padding: 15px;
    border-left: 3px solid #c3c4c7;
    background: #f6f7f7;
    color: var(--muted);
    font-size: 14px;
}
.service-total {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 22px;
    border-top: 1px solid #dcdcde;
    background: #f6f7f7;
    font-size: 14px;
}
.item-heading {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #dcdcde;
}
.item-heading p {
    margin: 8px 0 0;
    font-size: 14px;
}
.item-picker {
    display: grid;
    gap: 10px;
}
.item-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 3px;
}
.item-option.is-selected {
    border-color: var(--primary);
    background: var(--primary-light);
}
.item-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    font-size: 15px;
    cursor: pointer;
}
input[type='checkbox'] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: var(--primary);
}
.item-numbers {
    display: grid;
    grid-template-columns: 80px 140px 105px;
    gap: 12px;
}
.item-numbers label {
    color: var(--muted);
    font-size: 13px;
}
.item-numbers input {
    margin-top: 5px;
    padding: 8px 10px;
}
.live-total {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #c5d9ed;
    background: var(--primary-light);
    color: #0a4b78;
}
.live-total strong {
    font-size: 25px;
}
.live-total > span {
    align-self: center;
}
.notes-label {
    margin-top: 20px;
}
.tabs {
    display: flex;
    gap: 26px;
    padding: 0 20px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: #f6f7f7;
}
.tabs a {
    padding: 15px 3px 12px;
    border-bottom: 3px solid transparent;
    color: var(--muted);
    font-size: 15px;
    white-space: nowrap;
}
.tabs a.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}
.manage-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
    align-items: start;
    gap: 24px;
}
.stack-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.stack-form h2 {
    margin: 0 0 5px;
}
.narrow {
    max-width: 720px;
}
.alert {
    margin-bottom: 22px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    background: #fff;
    font-size: 15px;
}
.alert.success {
    border-left-color: #00a32a;
    color: #17652b;
}
.alert.error {
    border-left-color: #d63638;
    color: #8a2424;
}

/* 報表與登入 */
.report-filter {
    margin-bottom: 24px;
}
.report-filter label {
    display: flex;
    align-items: center;
    gap: 14px;
    white-space: nowrap;
}
.report-filter input {
    width: auto;
}
.report-filter > span {
    margin-left: auto;
    color: var(--muted);
    font-size: 14px;
}
.chart-panel {
    margin-bottom: 24px;
}
.chart-legend {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}
.chart-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 7px;
    background: var(--primary);
}
.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 18px;
    padding: 24px 30px;
}
.chart-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    flex: 1;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}
.chart-column strong {
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
}
.chart-track {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 150px;
    border-bottom: 1px solid #c3c4c7;
    background: repeating-linear-gradient(to top, transparent 0, transparent 36px, #f0f0f1 37px, transparent 38px);
}
.chart-bar {
    width: 55%;
    max-width: 75px;
    height: 0;
    border-radius: 2px 2px 0 0;
    background: #72aee6;
}
.chart-column:last-child .chart-bar {
    background: var(--primary);
}
.report-note {
    padding: 18px 20px;
    border-top: 1px solid #dcdcde;
    background: #f6f7f7;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.9;
}
.auth-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 40px 20px;
    background: #f0f0f1;
}
.auth-main {
    width: min(100%, 440px);
}
.auth-card {
    padding: 36px;
    border: 1px solid var(--line);
    border-top: 4px solid var(--primary);
    border-radius: 3px;
    background: #fff;
    box-shadow: 0 2px 8px #00000008;
}
.auth-brand {
    margin: 0 0 28px;
}
.auth-brand small {
    color: var(--muted);
}
.auth-card h1 {
    font-size: 25px;
}
.auth-card > .muted {
    margin-bottom: 24px;
    font-size: 14px;
}
.auth-card .button {
    margin-top: 6px;
}
.auth-footnote {
    margin: 24px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}
.auth-card > a {
    display: block;
    margin-top: 18px;
    color: var(--primary);
    font-size: 14px;
}

/* 平板與手機：字級維持至少 13px，表格在自身容器內滑動。 */
@media (max-width: 1280px) {
    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .reminder-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 24px;
    }
    .manage-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .manage-grid > form {
        width: 100%;
        max-width: 760px;
    }
}
@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .item-option {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }
    .item-numbers {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
@media (max-width: 800px) {
    .sidebar {
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.2s;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .app-shell {
        margin-left: 0;
    }
    .menu-button {
        display: inline-flex;
    }
    .nav-backdrop:not([hidden]) {
        position: fixed;
        inset: 56px 0 0;
        z-index: 25;
        display: block;
        background: #10151780;
    }
    .topbar {
        padding: 0 16px;
        gap: 12px;
    }
    .breadcrumb {
        margin-right: auto;
    }
    .breadcrumb .breadcrumb-section {
        display: none;
    }
    .main-content {
        padding: 24px 20px;
    }
    .account {
        gap: 10px;
    }
    .details {
        display: grid;
        grid-template-columns: 100px minmax(0, 1fr);
        gap: 15px;
        padding-top: 20px;
    }
    .details dt,
    .details dd {
        margin: 0;
    }
    .details .text-link {
        min-height: 24px;
    }
}
@media (max-width: 540px) {
    .topbar {
        padding: 0 12px;
        gap: 10px;
    }
    .breadcrumb {
        display: none;
    }
    .account {
        margin-left: auto;
    }
    .main-content {
        padding: 22px 14px;
    }
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 22px;
    }
    .page-heading > .button,
    .page-heading > .button-group {
        width: 100%;
    }
    .button-group > .button {
        flex: 1;
    }
    h1 {
        font-size: 25px;
    }
    .button {
        min-height: 44px;
    }
    .stats-grid {
        gap: 12px;
    }
    .stat-card {
        padding: 16px 14px;
    }
    .stat-top {
        min-height: 25px;
        font-size: 14px;
    }
    .stat-icon {
        display: none;
    }
    .stat-card > strong {
        font-size: 30px;
    }
    .stat-card .amount-stat {
        font-size: 23px;
    }
    .panel-heading {
        padding: 16px;
    }
    .panel-heading h2 {
        font-size: 16px;
    }
    th,
    td {
        padding: 13px 15px;
    }
    .table-wrap::after {
        display: block;
        padding: 9px 16px;
        color: #646970;
        font-size: 13px;
        content: '表格可左右滑動查看';
    }
    .reminder-list {
        display: block;
        padding: 0 16px;
    }
    .care-banner {
        flex-wrap: wrap;
        gap: 14px;
        padding: 20px;
    }
    .care-symbol {
        display: none;
    }
    .care-banner .button {
        margin: 0;
    }
    .filter-bar {
        gap: 10px;
        padding: 16px;
    }
    .search-field {
        min-width: 0;
        flex-basis: 100%;
    }
    .filter-bar > label:not(.search-field) {
        min-width: 0;
        flex: 1;
    }
    .form-panel {
        padding: 20px 16px;
    }
    .form-grid,
    .form-grid.three {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }
    .span-2 {
        grid-column: span 1;
    }
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .form-actions .button {
        width: 100%;
    }
    .item-option {
        padding: 12px;
    }
    .item-numbers {
        grid-template-columns: 0.7fr 1.2fr 0.9fr;
        gap: 8px;
    }
    .item-numbers input {
        padding-right: 5px;
        padding-left: 8px;
    }
    .tabs {
        gap: 20px;
        padding: 0 16px;
    }
    .pagination {
        flex-wrap: wrap;
        padding: 14px 16px;
    }
    .bar-chart {
        gap: 6px;
        padding: 20px 12px;
    }
    .chart-column > span {
        max-width: 100%;
        text-align: center;
        overflow-wrap: anywhere;
    }
    .chart-track {
        height: 120px;
    }
    .chart-legend {
        display: none;
    }
    .report-filter {
        align-items: flex-end;
    }
    .report-filter label {
        display: block;
    }
    .report-filter input {
        width: 100%;
        margin-top: 6px;
    }
    .report-filter > span {
        margin: 0;
        flex-basis: 100%;
    }
    .auth-card {
        padding: 28px 22px;
    }
    .service-card .panel-heading {
        align-items: flex-start;
    }
    .service-card .panel-heading h2 {
        font-size: 16px;
    }
    .service-line-list {
        padding: 0 16px;
    }
    .service-line {
        flex-wrap: wrap;
    }
    .service-total {
        padding: 15px 16px;
    }
}

/* 列印亦維持至少 13px。 */
@media print {
    .sidebar,
    .topbar,
    .button-group,
    .report-filter .button,
    .skip-link,
    .table-wrap::after {
        display: none !important;
    }
    .app-shell {
        margin: 0;
        padding: 0;
    }
    .main-content {
        max-width: none;
        padding: 0;
    }
    body {
        background: #fff;
        font-size: 13px;
    }
    .panel,
    .stat-card {
        break-inside: avoid;
    }
    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .table-wrap {
        overflow: visible;
    }
    table {
        white-space: normal;
    }
    .chart-bar,
    .badge {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}
