:root {
    --ink: #17212b;
    --muted: #6e7a87;
    --line: #e2e8ed;
    --paper: #f5f7f9;
    --surface: #fff;
    --navy: #17324d;
    --blue: #1e6b91;
    --teal: #238c86;
    --red: #b94747;
    --orange: #c66a2d;
    --purple: #7955a4;
    --olive: #72772b;
    --shadow: 0 10px 30px rgba(23, 50, 77, .07);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 14px/1.45 "Segoe UI", "Microsoft YaHei", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { border: 1px solid var(--line); border-radius: 6px; }
input, select, textarea { width: 100%; padding: 10px 12px; color: var(--ink); background: #fff; outline: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,107,145,.12); }
input:disabled { color: #8e99a3; background: #f1f4f6; cursor: not-allowed; }
textarea { resize: vertical; min-height: 80px; }
label { display: grid; gap: 6px; font-weight: 600; color: #43515e; }
label small, small, .form-note { color: var(--muted); font-weight: 400; }
h1, h2, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.2; letter-spacing: 0; }
h2 { font-size: 19px; line-height: 1.3; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 6px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: 1.3px; }
.app-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; min-height: 100vh; padding: 26px 18px; background: var(--navy); color: #f4f7fa; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; margin-bottom: 36px; }
.brand-mark { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; color: #fff; background: var(--teal); font-weight: 800; letter-spacing: 1px; }
.brand-mark.small { width: 32px; height: 32px; border-radius: 7px; font-size: 12px; }
.brand-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 8px; background: rgba(255,255,255,.08); }
.brand-logo.small { width: 32px; height: 32px; border-radius: 7px; }
.nav-list { display: grid; gap: 5px; }
.nav-list a { padding: 10px 13px; color: #b8c8d6; border-left: 3px solid transparent; border-radius: 4px; }
.nav-list a:hover, .nav-list a.active { color: #fff; background: rgba(255,255,255,.08); border-left-color: #54b9b1; }
.nav-group { display: grid; gap: 5px; color: #b8c8d6; }
.nav-group summary { padding: 10px 13px; color: #dce7ef; border-left: 3px solid transparent; border-radius: 4px; cursor: pointer; font-weight: 700; list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: "\25BE"; float: right; color: #9bb0c1; }
.nav-group:not([open]) summary::after { content: "\25B8"; }
.nav-group[open] summary { color: #fff; background: rgba(255,255,255,.08); border-left-color: #54b9b1; }
.nav-sublist { display: grid; gap: 4px; padding-left: 10px; }
.nav-sublist a { padding-left: 18px; font-size: 13px; }
.sidebar-footer { margin-top: auto; display: grid; gap: 15px; }
.user-chip { display: grid; gap: 1px; padding: 13px; border-top: 1px solid rgba(255,255,255,.13); color: #e9f0f5; }
.user-chip span { color: #a8bac9; font-size: 12px; }
.main-content { width: 100%; max-width: none; padding: 24px clamp(12px, 2vw, 32px) 44px; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 27px; }
.topbar-title { display: flex; align-items: flex-start; gap: 12px; }
.mobile-menu-toggle, .mobile-menu-backdrop { display: none; }
.topbar-meta { color: var(--muted); white-space: nowrap; }
.alert { margin-bottom: 18px; padding: 11px 14px; border: 1px solid; border-radius: 6px; }
.alert.success { color: #1e6b5c; background: #e8f6f1; border-color: #b8e2d5; }
.alert.error { color: #983e3e; background: #fff0f0; border-color: #efc3c3; }
.license-expiry-warning { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; padding: 11px 14px; color: #7a5518; background: #fff8e8; border: 1px solid #ead194; border-left: 4px solid #d89a22; border-radius: 6px; line-height: 1.55; }
.license-expiry-warning strong { flex: 0 0 auto; color: #8a5d13; }
.license-expiry-warning.urgent { color: #953f3f; background: #fff1f1; border-color: #edbebe; border-left-color: #c24c4c; }
.license-expiry-warning.urgent strong { color: #a23737; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.stats-six { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.stat-card, .panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat-card { min-height: 128px; padding: 19px; display: grid; align-content: center; gap: 5px; border-top: 4px solid var(--blue); }
.stat-card span, .stat-card small { color: var(--muted); }
.stat-card strong { font-size: 31px; line-height: 1.1; color: var(--navy); }
.accent-green { border-top-color: var(--teal) !important; }
.accent-orange { border-top-color: var(--orange) !important; }
.accent-red { border-top-color: var(--red) !important; }
.accent-olive { border-top-color: var(--olive) !important; }
.accent-purple { border-top-color: var(--purple) !important; }
.accent-blue { border-top-color: var(--blue) !important; }
.home-slider { position: relative; height: clamp(220px, 34vw, 420px); min-height: 220px; margin-bottom: 18px; overflow: hidden; background: #193a56; box-shadow: var(--shadow); }
.slider-track, .slider-slide { height: 100%; min-height: 0; }
.slider-slide { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .35s ease; }
.slider-slide.active { position: relative; opacity: 1; pointer-events: auto; }
.slider-link { display: block; width: 100%; height: 100%; color: inherit; text-decoration: none; }
.slider-slide img { display: block; width: 100%; height: 100%; object-fit: contain; background: #193a56; }
.slider-copy { position: absolute; right: 0; bottom: 0; left: 0; padding: 24px 70px 25px 28px; color: #fff; background: linear-gradient(transparent, rgba(12,29,44,.88)); }
.slider-copy h2 { margin-bottom: 4px; color: #fff; }
.slider-copy p { color: #e5edf3; }
.slider-arrow { position: absolute; z-index: 2; top: 50%; width: 38px; height: 52px; margin-top: -26px; color: #fff; background: rgba(16,35,52,.55); border: 0; font-size: 34px; line-height: 1; cursor: pointer; }
.slider-arrow.previous { left: 14px; }
.slider-arrow.next { right: 14px; }
.slider-dots { position: absolute; z-index: 3; right: 0; bottom: 14px; left: 0; display: flex; justify-content: center; gap: 7px; }
.slider-dots button { width: 8px; height: 8px; padding: 0; background: rgba(255,255,255,.55); border: 0; border-radius: 50%; cursor: pointer; }
.slider-dots button.active { background: #fff; transform: scale(1.25); }
.content-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.content-grid.two { grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); }
.menu-management-layout { grid-template-columns: minmax(380px, .72fr) minmax(0, 1.28fr); align-items: start; }
.menu-editor-panel, .menu-list-panel { min-width: 0; }
.dictionary-layout { grid-template-columns: 390px minmax(680px, 1fr); align-items: start; }
.dictionary-layout .panel { min-width: 0; }
.panel { padding: 16px; margin-bottom: 14px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.toolbar-actions, .actions, .form-actions, .filter-inline, .inline-form { display: flex; align-items: center; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 8px 14px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.button.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.button.primary:hover { background: #185876; }
.button.secondary { color: var(--navy); background: #edf3f6; border-color: #d5e1e8; }
.button.ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button.danger { color: #a64040; background: #fff4f4; border-color: #efcccc; }
.button.small { min-height: 31px; padding: 5px 9px; font-size: 12px; }
.field-with-action { display: flex; align-items: stretch; gap: 8px; }
.field-with-action input { min-width: 0; }
.config-link-button.disabled { pointer-events: none; opacity: .5; }
.button.full { width: 100%; }
.quick-actions { display: grid; gap: 10px; }
.quick-action { display: grid; gap: 2px; padding: 15px; background: #f8fafb; border: 1px solid var(--line); border-radius: 6px; }
.quick-action:hover { border-color: #a8c9d7; background: #f2f8fa; }
.quick-action span, .subtext { color: var(--muted); font-size: 12px; }
.module-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.module-card { position: relative; display: grid; gap: 4px; min-height: 105px; padding: 17px; border: 1px solid var(--line); border-top: 4px solid var(--blue); background: #fbfcfd; }
.module-card span { color: var(--muted); font-size: 12px; }
.module-card i { position: absolute; right: 16px; bottom: 14px; color: var(--blue); font-size: 12px; font-style: normal; }
.module-card:hover { background: #f7fafc; transform: translateY(-1px); }
.dashboard-lower-fold { margin-top: 18px; }
.dashboard-lower-fold > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 10px 14px;
    color: var(--navy);
    background: #eef4f7;
    border: 1px solid #d5e1e8;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
}
.dashboard-lower-fold > summary::-webkit-details-marker { display: none; }
.dashboard-lower-fold > summary::after { content: "展开"; color: var(--blue); font-size: 12px; font-weight: 700; }
.dashboard-lower-fold > summary span { display: none; }
.dashboard-lower-fold[open] > summary { margin-bottom: 18px; }
.dashboard-lower-fold[open] > summary::after { content: "收起"; }
.dashboard-lower-content { margin-bottom: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; min-width: 1080px; border-collapse: collapse; font-size: 13px; }
.menu-list-panel .table-wrap { overflow-x: visible; }
.menu-list-panel table { min-width: 0; table-layout: fixed; }
.menu-list-panel th, .menu-list-panel td { padding: 9px 10px; overflow-wrap: anywhere; white-space: normal; }
.menu-list-panel th:nth-child(1) { width: 13%; }
.menu-list-panel th:nth-child(2) { width: 14%; }
.menu-list-panel th:nth-child(3) { width: 15%; }
.menu-list-panel th:nth-child(4) { width: 20%; }
.menu-list-panel th:nth-child(5) { width: 8%; }
.menu-list-panel th:nth-child(6) { width: 10%; }
.menu-list-panel th:nth-child(7) { width: 20%; }
.menu-list-panel .actions { display: flex; flex-wrap: wrap; white-space: normal; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; line-height: 1.35; }
th { color: var(--muted); background: #f8fafb; font-size: 12px; font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.mono { font-family: Consolas, monospace; }
.tag, .status { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 4px; font-size: 12px; }
.tag { color: var(--blue); background: #e9f2f6; }
.status.on { color: #1e6b5c; background: #e8f6f1; }
.status.off { color: #8b6262; background: #f8eeee; }
.actions { white-space: nowrap; }
.actions form { display: inline; }
.text-fold { display: inline-block; max-width: 28ch; overflow-wrap: anywhere; white-space: normal; vertical-align: top; }
.power-mobile-full { display: none; }
.inline-link { padding: 0 0 0 6px; color: var(--blue); background: transparent; border: 0; cursor: pointer; font-size: 12px; font-weight: 700; }
.inline-link:hover { text-decoration: underline; }
.filter-row { display: grid; grid-template-columns: minmax(220px, 1fr) 150px minmax(180px, .9fr) 105px auto auto; gap: 7px; margin-bottom: 12px; }
.maintenance-plan-filter { grid-template-columns: minmax(240px, 1fr) 190px auto; }
.column-toggle-panel {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: #f8fbfc;
    border: 1px solid var(--line);
    border-radius: 6px;
}
.column-toggle-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    list-style: none;
}
.column-toggle-panel summary::-webkit-details-marker { display: none; }
.column-toggle-summary strong { color: #43515e; font-size: 13px; }
.column-toggle-summary span,
.column-toggle-help { color: var(--muted); font-size: 12px; font-weight: 400; }
.column-toggle-panel[open] .column-toggle-summary { margin-bottom: 2px; }
.column-toggle-panel-body { display: grid; gap: 10px; padding-top: 2px; }
.column-toggle-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.column-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px 14px;
}
.column-toggle-item {
    padding: 2px 0;
    color: #4a5966;
    font-weight: 500;
}
.column-hidden { display: none !important; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.meter-reading-panel {
    display: grid;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fbfc;
    border: 1px solid var(--line);
    border-radius: 6px;
}
.meter-reading-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    list-style: none;
}
.meter-reading-summary::-webkit-details-marker { display: none; }
.meter-reading-summary strong { color: #43515e; font-size: 13px; }
.meter-reading-summary span { color: var(--muted); font-size: 12px; font-weight: 400; }
.meter-reading-panel-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding-top: 2px;
}
.elevator-alert-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.elevator-alert-card {
    display: grid;
    gap: 6px;
    min-height: 88px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    background: #f8fbfc;
}
.elevator-alert-card strong { color: #334858; }
.elevator-alert-card span { color: var(--muted); font-size: 12px; }
.elevator-alert-card.warn { border-color: #efc3c3; background: #fff6f2; }
.elevator-alert-card.warn strong { color: #983e3e; }
.elevator-alert-card.ok { border-color: #b8e2d5; background: #f1fbf7; }
.operations-alert-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.elevator-dashboard-alert .operations-alert-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.operations-alert-card {
    display: grid;
    gap: 7px;
    min-height: 92px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    background: #f8fafb;
}
.operations-alert-card strong { color: #334858; }
.operations-alert-card a { color: #536170; font-size: 12px; white-space: normal; }
.operations-alert-card a:hover { color: var(--blue); text-decoration: underline; }
.operations-alert-count { align-content: center; text-align: center; }
.operations-alert-count span { color: #983e3e; font-size: 26px; font-weight: 800; line-height: 1.1; }
.operations-alert-count span b { font-size: 34px; }
.operations-alert-count em { color: var(--muted); font-size: 12px; font-style: normal; }
.operations-alert-card.warn { border-color: #ead194; background: #fffaf0; }
.operations-alert-card.warn strong { color: #87612b; }
.operations-alert-card.danger { border-color: #efc3c3; background: #fff6f2; }
.operations-alert-card.danger strong { color: #983e3e; }
.operations-alert-card.operations-alert-empty {
    align-content: center;
    border-color: #c8dde8;
    background: #f5fbfe;
    text-align: center;
}
.operations-alert-card.operations-alert-empty strong { color: #32647d; }
.operations-alert-card.operations-alert-empty span {
    color: #3d7897;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}
.maintenance-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #1e6b5c;
    background: #e8f6f1;
}
.maintenance-status.overdue,
.maintenance-status.missing { color: #983e3e; background: #fff0f0; }
.maintenance-status.soon { color: #87612b; background: #fff3ce; }
.maintenance-photo-thumbs {
    display: flex;
    align-items: center;
    gap: 6px;
}
.maintenance-photo-thumb {
    width: 48px;
    height: 36px;
    cursor: zoom-in;
}
.inline-maintenance-form { position: relative; }
.inline-maintenance-form summary { list-style: none; }
.inline-maintenance-form summary::-webkit-details-marker { display: none; }
.compact-maintenance-form {
    position: absolute;
    z-index: 20;
    right: 0;
    top: calc(100% + 6px);
    width: 260px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.qr-print-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}
.qr-select-column,
.qr-select-cell {
    width: 42px;
    text-align: center;
}
.maintenance-dialog {
    width: min(94vw, 560px);
    max-width: 560px;
    max-height: calc(100vh - 24px);
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 22px 80px rgba(22, 39, 52, .28);
}
.maintenance-dialog::backdrop { background: rgba(18, 31, 42, .48); }
.maintenance-dialog-form {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 24px);
    min-height: 0;
    margin: 0;
    background: #fff;
}
.maintenance-dialog-content {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 14px 16px;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 20px 6px;
}
.maintenance-dialog-content label { margin: 0; }
.maintenance-date-field {
    align-self: start;
    align-content: start;
}
.maintenance-date-field input[type="date"] {
    width: 100%;
    height: 42px;
    min-height: 42px;
}
.maintenance-options-field {
    display: grid;
    gap: 7px;
}
.maintenance-options-field > strong { color: #334858; }
.maintenance-options-field > small { color: var(--muted); font-size: 12px; }
.maintenance-options-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
    max-height: 168px;
    overflow-y: auto;
    padding: 8px 10px;
    background: #fbfdfe;
    border: 1px solid #cfe0e8;
    border-radius: 6px;
}
.maintenance-option-item {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin: 0;
    padding: 4px 6px;
    color: #334858;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1.2;
}
.maintenance-option-item:hover { background: #eef7fa; }
.maintenance-option-item span {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
}
.maintenance-option-item input[type="checkbox"] {
    flex: 0 0 16px !important;
    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    height: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #8b98a1 !important;
    box-shadow: none !important;
    accent-color: #2b77a1;
}
.maintenance-detail-panel {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    background: #f7fbfd;
    border: 1px solid #cfe0e8;
    border-radius: 6px;
}
.maintenance-detail-heading {
    display: grid;
    gap: 3px;
}
.maintenance-detail-heading strong { color: #29485d; }
.maintenance-detail-heading small { color: var(--muted); font-size: 12px; }
.maintenance-detail-list { display: grid; gap: 8px; }
.maintenance-detail-row {
    display: grid;
    grid-template-columns: 26px minmax(110px, .7fr) minmax(180px, 1.3fr);
    align-items: center;
    gap: 8px;
}
.maintenance-detail-index {
    color: #26759c;
    font-weight: 800;
    text-align: right;
}
.maintenance-detail-row strong {
    min-width: 0;
    color: #334858;
    overflow-wrap: anywhere;
}
.maintenance-dialog-form .form-actions {
    flex: 0 0 auto;
    padding: 14px 20px 20px;
    background: #fff;
    border-top: 1px solid #e3ebef;
}
.dialog-subtitle {
    margin: 5px 0 0;
    color: #4a6475;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}
.qr-batch-page { min-height: 100vh; background: #eef3f7; }
.qr-batch-shell { width: 100%; padding: 24px; }
.qr-batch-actions { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.qr-batch-sheet {
    width: min(100%, 190mm);
    min-height: 277mm;
    margin: 0 auto 20px;
    padding: 8mm;
    background: #fff;
    box-shadow: 0 14px 34px rgba(20, 35, 55, .12);
}
.qr-batch-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 6mm 5mm;
    height: 100%;
}
.qr-batch-item {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 4mm;
    min-width: 0;
    padding: 3mm;
    border: 1px solid #dce5eb;
    text-align: center;
    break-inside: avoid;
}
.qr-batch-item img { display: block; width: min(100%, 42mm); height: auto; }
.qr-batch-item strong {
    max-width: 100%;
    color: #111827;
    font-size: 12px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.dictionary-group-list { display: grid; gap: 10px; }
.menu-group-list { display: grid; gap: 10px; }
.menu-group-card {
    border: 1px solid var(--line);
    background: #f8fbfc;
}
.menu-group-card summary {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
}
.menu-group-card summary::-webkit-details-marker { display: none; }
.menu-group-card summary::before {
    content: "\25B8";
    margin-right: 7px;
    color: var(--blue);
    font-size: 12px;
}
.menu-group-card[open] summary::before { content: "\25BE"; }
.menu-group-card summary strong { margin-right: auto; }
.menu-group-card summary span { color: var(--muted); font-size: 12px; }
.menu-group-card .table-wrap { border-right: 0; border-bottom: 0; border-left: 0; }
.menu-empty-note { padding: 0 14px 14px; color: var(--muted); }
.dictionary-group-card {
    border: 1px solid var(--line);
    background: #f8fbfc;
}
.dictionary-group-card summary {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
}
.dictionary-group-card summary::-webkit-details-marker { display: none; }
.dictionary-group-card summary span { color: var(--muted); font-size: 12px; }
.dictionary-key-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    padding: 0 12px 12px;
}
.dictionary-key-card {
    display: grid;
    gap: 4px;
    padding: 11px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
}
.dictionary-key-card:hover { border-color: #a8c9d7; background: #f7fbfd; }
.dictionary-key-card span,
.dictionary-key-card em { color: var(--muted); font-size: 12px; font-style: normal; }
.elevator-track-tabs { flex-wrap: wrap; justify-content: flex-end; }
.elevator-track-filter {
    grid-template-columns: minmax(220px, 1fr) minmax(190px, .8fr) 150px auto;
}
.elevator-track-table .elevator-track-photos {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 150px;
}
.elevator-track-table .inspection-photo-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
}
.work-order-reminder {
    padding: 12px 14px;
    color: #fff;
    background: #103653;
    border: 1px solid #1d6387;
    border-radius: 8px;
    font-weight: 700;
}
.work-order-reminder-blink {
    animation: reminderBlink 1.1s ease-in-out infinite;
}
.work-order-reminder-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.work-order-reminder-row > span {
    min-width: 0;
    font-weight: 800;
    animation: reminderTextBlink .85s steps(2, jump-none) infinite;
}
.work-order-reminder-list {
    display: grid;
    gap: 8px;
}
.work-order-notification {
    display: block;
    color: #ffdb4d;
    font-weight: 800;
    line-height: 1.5;
    text-decoration: none;
    animation: reminderTextBlink .85s steps(2, jump-none) infinite;
}
.work-order-notification:hover { color: #fff; text-decoration: underline; }
.work-order-notification.silent {
    color: #fff;
    animation: none;
}
.work-order-reminder-list .work-order-dashboard-action {
    justify-self: start;
}
.work-order-dashboard-action {
    flex: 0 0 auto;
    width: auto !important;
    white-space: nowrap;
}
@keyframes reminderBlink {
    0%, 100% { color: #fff; background: #103653; }
    50% { color: #fff; background: #0a2942; }
}
@keyframes reminderTextBlink {
    0%, 49% { color: #ffdb4d; }
    50%, 100% { color: #fff; }
}
.empty-state.compact { padding: 10px 12px; }
.work-order-filter {
    grid-template-columns: minmax(220px, 1fr) 130px 130px 130px auto;
}
.work-order-broadcast-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.work-order-broadcast-form textarea {
    width: 100%;
    resize: vertical;
}
.work-order-broadcast-users {
    display: grid;
    gap: 8px;
}
.work-order-broadcast-users .check-grid {
    max-height: 220px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.work-order-list { display: grid; gap: 12px; }
.work-order-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 16px;
    padding: 14px;
    background: #fbfcfd;
    border: 1px solid var(--line);
    border-left: 4px solid var(--blue);
    border-radius: 8px;
}
.work-order-card.status-new { border-left-color: var(--red); }
.work-order-card.status-assigned { border-left-color: var(--orange); }
.work-order-card.status-accepted { border-left-color: var(--teal); }
.work-order-card.status-completed { border-left-color: #7a8792; }
.work-order-card.status-closed { border-left-color: #7a8792; }
.work-order-main { display: grid; gap: 8px; min-width: 0; }
.work-order-title-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.work-order-title-line strong { font-size: 15px; }
.work-order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    color: var(--muted);
    font-size: 12px;
}
.work-order-main p {
    color: #354858;
    line-height: 1.55;
}
.work-order-complete-note {
    padding: 8px 10px;
    background: #f2f8f6;
    border: 1px solid #d7e9e3;
    border-radius: 6px;
}
.work-order-photos {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.work-order-photos .inspection-photo-thumb {
    width: 68px;
    height: 54px;
    object-fit: cover;
}
.work-order-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}
.work-order-actions form { margin: 0; }
.work-order-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.work-order-inline-form select { width: auto; min-width: 130px; min-height: 31px; padding: 5px 8px; font-size: 12px; }
.work-order-close-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.work-order-close-form input { width: 180px; min-height: 31px; padding: 5px 8px; font-size: 12px; }
.work-order-complete-box {
    min-width: min(100%, 560px);
    padding: 0;
}
.work-order-complete-box summary {
    display: inline-flex;
    align-items: center;
    min-height: 31px;
    padding: 5px 9px;
    color: var(--navy);
    background: #edf3f6;
    border: 1px solid #d5e1e8;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    list-style: none;
}
.work-order-complete-box summary::-webkit-details-marker { display: none; }
.work-order-complete-form {
    display: grid;
    gap: 10px;
    margin-top: 8px;
    padding: 12px;
    background: #f8fbfc;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.work-order-complete-form .image-upload-panel { grid-template-columns: 1fr; }
.work-order-process-page { display: grid; gap: 14px; }
.work-order-process-summary,
.work-order-process-entry {
    display: grid;
    gap: 10px;
    padding: 14px;
    background: #fbfcfd;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.work-order-process-summary p,
.work-order-process-entry p { color: #354858; line-height: 1.55; }
.work-order-process-entry h3 { margin: 0; color: var(--navy); font-size: 16px; }
.work-order-process-form { max-width: 760px; }
.work-order-process-photo {
    width: 120px;
    height: 90px;
    object-fit: cover;
}
.span-2 { grid-column: span 2; }
.work-photo-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; color: #385165; background: #f8fbfc; border: 1px solid var(--line); border-radius: 8px; }
.work-photo-card strong { display: block; font-size: 14px; }
.work-photo-card p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.work-photo-preview { flex: 0 0 auto; width: 78px; height: 56px; object-fit: cover; cursor: zoom-in; touch-action: manipulation; background: #fff; border: 1px solid #dce6ec; border-radius: 6px; }
.stack-form { display: grid; gap: 16px; max-width: 560px; }
.menu-editor-form { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; gap: 14px; }
.menu-editor-form > label:nth-of-type(3),
.menu-editor-form > label:nth-of-type(4),
.menu-editor-form > .form-actions { grid-column: 1 / -1; }
.stack-form.wide { max-width: 820px; }
.permission-fieldset { border: 1px solid var(--line); padding: 16px; margin: 0; }
.permission-fieldset legend { padding: 0 7px; color: var(--muted); font-weight: 700; }
.permission-grid, .check-grid { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 10px 15px; }
.check-line { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.sensitive-export { color: #a64040; }
.check-line input { width: auto; accent-color: var(--blue); }
.export-form { display: grid; gap: 24px; }
.filter-block { display: grid; gap: 11px; max-width: 900px; }
.field-title { font-weight: 700; color: #43515e; }
.login-security-panel {
    display: grid;
    gap: 10px;
}
.login-security-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.login-security-option {
    display: grid;
    align-content: start;
    gap: 7px;
    min-height: 94px;
    padding: 12px 14px;
    color: #425161;
    background: #f8fbfc;
    border: 1px solid #d9e5ec;
    border-radius: 8px;
}
.login-security-option .check-line {
    color: #263746;
    font-weight: 700;
}
.login-security-option small {
    color: var(--muted);
    line-height: 1.55;
}
.field-pills { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.empty-state { padding: 36px 18px; color: var(--muted); text-align: center; background: #fbfcfd; border: 1px dashed var(--line); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; color: var(--muted); }
.pagination-controls { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 7px; min-width: 0; }
.pagination-page-numbers { display: flex; align-items: center; justify-content: center; min-width: 0; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.pagination-page-numbers::-webkit-scrollbar { display: none; }
.pagination-prev, .pagination-next { flex: 0 0 auto; white-space: nowrap; }
.pagination-placeholder { width: 0; min-width: 0; padding: 0; overflow: hidden; }
.page-number { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; color: var(--navy); background: #fff; border: 1px solid var(--line); border-radius: 6px; font-weight: 700; }
.page-number:hover, .page-number.active { color: #fff; background: var(--blue); border-color: var(--blue); }
.page-ellipsis { padding: 0 2px; color: var(--muted); }
.pagination-jump { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.pagination-jump input { width: 72px; height: 32px; padding: 5px 8px; text-align: center; }
.pagination-jump select { width: 88px; height: 32px; min-height: 32px; padding: 5px 6px; font-size: 12px; }
.select-column { width: 42px; }
.select-column input { width: auto; }
.detail-dialog { width: min(760px, calc(100% - 28px)); max-height: 86vh; padding: 0; overflow: hidden; border: 0; border-radius: 8px; box-shadow: 0 18px 70px rgba(0,0,0,.25); }
.detail-dialog[open] { display: flex; flex-direction: column; }
.detail-dialog::backdrop { background: rgba(16, 31, 45, .46); }
.dialog-heading { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.icon-button { width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; }
.detail-grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 0; max-height: calc(86vh - 68px); overflow-y: auto; padding: 10px 20px 20px; }
.detail-item { display: grid; gap: 3px; padding: 11px 0; border-bottom: 1px solid #eef1f3; }
.detail-item:nth-child(odd) { padding-right: 18px; }
.detail-item span { color: var(--muted); font-size: 12px; }
.detail-item strong, .detail-item a { overflow-wrap: anywhere; white-space: pre-wrap; }
.detail-meter-months { grid-column: 1 / -1; margin: 8px 0; border: 1px solid #dbe7ee; border-radius: 8px; background: #f8fbfc; overflow: hidden; }
.detail-meter-months summary { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 14px; color: var(--navy); font-weight: 800; cursor: pointer; list-style: none; }
.detail-meter-months summary::-webkit-details-marker { display: none; }
.detail-meter-months summary::after { content: "展开"; color: var(--blue); font-size: 12px; font-weight: 800; }
.detail-meter-months[open] summary::after { content: "收起"; }
.detail-meter-months-grid { display: grid; gap: 0; padding: 0 14px 8px; border-top: 1px solid #e4edf2; background: #fff; }
.meter-month-detail { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; padding: 10px 0; border-bottom: 1px solid #eef1f3; }
.meter-month-detail.three-cells { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.meter-month-detail div { display: grid; gap: 3px; min-width: 0; }
.detail-image, .scene-thumbnail, .inspection-photo-thumb { object-fit: contain; cursor: zoom-in; touch-action: manipulation; border: 1px solid var(--line); background: #f6f8f9; }
.detail-image { width: min(100%, 330px); max-height: 240px; }
.scene-thumbnail { display: block; width: 88px; height: 64px; object-fit: cover; border-radius: 6px; }
.image-empty {
    display: inline-grid;
    place-items: center;
    width: 88px;
    height: 64px;
    color: #98a7b2;
    background: #f8fbfc;
    border: 1px dashed #cbd9e1;
    border-radius: 6px;
    font-size: 12px;
}
.detail-image.zoomed, .scene-thumbnail.zoomed, .inspection-photo-thumb.zoomed, .work-photo-preview.zoomed { position: fixed; z-index: 1100; inset: 6vh 6vw; width: 88vw; height: 88vh; max-width: none; max-height: none; object-fit: contain; cursor: zoom-out; background: rgba(255,255,255,.98); box-shadow: 0 20px 80px rgba(0,0,0,.35); }
.meter-audit { display: grid; gap: 6px; padding: 13px 14px; color: #43515e; background: #f8fafb; border: 1px solid var(--line); border-radius: 6px; }
.meter-audit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 12px; }
.meter-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; color: var(--navy); background: #eef6f5; border: 1px solid #c8e3df; border-radius: 6px; }
.meter-total span { color: #42605e; font-weight: 700; }
.meter-total strong { font-size: 24px; line-height: 1; }
.meter-reading-toolbar { display: grid; gap: 8px; width: min(100%, 430px); }
.meter-reading-file-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.meter-reading-file-actions.has-clear-action { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.meter-reading-actions { display: grid; grid-template-columns: minmax(0, .95fr) minmax(142px, 1.15fr) minmax(0, .95fr); width: 100%; }
.meter-reading-actions .button { width: 100%; min-width: 0; padding-inline: 10px; }
.meter-reading-file-actions .button { width: 100%; min-width: 0; }
.meter-reading-import-form, .meter-reading-clear-form { display: block; min-width: 0; }
.meter-reading-import-form input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.meter-area-start-form { display: flex; min-width: 142px; }
.meter-area-start-form select { width: 100%; min-height: 42px; padding: 0 32px 0 12px; color: var(--navy); background: #f7fbfc; border: 1px solid #cfe0e7; border-radius: 8px; font: inherit; font-weight: 700; }
.meter-start-panel { max-width: 900px; }
.meter-start-month-form { display: flex; align-items: end; gap: 10px; max-width: 560px; margin-bottom: 10px; }
.meter-start-month-form label { flex: 1 1 auto; }
.meter-start-month-form .button { flex: 0 0 auto; }
.meter-start-note { margin-bottom: 18px; }
.meter-start-progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; color: #385165; background: #f2f8fa; border: 1px solid #cfe2ea; border-radius: 6px; }
.meter-start-progress strong { color: var(--navy); }
.meter-start-device { margin-top: 14px; padding: 16px; background: #fbfcfd; border: 1px solid var(--line); border-radius: 8px; }
.meter-start-device-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.meter-start-device-heading strong { color: var(--blue); font-size: 18px; }
.meter-start-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; padding-top: 14px; }
.meter-start-fields div { display: grid; gap: 3px; min-width: 0; }
.meter-start-fields span { color: var(--muted); font-size: 12px; }
.meter-start-fields strong { overflow-wrap: anywhere; }
.meter-start-form { display: grid; gap: 14px; max-width: 560px; margin-top: 16px; }
.meter-start-form label { color: var(--navy); }
.meter-start-form input { font-size: 19px; }
.meter-start-complete { display: grid; justify-items: center; gap: 8px; padding: 38px 18px; color: var(--muted); text-align: center; background: #f8fbfc; border: 1px dashed #c9dbe4; border-radius: 8px; }
.meter-start-complete strong { color: var(--teal); font-size: 20px; }
.meter-start-complete .button { margin-top: 7px; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--navy); }
.login-shell { width: min(100% - 32px, 460px); }
.login-panel { padding: 38px; background: #fff; box-shadow: 0 18px 60px rgba(0,0,0,.2); }
.login-panel h1 { margin-bottom: 8px; text-align: center; }
.login-panel .button.full { min-height: 48px; padding-top: 11px; padding-bottom: 11px; font-size: 16px; }
.login-panel .brand-mark { margin: 0 auto 24px; }
.login-logo { display: block; width: 72px; height: 72px; margin: 0 auto 24px; object-fit: contain; border-radius: 12px; }
.login-hint { margin-top: 22px; color: var(--muted); font-size: 12px; }
.oauth-login-block { display: grid; gap: 8px; margin-top: 14px; }
.oauth-login-block small { color: var(--muted); text-align: center; }
.wechat-login-button { display: inline-flex; align-items: center; justify-content: center; justify-self: center; width: 58px; height: 58px; padding: 0; color: #fff; background: #1aad19; border: 0; border-radius: 50%; box-shadow: 0 8px 16px rgba(26, 173, 25, .22); transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.wechat-login-button:hover { color: #fff; background: #159b14; box-shadow: 0 10px 20px rgba(26, 173, 25, .28); transform: translateY(-1px); }
.wechat-login-button:focus-visible { outline: 3px solid rgba(26, 173, 25, .28); outline-offset: 3px; }
.oauth-provider-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(88px, .65fr); gap: 8px 12px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.oauth-provider-option { display: flex; align-items: center; gap: 7px; min-width: 0; font-weight: 600; color: var(--ink); }
.oauth-provider-option input { width: auto; flex: 0 0 auto; }
.oauth-provider-dot { display: inline-grid; place-items: center; width: 25px; height: 25px; flex: 0 0 25px; color: #fff; background: #64748b; font-size: 12px; font-weight: 800; border-radius: 50%; }
.oauth-provider-icon { display: block; width: 28px; height: 28px; object-fit: contain; }
.oauth-provider-dot .oauth-provider-icon { width: 22px; height: 22px; }
.oauth-provider-dot.qq { background: #12a7f5; }
.oauth-provider-dot.wechat { background: #18ad36; }
.oauth-provider-dot.dingtalk { background: #1677ff; }
.oauth-provider-dot.alipay { background: #1677ff; }
.oauth-provider-dot.weibo { background: #e6162d; }
.oauth-provider-dot.baidu { background: #2932e1; }
.oauth-provider-dot.douyin { background: #171717; }
.oauth-provider-dot.huawei { background: #d81e06; }
.oauth-provider-dot.xiaomi { background: #ff6900; }
.oauth-provider-dot.google { background: #4285f4; }
.oauth-provider-dot.microsoft { background: #00a4ef; }
.oauth-provider-dot.gitee { background: #c71d23; }
.oauth-provider-dot.github { background: #24292f; }
.oauth-provider-dot.gitlab { background: #fc6d26; }
.oauth-provider-label-input { min-height: 34px; padding: 7px 9px; font-size: 13px; }
.oauth-provider-type-input { min-height: 34px; padding: 7px 9px; color: var(--muted); font-size: 12px; }
.wechat-icon { display: block; width: 32px; height: 32px; object-fit: contain; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.oauth-preview,
.binding-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 16px 0; background: #f8fafc; border: 1px solid var(--line); border-radius: 6px; }
.oauth-preview img,
.binding-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.oauth-preview strong,
.binding-card strong { display: block; font-size: 15px; }
.oauth-preview p,
.binding-card p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.oauth-binding-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    margin-top: 8px;
    padding: 8px 0;
    border-top: 1px solid #edf1f3;
}
.oauth-binding-row + .oauth-binding-row { margin-top: 5px; }
.oauth-binding-row form { display: block; }
.oauth-binding-row .button { min-width: 112px; white-space: nowrap; }
.oauth-config { display: grid; gap: 12px; margin-top: 6px; padding: 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 6px; }
.oauth-config .field-title { margin-bottom: 0; }
.oauth-provider-options-simple { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.oauth-advanced { margin-top: 2px; border-top: 1px solid var(--line); }
.oauth-advanced summary { padding: 11px 0 2px; color: var(--navy); font-weight: 700; cursor: pointer; }
.oauth-advanced-fields { display: grid; gap: 12px; margin-top: 12px; }
.oauth-provider-advanced { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.system-settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.system-settings-tab {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 14px;
    background: #f8fafc;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    line-height: 1.4;
    white-space: nowrap;
}
.system-settings-tab-label {
    display: inline-block;
}
.system-settings-tab:hover,
.system-settings-tab.is-active {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
}
.system-settings-pane {
    display: grid;
    gap: 14px;
    min-width: 0;
}
.system-settings-pane[hidden] {
    display: none;
}
.system-settings-pane > .oauth-config,
.system-settings-pane > .slide-editor {
    margin-top: 0;
}
.system-settings-pane,
.oauth-config,
.oauth-advanced-fields,
.oauth-provider-options,
.oauth-provider-advanced {
    min-width: 0;
    max-width: 100%;
}

/* Keep the login choices compact and horizontal in every template. */
.system-settings-pane[data-system-pane="wechat"] .oauth-config {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}
.system-settings-pane[data-system-pane="wechat"] .oauth-provider-options-simple {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
    align-items: stretch;
}
.system-settings-pane[data-system-pane="wechat"] .oauth-provider-option {
    display: grid;
    grid-template-columns: 18px 28px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-width: 0;
    min-height: 42px;
    padding: 6px 8px;
    border: 1px solid #dce6ec;
    border-radius: 8px;
    background: #fff;
}
.system-settings-pane[data-system-pane="wechat"] .oauth-provider-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    margin: 0;
    padding: 0;
}
.system-settings-pane[data-system-pane="wechat"] .oauth-provider-option > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.system-settings-pane[data-system-pane="wechat"] .oauth-provider-dot {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
}
.system-settings-pane[data-system-pane="wechat"] .oauth-provider-dot .oauth-provider-icon {
    width: 24px;
    height: 24px;
}
.app-footer { display: flex; flex-wrap: wrap; gap: 12px 20px; justify-content: center; padding: 12px 0; color: var(--muted); font-size: 12px; }
code { padding: 2px 4px; color: var(--navy); background: #eef2f5; border-radius: 3px; }
@media (max-width: 1180px) {
    .stats-six { grid-template-columns: repeat(3, 1fr); }
    .menu-management-layout, .dictionary-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .menu-editor-form { max-width: 620px; }
}
@media (max-width: 900px) {
    html, body { max-width: 100%; overflow-x: hidden; }
    .app-shell { display: block; }
    .sidebar { position: fixed; z-index: 1000; inset: 0 auto 0 0; width: min(82vw, 270px); height: 100dvh; min-height: 0; padding: 22px 16px max(22px, env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 12px 0 30px rgba(0,0,0,.16); }
    .mobile-menu-open .sidebar { transform: translateX(0); }
    .mobile-menu-open { overflow: hidden; }
    .mobile-menu-open .mobile-menu-backdrop { display: block; position: fixed; z-index: 900; inset: 0; background: rgba(17, 35, 52, .48); }
    .mobile-menu-toggle { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; color: var(--navy); background: #edf3f6; border: 1px solid #d5e1e8; cursor: pointer; font-size: 20px; line-height: 1; }
    .sidebar-brand { margin-bottom: 36px; }
    .nav-list { display: grid; gap: 5px; overflow: visible; }
    .nav-list a { padding: 10px 13px; border-left: 3px solid transparent; border-bottom: 0; }
    .nav-list a:hover, .nav-list a.active { border-left-color: #54b9b1; border-bottom-color: transparent; }
    .sidebar-footer { margin-top: 22px; display: grid; padding-bottom: 4px; }
    .user-chip { display: grid; }
    .main-content { padding: 18px 10px 34px; }
    .content-grid.two, .menu-management-layout, .dictionary-layout { grid-template-columns: 1fr; }
    .dictionary-layout .table-wrap { overflow-x: auto; }
    .oauth-provider-advanced { grid-template-columns: 1fr; }
    .filter-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .filter-row input:first-of-type { grid-column: span 3; }
}
@media (max-width: 620px) {
    .main-content,
    .main-content > *,
    .system-settings-pane,
    .oauth-config {
        min-width: 0;
        max-width: 100%;
    }
    .topbar { display: flex; align-items: flex-start; }
    .topbar-meta { margin-top: 8px; }
    h1 { font-size: 25px; }
    .stats-grid, .stats-six { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { min-height: 102px; padding: 14px; }
    .stat-card strong { font-size: 27px; }
    .panel { padding: 12px; }
    .panel-heading { align-items: stretch; flex-direction: column; gap: 10px; }
    .toolbar-actions { flex-wrap: wrap; }
    .toolbar-actions .button { flex: 1 1 auto; }
    .toolbar-actions .meter-area-start-form { flex: 1 1 auto; min-width: 0; }
    .filter-row, .form-grid { grid-template-columns: 1fr; }
    .filter-row input:first-of-type, .span-2 { grid-column: auto; }
    .login-security-grid { grid-template-columns: 1fr; }
    .menu-editor-form { grid-template-columns: 1fr; }
    .menu-editor-form > label:nth-of-type(3),
    .menu-editor-form > label:nth-of-type(4),
    .menu-editor-form > .form-actions { grid-column: auto; }
    .filter-row .button, .form-actions .button { width: 100%; }
    .form-actions { flex-direction: column; }
    .permission-grid, .check-grid, .detail-grid { grid-template-columns: 1fr; }
    .module-cards, .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .module-card, .quick-action { min-width: 0; padding: 11px; }
    .module-card { min-height: 92px; }
    .module-card i { right: 11px; bottom: 10px; }
    .meter-audit-grid { grid-template-columns: 1fr; }
    .meter-total { align-items: flex-start; flex-direction: column; }
    .detail-item:nth-child(odd) { padding-right: 0; }
    .filter-inline { display: grid; grid-template-columns: 1fr; }
    .pagination { align-items: flex-start; flex-direction: column; }
    .login-panel { padding: 27px 22px; }
    .table-wrap { overflow: visible; border: 0; background: transparent; }
    table { display: block; min-width: 0; width: 100%; font-size: 13px; }
    thead { display: none; }
    tbody { display: grid; gap: 10px; }
    tr { display: grid; gap: 0; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 22px rgba(23,50,77,.06); }
    td { display: grid; grid-template-columns: minmax(82px, 34%) minmax(0, 1fr); gap: 10px; align-items: start; min-height: 32px; padding: 7px 0; white-space: normal; border-bottom: 1px solid #eef2f4; overflow-wrap: anywhere; }
    td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; }
    td:empty { display: none; }
    td:last-child { border-bottom: 0; }
    td.select-column, td.select-cell { display: flex; min-height: auto; padding-bottom: 4px; border-bottom: 0; }
    td.select-column::before, td.select-cell::before { content: ""; display: none; }
    td.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; white-space: normal; border-bottom: 0; }
    td.actions::before { content: ""; display: none; }
    td.actions .button, td.actions form { flex: 1 1 auto; }
    td.actions .button { width: 100%; }
    .menu-list-panel .table-wrap { overflow: visible; }
    .menu-list-panel table { table-layout: auto; }
    .menu-list-panel th, .menu-list-panel td { white-space: normal; }
    .text-fold { max-width: none; }
    .power-desktop-fold,
    .power-desktop-fold-toggle { display: none !important; }
    .power-mobile-full { display: inline; }
}

/* Visual refresh: calmer surfaces, denser workflows, and a stronger mobile layout. */
:root {
    --ink: #182b3d;
    --muted: #708090;
    --line: #dbe5ec;
    --paper: #f1f5f8;
    --surface: #ffffff;
    --navy: #132c43;
    --blue: #226f9b;
    --teal: #168477;
    --red: #c64b4b;
    --orange: #c47a28;
    --purple: #6d58a3;
    --olive: #687b34;
    --shadow: 0 5px 18px rgba(23, 50, 77, .06);
}

html { background: var(--paper); }
body {
    color: var(--ink);
    background: var(--paper);
    font-size: 14px;
    line-height: 1.5;
}
button, input, select, textarea { border-radius: 8px; }
input, select, textarea {
    min-height: 42px;
    padding: 10px 12px;
    border-color: #d4e0e8;
    background: #fbfdfe;
}
textarea { min-height: 94px; }
input::placeholder, textarea::placeholder { color: #9aa8b4; }
input:focus, select:focus, textarea:focus {
    border-color: #3188ae;
    box-shadow: 0 0 0 3px rgba(49, 136, 174, .13);
}
button:focus-visible, a:focus-visible, summary:focus-visible {
    outline: 3px solid rgba(45, 132, 167, .28);
    outline-offset: 2px;
}
h1 { color: #13283a; font-size: 28px; font-weight: 800; }
h2 { color: #1c3448; font-size: 18px; font-weight: 800; }

.app-shell {
    grid-template-columns: 252px minmax(0, 1fr);
    background: var(--paper);
}
.sidebar {
    padding: 22px 16px 18px;
    background: var(--navy);
    box-shadow: 8px 0 24px rgba(18, 44, 67, .08);
}
.sidebar-brand {
    min-height: 48px;
    margin: 0 4px 24px;
    padding: 0 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    font-size: 15px;
}
.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--teal);
}
.brand-mark.small, .brand-logo.small {
    width: 34px;
    height: 34px;
    border-radius: 9px;
}
.nav-list { gap: 4px; }
.nav-list a, .nav-group summary {
    min-height: 42px;
    padding: 11px 12px;
    border-left-width: 3px;
    border-radius: 8px;
    font-weight: 650;
}
.nav-list a:hover, .nav-list a.active,
.nav-group[open] summary {
    background: #1e405b;
    border-left-color: #46c2ad;
}
.nav-sublist { gap: 3px; padding: 4px 0 4px 12px; }
.nav-sublist a { min-height: 38px; padding: 9px 12px; font-size: 13px; }
.sidebar-footer { gap: 12px; }
.user-chip { padding: 14px 10px; border-top-color: rgba(255, 255, 255, .12); }

.main-content {
    max-width: 1600px;
    padding: 28px clamp(18px, 3vw, 42px) 52px;
}
.topbar {
    align-items: center;
    min-height: 48px;
    margin-bottom: 24px;
}
.topbar-title { align-items: center; gap: 10px; }
.topbar-meta {
    padding: 7px 10px;
    color: #637789;
    background: #e8f0f4;
    border: 1px solid #d7e3ea;
    border-radius: 999px;
    font-size: 12px;
}
.mobile-menu-toggle {
    border-radius: 9px;
    color: #1b4b68;
    background: #e7f0f4;
    border-color: #d2e0e7;
}
.alert {
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(20, 44, 65, .03);
}
.stat-card, .panel {
    border-color: #dce6ec;
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.stat-card {
    min-height: 118px;
    padding: 18px 20px;
    border-top-width: 3px;
}
.stat-card strong { color: #18344b; font-size: 29px; }
.home-slider {
    height: clamp(220px, 34vw, 420px);
    min-height: 220px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.slider-track, .slider-slide, .slider-slide img { min-height: 0; height: 100%; }
.existing-slides { display: grid; gap: 10px; }
.existing-slide {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid #dce6ec;
    border-radius: 7px;
    background: #fbfdfe;
}
.existing-slide img {
    display: block;
    width: 108px;
    height: 68px;
    object-fit: contain;
    background: #eef4f7;
    border-radius: 5px;
}
.existing-slide-info { display: grid; gap: 5px; min-width: 0; }
.existing-slide-info small { overflow-wrap: anywhere; color: var(--muted); }
.existing-slide-info input { width: 100%; min-width: 0; }
.slide-row { align-items: center; }
.content-grid { gap: 16px; margin-bottom: 16px; }
.panel { padding: 20px; margin-bottom: 16px; }
.panel-heading {
    align-items: center;
    margin-bottom: 16px;
}
.panel-heading h2 { line-height: 1.25; }
.toolbar-actions { flex-wrap: wrap; }
.button {
    min-height: 40px;
    padding: 9px 15px;
    border-radius: 8px;
    font-weight: 700;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: #236f98; border-color: #236f98; }
.button.primary:hover { background: #1b5c7f; border-color: #1b5c7f; }
.button.secondary { color: #1d4c67; background: #eaf2f6; border-color: #d0e0e8; }
.button.secondary:hover { background: #dfeef4; border-color: #bfd5e0; }
.button.ghost { color: #5e7281; background: #fff; border-color: #d7e2e9; }
.button.ghost:hover { color: #1d4c67; border-color: #aec8d6; background: #f7fbfc; }
.button.danger { color: #a63d42; background: #fff4f4; border-color: #efcdcd; }
.button.danger:hover { background: #ffe9e9; border-color: #e6b4b4; }
.button.small { min-height: 32px; padding: 6px 10px; border-radius: 7px; }
.quick-action {
    padding: 14px 15px;
    border-radius: 8px;
    background: #f8fbfc;
    border-color: #dbe6ec;
}
.quick-action:hover { background: #f0f8fa; border-color: #b8d7e0; }
.module-card {
    min-height: 96px;
    padding: 16px;
    border-radius: 8px;
    border-top-width: 3px;
    background: #fbfdfe;
}
.module-card:hover { background: #f4fafb; }
.user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.user-actions .button {
    min-width: 108px;
}
.user-import-button {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.user-import-button input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}
.user-import-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 0 2px;
    margin-bottom: 14px;
    border-top: 1px solid #e6edf1;
}
.user-import-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.form-panel {
    border-left: 4px solid #2b83a8;
    background: #fcfeff;
}
.form-grid { gap: 18px; }
label { color: #385165; font-size: 13px; }
label small, small, .form-note { color: #7d8e9c; }
.field-with-action { gap: 8px; }
.filter-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.filter-actions .button { flex: 1 1 0; width: auto; }
.filter-row {
    grid-template-columns: minmax(240px, 1.8fr) minmax(150px, .9fr) minmax(150px, 1fr) 112px minmax(164px, auto);
    gap: 9px;
    margin-bottom: 12px;
}
.filter-row input, .filter-row select { min-height: 42px; }
.table-wrap {
    overflow-x: auto;
    border: 1px solid #dce6ec;
    border-radius: 8px;
    background: #fff;
}
table { min-width: 1020px; font-size: 13px; }
th, td { padding: 11px 13px; border-bottom-color: #e6edf1; }
th {
    color: #64798a;
    background: #f5f8fa;
    font-size: 12px;
}
tbody tr:hover td { background: #f8fbfc; }
.tag, .status { padding: 4px 9px; border-radius: 999px; font-weight: 700; }
.tag { color: #23617e; background: #e6f1f5; }
.status.on { color: #16705d; background: #e5f5ef; }
.status.off { color: #936060; background: #f9ecec; }
.empty-state {
    padding: 42px 18px;
    border-radius: 8px;
    background: #f9fbfc;
}
.pagination { padding-top: 18px; }
.detail-dialog {
    border-radius: 10px;
    box-shadow: 0 22px 80px rgba(15, 35, 52, .28);
}
.dialog-heading { padding: 16px 20px; }
.icon-button {
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: #f1f5f7;
}
.icon-button:hover { color: #1b5c7f; background: #e3eef2; }
.detail-grid { padding: 8px 20px 20px; }
.detail-item { padding: 12px 0; }
.meter-audit { border-radius: 8px; background: #f7fafb; }
.meter-total { border-radius: 8px; }
.login-page { background: #132c43; }
.login-panel {
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
}
.app-footer {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 18px 8px 6px;
    color: #ffffff;
    font-size: 12px;
    line-height: 1.7;
    text-align: center;
}
.app-footer-main {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 0;
    max-width: 100%;
}
.app-footer-main > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 0 14px;
    overflow-wrap: anywhere;
}
.app-footer-main > span + span {
    border-left: 1px solid #cbd9e1;
}
.app-footer-filing {
    max-width: 100%;
    padding: 0 4px;
    overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
    .app-shell { grid-template-columns: 228px minmax(0, 1fr); }
    .main-content { padding-right: 24px; padding-left: 24px; }
    .filter-row {
        grid-template-columns: minmax(200px, 1.5fr) 150px minmax(150px, 1fr) 100px minmax(150px, auto);
    }
}

@media (max-width: 900px) {
    .main-content { padding: 20px 18px 40px; }
    .topbar { margin-bottom: 18px; }
    .content-grid.two,
    .menu-management-layout,
    .dictionary-layout {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .module-cards,
    .quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .filter-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .filter-row input[name="keyword"] { grid-column: 1 / -1; }
    .filter-actions { width: 100%; }
    .filter-actions .button { width: auto; }
    .panel { padding: 17px; }
    .content-grid.two, .menu-management-layout, .dictionary-layout { gap: 14px; }
}

@media (max-width: 620px) {
    .main-content { padding: 14px 12px 30px; }
    .topbar {
        position: sticky;
        top: 0;
        z-index: 20;
        margin: -14px -12px 16px;
        padding: 11px 12px;
        background: rgba(241, 245, 248, .96);
        border-bottom: 1px solid #dce6ec;
        backdrop-filter: blur(12px);
    }
    .topbar-title { min-width: 0; }
    .topbar-title h1 {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 22px;
    }
    .topbar-meta { padding: 5px 8px; font-size: 11px; }
    .panel { padding: 14px; border-radius: 8px; }
    .panel-heading { gap: 12px; }
    .panel-heading h2 { font-size: 17px; }
    .meter-reading-toolbar { width: 100%; }
    .meter-reading-actions { grid-template-columns: minmax(0, .85fr) minmax(136px, 1.2fr) minmax(0, .85fr); width: 100%; }
    .toolbar-actions { width: 100%; }
    .toolbar-actions .button { flex: 1 1 0; min-width: 0; }
    .toolbar-actions .meter-area-start-form { flex: 1 1 0; min-width: 0; }
    .user-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
        gap: 7px;
    }
    .user-actions .button,
    .user-actions .user-import-form,
    .user-actions .user-import-form .button {
        width: 100%;
        min-width: 0;
    }
    .user-actions .button {
        padding-right: 6px;
        padding-left: 6px;
        font-size: 13px;
    }
    .user-import-tools,
    .user-import-form {
        align-items: stretch;
    }
    .user-import-tools > .button { width: auto; }
    .filter-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 8px;
    }
    .filter-row input[name="keyword"] { grid-column: 1 / -1; }
    .filter-actions { width: 100%; }
    .filter-actions .button { min-width: 0; padding-right: 8px; padding-left: 8px; }
    .table-wrap { overflow: visible; border: 0; background: transparent; }
    table { width: 100%; min-width: 0; font-size: 13px; }
    tbody { gap: 7px; }
    tr {
        padding: 8px 12px;
        border: 1px solid #dce6ec;
        border-radius: 8px;
        box-shadow: 0 4px 14px rgba(24, 55, 78, .06);
    }
    .module-table tr { position: relative; }
    td {
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 10px;
        min-height: 34px;
        padding: 8px 0;
    }
    .module-table td.select-cell {
        position: absolute;
        z-index: 2;
        left: 50%;
        bottom: 15px;
        display: flex;
        width: 28px;
        min-height: 24px;
        padding: 0;
        transform: translateX(-50%);
        border: 0;
    }
    .module-table td.select-cell::before { display: none; }
    .module-table td.select-cell input { width: 18px; height: 18px; margin: 0; }
    td.actions {
        gap: 8px;
        padding-top: 11px;
        justify-content: center;
    }
    td.actions .button, td.actions form {
        flex: 1 1 110px;
    }
    td.actions .button {
        width: auto;
        justify-content: center;
        text-align: center;
    }
    td.inspection-actions {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    td.inspection-actions::before {
        display: none;
    }
    td.inspection-actions .button,
    td.inspection-actions form {
        flex: 1 1 82px;
    }
    .module-table td.module-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
        gap: 8px;
        padding: 11px 0 4px;
    }
    .module-table td.module-actions::before { display: none; }
    .module-table td.module-actions .button {
        width: 100%;
        min-width: 0;
    }
    .module-table td.scene-image-cell {
        align-items: center;
    }
    .module-table .scene-thumbnail {
        width: 112px;
        height: 78px;
        border-radius: 8px;
        object-fit: cover;
    }
    .module-table .image-empty {
        width: 112px;
        height: 78px;
        border-radius: 8px;
    }
    .pagination { gap: 10px; }
    .pagination-controls { width: 100%; gap: 8px; }
    .pagination-jump { grid-column: 1 / -1; width: 100%; }
    .pagination-jump input { flex: 1; width: auto; }
    .home-slider, .slider-track, .slider-slide, .slider-slide img {
        min-height: 210px;
        height: 210px;
    }
    .existing-slide {
        grid-template-columns: 86px minmax(0, 1fr);
    }
    .existing-slide img {
        width: 86px;
        height: 58px;
    }
    .existing-slide .check-line {
        grid-column: 1 / -1;
    }
    .slider-copy { padding: 20px 52px 18px 18px; }
    .menu-list-panel .table-wrap,
    .dictionary-layout .table-wrap {
        overflow-x: auto;
        border: 1px solid #dce6ec;
        background: #fff;
    }
    .menu-items-table,
    .dictionary-items-table {
        display: table;
        width: 100%;
        min-width: max-content;
        table-layout: auto;
    }
    .menu-items-table thead,
    .dictionary-items-table thead {
        display: table-header-group;
    }
    .menu-items-table tbody,
    .dictionary-items-table tbody {
        display: table-row-group;
    }
    .menu-items-table tr,
    .dictionary-items-table tr {
        display: table-row;
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .menu-items-table th,
    .menu-items-table td,
    .dictionary-items-table th,
    .dictionary-items-table td {
        display: table-cell;
        min-height: 0;
        padding: 9px 10px;
        white-space: nowrap;
        border-bottom: 1px solid #e6edf1;
    }
    .menu-items-table td::before,
    .dictionary-items-table td::before {
        display: none;
    }
    .menu-items-table tr:last-child td,
    .dictionary-items-table tr:last-child td {
        border-bottom: 0;
    }
}

/* Final readability and image interaction adjustments. */
.nav-list a, .nav-group summary { font-size: 15px; }
.nav-sublist a { font-size: 14px; }
table { font-size: 14px; }
th { font-size: 13px; }
.work-photo-preview:not(.zoomed) {
    display: block;
    width: 78px !important;
    height: 56px !important;
    max-width: 78px !important;
    max-height: 56px !important;
    object-fit: cover;
}
.detail-item span { font-size: 13px; }
.detail-item strong, .detail-item a { font-size: 15px; }
.scene-thumbnail {
    width: 120px;
    height: 86px;
}
.image-empty {
    width: 120px;
    height: 86px;
}
.detail-image.zoomed, .scene-thumbnail.zoomed, .work-photo-preview.zoomed {
    z-index: 1100;
    width: 88vw;
    height: 88vh;
    max-width: none;
    max-height: none;
}
.dialog-close-button {
    min-width: 68px;
    justify-content: center;
}
.mobile-select-slot { display: none; }
.filter-row {
    grid-template-columns: minmax(260px, 1.8fr) minmax(160px, .85fr) 118px minmax(250px, auto);
}
.batch-delete-button {
    color: #8b4b4b;
    background: #f8eeee;
    border-color: #ead0d0;
}
.batch-delete-button:hover {
    color: #753b3b;
    background: #f3e4e4;
    border-color: #dfbcbc;
}
.qr-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #eef3f7;
}
.qr-print-shell {
    width: min(100%, 620px);
    padding: 28px;
}
.qr-card {
    display: grid;
    justify-items: center;
    gap: 18px;
    padding: 28px;
    background: #fff;
    border: 1px solid #dbe4ec;
    border-radius: 8px;
    box-shadow: 0 18px 38px rgba(20, 35, 55, .12);
}
.qr-image-card {
    display: grid;
    justify-items: center;
    gap: 12px;
    width: min(100%, 560px);
    padding: 20px 20px 18px;
    background: #fff;
    border: 1px solid #e1e7ee;
}
@media print {
    .qr-link-box {
        display: none;
    }
}
.qr-image {
    display: block;
    width: min(100%, 520px);
    height: auto;
}
.qr-image-card strong {
    color: #111827;
    font-size: 28px;
    line-height: 1.25;
    text-align: center;
}
.qr-link-box {
    display: grid;
    gap: 5px;
    width: min(100%, 520px);
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e1e7ee;
    border-radius: 8px;
}
.qr-link-box span {
    color: #64748b;
    font-size: 12px;
}
.qr-link-box a {
    color: #1d4c67;
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.qr-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}
.scan-page {
    min-height: 100vh;
    background: #eef3f7;
}
.scan-shell {
    width: min(100%, 960px);
    margin: 0 auto;
    padding: 22px;
}
.scan-card {
    padding: 22px;
    background: #fff;
    border: 1px solid #dbe4ec;
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(20, 35, 55, .1);
}
.scan-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e5edf3;
}
.scan-heading span {
    display: block;
    margin-bottom: 5px;
    color: #64748b;
    font-size: 14px;
}
.scan-heading h1 {
    margin: 0;
    font-size: 26px;
}
.scan-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-top: 18px;
}
.scan-detail-item {
    min-height: 74px;
    padding: 12px;
    border: 1px solid #e5edf3;
    border-radius: 8px;
    background: #f8fafc;
}
.scan-detail-item span {
    display: block;
    margin-bottom: 7px;
    color: #64748b;
    font-size: 13px;
}
.scan-detail-item strong {
    color: #111827;
    font-size: 16px;
    line-height: 1.55;
    white-space: pre-wrap;
}
.scan-detail-item img {
    max-width: 100%;
    max-height: 260px;
    border-radius: 8px;
    object-fit: contain;
}
.inspection-form,
.scan-inspection-history {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e5edf3;
}
.inspection-locked-card {
    display: grid;
    gap: 7px;
    margin-top: 18px;
    padding: 16px 18px;
    color: #1f6f5d;
    background: #e8f7f1;
    border: 1px solid #b9e2d3;
    border-left: 5px solid var(--teal);
    border-radius: 8px;
}
.inspection-locked-card strong {
    font-size: 22px;
    color: #12614f;
}
.inspection-locked-card span,
.inspection-locked-card small {
    color: #2f665b;
}
.inspection-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.inspection-heading h2 {
    margin: 0;
    color: #111827;
    font-size: 20px;
}
.inspection-heading span {
    color: #64748b;
    font-size: 13px;
}
.inspection-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.inspection-grid label {
    display: grid;
    gap: 7px;
    color: #243447;
    font-weight: 700;
}
.inspection-grid .span-2 {
    grid-column: 1 / -1;
}
.inspection-grid small {
    color: #64748b;
    font-weight: 400;
}
.inspection-history-list {
    display: grid;
    gap: 10px;
}
.inspection-history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e5edf3;
    border-radius: 8px;
}
.inspection-history-item strong,
.inspection-history-item span {
    display: block;
}
.inspection-history-item span {
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
}
.inspection-history-item p {
    grid-column: 1 / -1;
    margin: 0;
    color: #334155;
    line-height: 1.55;
}
.inspection-history-item img,
.inspection-photo-thumb {
    width: 72px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #dbe4ec;
}
.inspection-filter-row {
    grid-template-columns: minmax(180px, 1fr) 160px 145px 145px 120px auto;
}
.inspection-table td {
    vertical-align: middle;
}
.inspection-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.inspection-actions form {
    display: inline;
}
.image-empty.small {
    width: auto;
    height: auto;
    padding: 4px 8px;
}
.inspection-scan-panel {
    max-width: 760px;
}
.scan-tool {
    display: grid;
    gap: 14px;
}
.scan-tool-copy {
    display: grid;
    gap: 6px;
    padding: 14px;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #e1e7ee;
    border-radius: 8px;
}
.scan-tool-copy strong {
    color: #102334;
    font-size: 18px;
}
.scan-video-wrap {
    position: relative;
    overflow: hidden;
    background: #0f172a;
    border-radius: 8px;
}
.scan-video-wrap[hidden] {
    display: none;
}
.scan-video {
    width: 100%;
    min-height: 280px;
    background: #0f172a;
    object-fit: cover;
}
.scan-frame {
    position: absolute;
    inset: 50%;
    width: min(68vw, 300px);
    height: min(68vw, 300px);
    transform: translate(-50%, -50%);
    border: 3px solid rgba(255,255,255,.9);
    border-radius: 12px;
    box-shadow: 0 0 0 999px rgba(15, 23, 42, .25);
}
.scan-frame::before,
.scan-frame::after {
    content: "";
    position: absolute;
    width: 34px;
    height: 34px;
    border-color: #13c2c2;
}
.scan-frame::before {
    top: -3px;
    left: -3px;
    border-top: 5px solid #13c2c2;
    border-left: 5px solid #13c2c2;
}
.scan-frame::after {
    right: -3px;
    bottom: -3px;
    border-right: 5px solid #13c2c2;
    border-bottom: 5px solid #13c2c2;
}
.scan-frame span {
    position: absolute;
    left: 10px;
    right: 10px;
    top: 18px;
    height: 3px;
    background: #13c2c2;
    box-shadow: 0 0 14px rgba(19, 194, 194, .85);
    animation: scan-line 1.8s linear infinite;
}
@keyframes scan-line {
    from { top: 18px; }
    to { top: calc(100% - 21px); }
}
.scan-tool-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.scan-tool-actions .button {
    flex: 0 1 230px;
}
.scan-message {
    margin-bottom: 0;
}
.manual-scan-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    justify-items: center;
}
.manual-scan-form label {
    display: grid;
    gap: 7px;
    width: min(100%, 560px);
    color: #243447;
    font-weight: 700;
    text-align: center;
}
.manual-scan-submit {
    display: flex;
    justify-content: center;
    width: 100%;
}
.manual-scan-submit .button {
    min-width: 210px;
}

@media (max-width: 620px) {
    table { font-size: 14px; }
    .work-photo-card {
        align-items: flex-start;
        flex-direction: column;
    }
    .work-photo-preview {
        width: 78px;
        max-width: none;
        height: 56px;
    }
    .filter-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .filter-row input[name="keyword"] { grid-column: 1 / -1; }
    .filter-actions {
        grid-column: 1 / -1;
        display: flex;
    }
    .module-table td.select-cell {
        left: 12px;
        bottom: 15px;
        transform: none;
    }
    .module-table td.module-actions {
        grid-template-columns: 22px repeat(3, minmax(0, 1fr));
        align-items: center;
        gap: 5px;
    }
    .module-table td.module-actions.has-qr-action {
        grid-template-columns: 22px repeat(4, minmax(0, 1fr));
    }
    .module-table td.module-actions .mobile-select-slot {
        display: block;
        grid-column: 1;
        width: 22px;
    }
    .module-table td.module-actions .single-delete-button { grid-column: 2; }
    .module-table td.module-actions .detail-action-button { grid-column: 3; }
    .module-table td.module-actions .edit-action-button { grid-column: 4; }
    .module-table td.module-actions .qr-action-button { grid-column: 5; }
    .module-table td.module-actions .button {
        width: 100%;
        min-width: 0;
        min-height: 32px;
        padding: 4px 3px;
        font-size: 12px;
        white-space: nowrap;
    }
    .module-table .scene-thumbnail,
    .module-table .image-empty {
        width: 150px;
        height: 104px;
    }
    .module-table .scene-thumbnail.zoomed {
        position: fixed;
        z-index: 1100;
        inset: 6vh 6vw;
        width: 88vw;
        height: 88vh;
        max-width: none;
        max-height: none;
        object-fit: contain;
        cursor: zoom-out;
    }
    .scan-heading {
        align-items: stretch;
        flex-direction: column;
    }
    .scan-detail-grid {
        grid-template-columns: 1fr;
    }
    .inspection-grid {
        grid-template-columns: 1fr;
    }
    .inspection-filter-row {
        grid-template-columns: 1fr 1fr;
    }
    .inspection-filter-row input[name="keyword"],
    .inspection-filter-row .filter-actions {
        grid-column: 1 / -1;
    }
    .inspection-history-item {
        grid-template-columns: minmax(0, 1fr) 64px;
    }
    .inspection-history-item img,
    .inspection-photo-thumb {
        width: 64px;
        height: 48px;
    }
    .manual-scan-form {
        grid-template-columns: 1fr;
    }
    .scan-video {
        min-height: 240px;
    }
    .meter-start-month-form {
        align-items: stretch;
        flex-direction: column;
    }
    .meter-start-month-form .button {
        width: 100%;
    }
    .meter-start-progress {
        align-items: flex-start;
        flex-direction: column;
    }
    .meter-start-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

@media print {
    @page { size: A4 portrait; margin: 8mm; }
    body.qr-batch-page { background: #fff; }
    body.qr-batch-page .qr-batch-shell { padding: 0; }
    body.qr-batch-page .qr-batch-actions { display: none; }
    body.qr-batch-page .qr-batch-sheet {
        width: 100%;
        min-height: 277mm;
        margin: 0;
        padding: 0;
        box-shadow: none;
        break-after: page;
    }
    body.qr-batch-page .qr-batch-sheet:last-child { break-after: auto; }
    body.qr-page {
        background: #fff;
    }
    .qr-print-shell {
        width: 100%;
        padding: 0;
    }
    .qr-card {
        padding: 0;
        border: 0;
        box-shadow: none;
    }
    .qr-actions {
        display: none;
    }
}

/* APP polish: full-screen mobile shell with a cleaner engineering-dashboard feel. */
:root {
    --app-rail: #0f2b3f;
    --app-rail-2: #123a50;
    --app-cyan: #20a7bd;
    --app-green: #24a37b;
    --app-gold: #d59a2b;
}

.app-shell {
    background: linear-gradient(180deg, #1ca78f 5%, #f7fafb 44%, #05525f 100%);
}

.sidebar {
    background:
        linear-gradient(180deg, #0f2b3f 0%, #123a50 58%, #102b3e 100%);
    border-right: 1px solid rgba(85, 207, 210, .16);
}

.sidebar-brand {
    color: #f7fcff;
}

.nav-list a,
.nav-group summary {
    color: #c8dbe5;
}

.nav-list a:hover,
.nav-list a.active,
.nav-group[open] summary {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(36, 163, 123, .22), rgba(32, 167, 189, .12));
    border-left-color: var(--app-cyan);
    box-shadow: inset 0 0 0 1px rgba(89, 207, 213, .08);
}

.topbar {
    padding: 12px 14px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid rgba(208, 224, 232, .78);
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(20, 52, 73, .07);
    backdrop-filter: blur(12px);
}

.topbar-title h1 {
    color: #10283b;
}

.mobile-menu-toggle {
    box-shadow: inset 0 0 0 1px rgba(32, 167, 189, .14), 0 6px 16px rgba(17, 58, 80, .12);
}

.stats-grid {
    align-items: stretch;
}

.stat-card {
    position: relative;
    overflow: hidden;
    border-top: 0;
    border-left: 4px solid var(--blue);
}

.stat-card::after {
    content: "";
    position: absolute;
    right: 14px;
    bottom: 12px;
    width: 44px;
    height: 3px;
    background: linear-gradient(90deg, var(--app-green), var(--app-cyan), var(--app-gold));
    opacity: .55;
}

.stat-card span,
.module-card span,
.quick-action span {
    color: #667d8c;
}

.panel {
    background: rgba(255, 255, 255, .92);
}

.module-card,
.quick-action {
    position: relative;
    overflow: hidden;
}

.module-card::after,
.quick-action::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 54px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(32, 167, 189, .08));
    pointer-events: none;
}

.module-card strong,
.quick-action strong {
    color: #14364d;
}

@media (max-width: 900px) {
    .app-shell {
        display: block;
        min-height: 100dvh;
        background: transparent;
    }

    .main-content {
        min-height: 100dvh;
        padding-top: 14px;
        background:
            linear-gradient(135deg, rgba(36, 163, 123, .10), transparent 34%),
            linear-gradient(180deg, #eef6f8 0%, #f8fbfc 42%, #eef4f6 100%);
    }

    .sidebar {
        background:
            linear-gradient(180deg, #0c2538 0%, #12384f 100%);
    }

    .topbar {
        margin-bottom: 14px;
    }
}

@media (max-width: 620px) {
    .main-content {
        padding: 8px 6px 24px;
    }

    .topbar {
        margin: 0 0 12px;
        padding: 10px;
        border-radius: 0 0 12px 12px;
        border-top: 0;
        border-right: 0;
        border-left: 0;
        background: rgba(246, 251, 252, .94);
    }

    .mobile-menu-toggle {
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        font-size: 24px;
        color: #0f3a51;
        background: #e6f3f5;
        border-color: #c9e0e8;
    }

    .topbar-title {
        gap: 9px;
    }

    .topbar-title h1 {
        font-size: 28px;
        line-height: 1.08;
    }

    .topbar-meta {
        display: none;
    }

    .stats-grid,
    .stats-six {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        margin-bottom: 12px;
    }

    .stat-card {
        min-height: 94px;
        padding: 13px 14px;
        border-left-width: 3px;
        border-radius: 8px;
        box-shadow: 0 5px 15px rgba(20, 52, 73, .07);
    }

    .stat-card strong {
        font-size: 25px;
    }

    .stat-card small {
        font-size: 11px;
    }

    .panel {
        padding: 9px;
        margin-bottom: 12px;
        border-radius: 8px;
        box-shadow: 0 5px 15px rgba(20, 52, 73, .06);
    }

    .content-grid.two {
        gap: 12px;
    }

    .module-cards,
    .quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .module-card,
    .quick-action {
        min-height: 84px;
        padding: 11px 9px;
        border-radius: 8px;
    }

    .module-card {
        grid-template-rows: auto 1fr auto;
    }

    .module-card i {
        position: static;
        justify-self: end;
        align-self: end;
        margin-top: 2px;
    }

    .quick-action span,
    .module-card span {
        display: block;
        padding-right: 0;
        font-size: 10.5px;
        white-space: nowrap;
    }

    .sidebar {
        width: min(82vw, 292px);
        padding-top: 18px;
    }
}

/* Photo capture, crop, and compression UI. */
.image-field { display: grid; gap: 10px; align-content: start; }
.image-url-field { margin: 0; }
.image-upload-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: #f7fafb;
    border: 1px solid #dce7ed;
    border-radius: 8px;
}
.photo-source-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.image-upload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.image-upload-actions small { flex-basis: 100%; color: #667987; font-size: 12px; line-height: 1.5; }
.photo-watermark-toggle { display: inline-flex; align-items: center; gap: 5px; width: auto; margin: 0; padding: 5px 8px; color: #486173; background: #eef7fb; border: 1px solid #cbe0ea; border-radius: 8px; font-size: 12px; font-weight: 700; }
.photo-watermark-toggle input { width: auto; margin: 0; accent-color: var(--blue); }
.image-preview-box { display: flex; justify-content: flex-end; min-width: 130px; }
.meter-add-second-photo { display: flex; justify-content: center; align-items: center; min-height: 42px; margin-top: -4px; }
.meter-add-photo-button {
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    color: transparent;
    background: #f8fff5;
    border: 3px solid #2f7d18;
    border-radius: 50%;
    cursor: pointer;
}
.meter-add-photo-button::before,
.meter-add-photo-button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 25px;
    height: 3px;
    background: #2f7d18;
    border-radius: 999px;
    transform: translate(-50%, -50%);
}
.meter-add-photo-button::after { transform: translate(-50%, -50%) rotate(90deg); }
.meter-add-photo-button:hover { background: #ecffe7; border-color: #236511; }
.meter-add-photo-button:hover::before,
.meter-add-photo-button:hover::after { background: #236511; }
.meter-second-photo-collapsed { display: none !important; }
.meter-second-photo-field.is-open { animation: meterPhotoReveal .16s ease-out; }
.elevator-photo-collapsed { display: none !important; }
.elevator-extra-photo-field.is-open { animation: meterPhotoReveal .16s ease-out; }
.elevator-add-photo { margin-top: -6px; margin-bottom: 2px; }
.elevator-add-photo[hidden] { display: none !important; }
@keyframes meterPhotoReveal {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.image-field-preview {
    display: block;
    width: 120px;
    height: 86px;
    object-fit: cover;
    cursor: zoom-in;
    background: #fff;
    border: 1px solid #cfdee6;
    border-radius: 8px;
}
.photo-editor-dialog {
    width: min(94vw, 560px);
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 24px 88px rgba(12, 31, 48, .32);
}
.photo-editor-dialog::backdrop { background: rgba(8, 24, 38, .58); }
.photo-editor-shell { display: grid; gap: 0; background: #fff; }
.photo-editor-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e5edf1;
}
.photo-editor-frame {
    position: relative;
    height: min(58vh, 440px);
    min-height: 300px;
    overflow: hidden;
    touch-action: none;
    background: #111827;
}
.photo-editor-frame img {
    position: absolute;
    left: 0;
    top: 0;
    max-width: none;
    max-height: none;
    transform-origin: 0 0;
    user-select: none;
    -webkit-user-drag: none;
}
.photo-crop-box {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(82%, 340px);
    height: min(72%, 260px);
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0,0,0,.48);
    border-radius: 10px;
}
.photo-crop-mask { display: none; }
.photo-editor-controls { display: grid; gap: 10px; padding: 14px 16px 16px; }
.photo-editor-controls label { margin: 0; }
.photo-editor-controls input[type="range"] { width: 100%; }
.photo-editor-actions { display: flex; justify-content: flex-end; gap: 10px; }
.photo-editor-controls small { color: #667987; }
.danger-zone {
    border-color: #efcaca;
    background: linear-gradient(180deg, #fffafa, #fff);
}
.danger-zone .panel-heading h2 { color: #8f3434; }
.danger-dialog {
    width: min(94vw, 520px);
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 22px 80px rgba(35, 18, 18, .28);
}
.danger-dialog::backdrop { background: rgba(20, 24, 28, .48); }
.danger-dialog-body { display: grid; margin: 0; background: #fff; }
.danger-dialog-content { display: grid; gap: 14px; padding: 18px 20px 20px; }
.danger-dialog-content p { color: #7b4444; }

@media (max-width: 640px) {
    .maintenance-dialog {
        width: 96vw;
        max-width: none;
        max-height: calc(100vh - 16px);
    }
    .maintenance-dialog-form { max-height: calc(100vh - 16px); }
    .maintenance-dialog-content {
        grid-template-columns: 1fr;
        padding: 16px 16px 4px;
    }
    .maintenance-dialog-content .span-2 {
        grid-column: auto;
    }
    .maintenance-options-list {
        grid-template-columns: 1fr;
        max-height: 150px;
        min-width: 0;
        overflow-x: hidden;
    }
    .maintenance-detail-row {
        grid-template-columns: 24px minmax(0, .8fr) minmax(0, 1.2fr);
        gap: 6px;
    }
    .maintenance-dialog-form .form-actions {
        padding: 12px 16px 16px;
    }
    .maintenance-dialog-form .form-actions .button {
        flex: 1 1 0;
        white-space: nowrap;
    }
    .qr-print-toolbar .button {
        flex: 1 1 0;
        white-space: nowrap;
    }
    .meter-reading-panel-body { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .image-upload-panel { grid-template-columns: 1fr; }
    .image-preview-box { justify-content: flex-start; }
    .photo-editor-dialog { width: 96vw; }
    .photo-editor-frame { height: 56vh; min-height: 280px; }
    .photo-editor-actions { justify-content: stretch; }
    .photo-editor-actions .button { flex: 1 1 0; }
}

[data-photo-field] .image-upload-actions > small { display: none; }

.back-to-top {
    position: fixed;
    right: 26px;
    bottom: 28px;
    z-index: 850;
    display: grid;
    width: 56px;
    height: 56px;
    place-items: center;
    padding: 0;
    color: #fff;
    background: #3368bb;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 13px 24px rgba(29, 61, 107, .24), 0 4px 9px rgba(29, 61, 107, .12);
    cursor: pointer;
    font-size: 34px;
    font-weight: 300;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity .18s ease, transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.back-to-top.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
@media (max-width: 900px) {
    .back-to-top.mobile-ready {
        transform: translateY(0);
        touch-action: manipulation;
    }
}
.back-to-top:hover {
    background: #2f60ad;
    box-shadow: 0 16px 28px rgba(29, 61, 107, .28), 0 5px 12px rgba(29, 61, 107, .15);
}

.app-back-to-top {
    position: fixed;
    right: 12px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    z-index: 2500;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    color: #fff;
    background: #016532;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 10px 20px rgba(0, 51, 32, .28);
    cursor: pointer;
    font-size: 25px;
    font-weight: 400;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity .18s ease, transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.app-back-to-top.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.app-back-to-top:hover {
    background: #014b28;
    box-shadow: 0 14px 24px rgba(0, 51, 32, .34);
}

/*
 * Mobile image viewer. The viewer owns the touch gesture so a pinch only
 * changes the image, never the page behind it.
 */
body.image-viewer-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}
.image-viewer-dialog {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
}
.image-viewer-dialog::backdrop {
    background: transparent;
}
.image-viewer-overlay {
    position: fixed;
    z-index: 4000;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 5vh 5vw;
    background: rgba(8, 20, 28, .86);
    touch-action: none;
    overscroll-behavior: none;
    user-select: none;
    -webkit-user-select: none;
}
.image-viewer-overlay[hidden] {
    display: none;
}
.detail-dialog.image-viewer-host,
.maintenance-dialog.image-viewer-host,
.photo-editor-dialog.image-viewer-host {
    overflow: visible;
}
.image-viewer-overlay img {
    display: block;
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    border: 1px solid rgba(255,255,255,.38);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 20px 80px rgba(0,0,0,.45);
    touch-action: none;
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: center center;
    will-change: transform;
}
.image-viewer-close {
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    z-index: 1;
    width: 40px;
    height: 40px;
    padding: 0;
    color: #fff;
    border: 1px solid rgba(255,255,255,.42);
    border-radius: 50%;
    background: rgba(0,0,0,.32);
    font-size: 26px;
    line-height: 1;
}

@media (max-width: 900px) {
    .detail-dialog {
        width: min(94vw, 560px);
        height: auto;
        max-height: min(86vh, 720px);
        max-height: min(86dvh, 720px);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }
    .detail-dialog[open] {
        display: block;
    }
    .detail-dialog .dialog-heading {
        position: sticky;
        top: 0;
        z-index: 2;
    }
    .detail-dialog .detail-grid {
        display: grid;
        height: auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 640px) {
    .back-to-top {
        right: 10px;
        bottom: 12px;
        width: 40px;
        height: 40px;
        font-size: 23px;
    }
}

/* Browser and APP buttons are intentionally separate. */
body.app-webview .browser-back-to-top {
    display: none;
}
body.browser-page .app-back-to-top {
    display: none;
}

@media (max-width: 760px) {
    .app-footer {
        padding-right: 4px;
        padding-left: 4px;
    }
    .app-footer-main {
        display: grid;
        gap: 3px;
    }
    .app-footer-main > span {
        padding: 0 4px;
    }
    .app-footer-main > span + span {
        border-left: 0;
    }
    .license-expiry-warning {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
    .elevator-alert-grid,
    .elevator-track-filter,
    .maintenance-plan-filter,
    .work-order-filter {
        grid-template-columns: 1fr;
    }
    .operations-alert-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .elevator-dashboard-alert .operations-alert-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .operations-alert-card {
        min-height: 84px;
        padding: 11px 8px;
    }
    .operations-alert-count span {
        font-size: 20px;
    }
    .operations-alert-count span b {
        font-size: 28px;
    }
    .elevator-track-filter input[name="keyword"],
    .elevator-track-filter .filter-actions,
    .work-order-filter input[name="keyword"],
    .work-order-filter .filter-actions {
        grid-column: auto;
    }
    .elevator-track-tabs {
        justify-content: flex-start;
    }
    .elevator-track-tabs .button {
        flex: 1 1 calc(50% - 8px);
    }
    .elevator-track-table .elevator-track-photos {
        min-width: 0;
        flex-wrap: wrap;
    }
    .work-order-card {
        grid-template-columns: 1fr;
    }
    .work-order-title-line {
        align-items: flex-start;
        flex-direction: column;
    }
    .work-order-photos {
        justify-content: flex-start;
    }
    .work-order-inline-form,
    .work-order-close-form,
    .work-order-inline-form select,
    .work-order-close-form input,
    .work-order-actions .button {
        width: 100%;
    }
    .work-order-reminder-row {
        align-items: center;
        flex-wrap: nowrap;
    }
    .work-order-reminder-row .button {
        width: auto;
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* Mobile list controls: keep the search and category controls together,
 * while the page-size choice lives beside the page jump input. */
@media (max-width: 900px) {
    .module-filter-row {
        grid-template-columns: minmax(0, 1fr) minmax(128px, .58fr);
    }
    .module-filter-row input[name="keyword"] {
        grid-column: 1;
    }
    .module-filter-row select[name="filter_field"] {
        grid-column: 2;
    }
    .module-filter-row .filter-actions {
        grid-column: 1 / -1;
    }
    .column-toggle-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px 8px;
    }
    .column-toggle-item {
        display: flex;
        align-items: center;
        min-width: 0;
        gap: 6px;
        min-height: 28px;
        overflow: hidden;
        font-size: 12px;
        line-height: 1.25;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .column-toggle-item input[type="checkbox"] {
        width: 18px;
        height: 18px;
        min-width: 18px;
        min-height: 18px;
        margin: 0;
        padding: 0;
    }
    .permission-fieldset .permission-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px 10px;
    }
    .permission-fieldset .check-line {
        min-width: 0;
        gap: 6px;
        font-size: 12px;
        line-height: 1.25;
        white-space: nowrap;
    }
    .permission-fieldset .check-line input[type="checkbox"] {
        width: 18px;
        height: 18px;
        min-width: 18px;
        min-height: 18px;
        margin: 0;
        padding: 0;
    }
}

@media (max-width: 620px) {
    .module-filter-row {
        grid-template-columns: minmax(0, 1fr) minmax(112px, .62fr);
    }
    .module-filter-row input[name="keyword"] {
        grid-column: 1;
    }
    .module-filter-row select[name="filter_field"] {
        grid-column: 2;
    }
    .module-filter-row .filter-actions {
        grid-column: 1 / -1;
    }
    .pagination-jump {
        display: grid;
        grid-template-columns: minmax(82px, .9fr) minmax(0, 1fr) auto;
        align-items: center;
        width: 100%;
        gap: 6px;
    }
    .pagination-jump select,
    .pagination-jump input {
        width: 100%;
        min-width: 0;
    }
    .pagination-jump button {
        width: auto;
        min-width: 48px;
        padding-right: 8px;
        padding-left: 8px;
    }
}
