        :root {
            --bg-main: linear-gradient(180deg, #f3f7fb 0%, #edf2f7 100%);
            --bg-card: #ffffff;
            --bg-top-bar: rgba(255,255,255,0.8);
            --bg-bottom-bar: rgba(255,255,255,0.8);
            --border-card: #d7e0ea;
            --text-main: #1f2937;
            --text-muted: #6b7280;
            --text-error: #d32f2f;
            --text-green: #0f9f68;
            --divider: #d7e0ea;
            --accent: #1f6fb2;
            --accent-soft: #eaf3fb;
            --focus-ring: rgba(31, 111, 178, 0.2);
            --focus-ring-success: rgba(15, 159, 104, 0.28);
            --focus-ring-error: rgba(211, 47, 47, 0.28);
            --shadow-soft: 0 14px 30px rgba(15, 23, 42, 0.08);
            --shadow-pill: 0 10px 24px rgba(15, 23, 42, 0.12);
        }

        * {
            box-sizing: border-box;
            font-family: system-ui, -apple-system, BlinkMacSystemFont, "Roboto", sans-serif;
            -webkit-tap-highlight-color: transparent;
        }

        html {
            height: 100%;
        }

        body {
            margin: 0;
            padding: 0;
            background: var(--bg-main);
            color: var(--text-main);
            min-height: 100vh;
            height: 100dvh;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        .hidden {
            display: none !important;
        }

        /* Top bar */
        #top-pill {
            position: fixed;
            top: env(safe-area-inset-top);
            z-index: 10;
            left: 0;
            right: 0;
            transform: none;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: calc(9px + env(safe-area-inset-top)) 16px 7px;
            min-height: 48px;
            border-radius: 0;
            background: rgba(255, 255, 255, 0.92);
            backdrop-filter: blur(14px);
            -webkit-backdrop-filter: blur(14px);
            border-bottom: 1px solid rgba(215, 224, 234, 0.82);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
        }

        #top-mode-switch {
            position: fixed;
            top: calc(env(safe-area-inset-top) + 50px);
            left: 10px;
            right: 10px;
            z-index: 11;
            display: flex;
            align-items: center;
            gap: 0;
            padding: 3px;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.95);
            border: 1px solid rgba(255, 255, 255, 0.98);
            box-shadow: 0 18px 34px rgba(15, 23, 42, 0.16);
            overflow: hidden;
        }

        #top-mode-slider {
            position: absolute;
            top: 3px;
            left: 3px;
            bottom: 3px;
            width: calc(50% - 3px);
            border-radius: 999px;
            background: linear-gradient(180deg, #f3f8fd 0%, #e7f1fb 100%);
            box-shadow: 0 8px 20px rgba(31, 111, 178, 0.14), inset 0 0 0 1px rgba(31, 111, 178, 0.08);
            transform: translateX(0);
            transition: transform 0.22s ease, background-color 0.18s ease, box-shadow 0.18s ease;
            pointer-events: none;
        }

        .top-tab {
            position: relative;
            z-index: 1;
            flex: 1 1 0;
            min-width: 0;
            min-height: 31px;
            border: none;
            border-radius: 999px;
            background: transparent;
            color: var(--text-muted);
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            transition: color 0.18s ease;
        }

        .top-tab.active {
            color: var(--accent);
        }

        .top-tab:disabled {
            opacity: 0.7;
            cursor: default;
        }

        #preview-badge {
            position: fixed;
            top: calc(env(safe-area-inset-top) + 92px);
            right: 16px;
            z-index: 11;
            padding: 8px 12px;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.88);
            color: #ffffff;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
        }

        #connection-indicator {
            width: 12px;
            height: 12px;
            margin-right: 2px;
            border-radius: 999px;
            background: #ef4444;
            box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18);
            flex: 0 0 auto;
            font-size: 0;
            line-height: 0;
            color: transparent;
            animation: connectionPulse 1.8s ease-in-out infinite;
        }

        #connection-indicator.online {
            background: #10b981;
            box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
        }

        #connection-indicator.preview {
            background: #94a3b8;
            box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.18);
        }

        #connection-indicator.idle {
            animation-play-state: paused;
        }

        #status-text {
            font-size: 11px;
            font-weight: 600;
            color: var(--text-muted);
            white-space: nowrap;
        }

        body.archive-mode #connection-indicator,
        body.archive-mode #status-text {
            display: none;
        }

        #title-text {
            font-size: 15px;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
        }

        main {
            padding: 0 8px 0;
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }

        /* Bottom bar */
        #bottom-bar {
            position: fixed;
            left: 18px;
            right: 18px;
            bottom: 12px;
            z-index: 10;
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
            padding: 0;
            background: transparent;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
            border: none;
            border-radius: 0;
            box-shadow: none;
            isolation: isolate;
            transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
        }

        body.archive-mode #bottom-bar {
            transform: translateY(calc(100% + 22px));
            opacity: 0;
            pointer-events: none;
        }

        .btn {
            position: relative;
            overflow: hidden;
            min-height: 44px;
            padding: 10px 16px;
            border-radius: 999px;
            border: none;
            background: var(--accent);
            color: white;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease, background-color 0.16s ease;
            box-shadow: 0 10px 22px rgba(31, 111, 178, 0.22);
        }

        #bottom-bar .btn {
            flex: 1 1 0;
            min-width: 0;
            max-width: none;
            margin: 0;
            text-align: center;
            display: inline-flex;
            justify-content: center;
            align-items: center;
            gap: 0;
            padding: 0 14px;
            min-height: 36px;
            background: rgba(255, 255, 255, 0.98);
            border: 1px solid rgba(215, 224, 234, 0.96);
            color: var(--text-main);
            box-shadow: 0 20px 34px rgba(15, 23, 42, 0.2);
            transition: background-color 0.06s linear, color 0.06s linear, border-color 0.06s linear, box-shadow 0.06s linear;
            transform: none;
        }

        .btn-icon {
            display: none;
        }

        .btn-text {
            font-size: 16px;
            line-height: 1.05;
            min-width: 0;
        }

        #bottom-bar .btn:active {
            background: var(--accent);
            color: #ffffff;
            border-color: rgba(31, 111, 178, 0.22);
            box-shadow: 0 14px 24px rgba(31, 111, 178, 0.24);
            transform: none;
        }

        #bottom-bar .btn.secondary:active {
            background: var(--accent);
            color: #ffffff;
            border-color: rgba(31, 111, 178, 0.22);
        }

        #save-btn:active {
            background: var(--accent);
            color: #ffffff;
            border-color: rgba(31, 111, 178, 0.22);
            box-shadow: 0 14px 24px rgba(31, 111, 178, 0.24);
            transform: none;
        }

        #bottom-bar .btn.pressed {
            background: var(--accent);
            color: #ffffff;
            border-color: rgba(31, 111, 178, 0.22);
            box-shadow: 0 14px 24px rgba(31, 111, 178, 0.24);
            transform: none;
        }

        #bottom-bar .btn.secondary.pressed {
            background: var(--accent);
            color: #ffffff;
            border-color: rgba(31, 111, 178, 0.22);
        }

        #save-btn.pressed {
            background: var(--accent);
            color: #ffffff;
            border-color: rgba(31, 111, 178, 0.22);
            box-shadow: 0 14px 24px rgba(31, 111, 178, 0.24);
        }

        .btn:hover:not(:disabled) {
            transform: translateY(-1px);
        }

        .btn:active {
            transform: scale(0.97);
        }

        .btn:focus {
            outline: none;
        }

        .btn:focus-visible,
        .field-input:focus-visible,
        .login-input:focus-visible,
        .password-toggle-btn:focus-visible {
            outline: none;
            box-shadow: 0 0 0 3px var(--focus-ring);
        }

        #bottom-bar .btn.secondary {
            background: rgba(255, 255, 255, 0.98);
            color: #334155;
            border: 1px solid rgba(215, 224, 234, 0.96);
            box-shadow: 0 20px 34px rgba(15, 23, 42, 0.18);
        }

        .btn.dirty {
            background: linear-gradient(135deg, #c56a12 0%, #e38b2c 100%);
            color: #ffffff;
            box-shadow: 0 10px 22px rgba(197, 106, 18, 0.32);
        }

        #save-btn {
            background: linear-gradient(135deg, #2d7fca 0%, #3f95dc 100%);
            color: #ffffff;
            border: 1px solid rgba(45, 127, 202, 0.16);
            box-shadow: 0 18px 30px rgba(45, 127, 202, 0.26);
        }

        .btn:disabled {
            opacity: 0.68;
            cursor: default;
        }

        #bottom-bar .btn:hover:not(:disabled),
        #bottom-bar .btn:active {
            transform: none;
        }

        #bottom-bar .btn:disabled {
            opacity: 1;
            cursor: default;
        }

        /* Sections */
        #current-section,
        #archive-section {
            max-width: 1100px;
            margin: 0 auto;
            width: 100%;
        }

        #current-section {
            padding-top: 8px;
        }

        #archive-section {
            padding-top: 8px;
        }

        #archive-section.hidden {
            display: none;
        }

        /* Month label (скрыт) */
        #month-label {
            display: none;
            margin: 8px 0 12px;
            font-size: 15px;
            color: var(--text-muted);
        }

        /* Cards (главный экран) */
        .heading-card {
            background: var(--bg-card);
            border-radius: 18px;
            border: 1px solid var(--border-card);
            padding: 0 0 14px;
            margin-bottom: 12px;
            box-shadow: var(--shadow-soft);
            transition: padding-bottom 0.34s cubic-bezier(0.22, 1, 0.36, 1);
            overflow: visible;
        }

        .heading-header {
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 0 0 12px;
            padding: 10px 14px;
            background: linear-gradient(135deg, #1f6fb2 0%, #2a8ad9 100%);
            border-radius: 16px 16px 0 0;
            position: relative;
            cursor: pointer;
            user-select: none;
            transform: translateZ(0);
            overflow: hidden;
        }

        .heading-title {
            font-weight: 600;
            text-align: center;
            width: 100%;
            color: #ffffff;
            font-size: 16px;
            letter-spacing: 0.01em;
        }

        .heading-toggle {
            position: absolute;
            right: 14px;
            top: 50%;
            width: 10px;
            height: 10px;
            border-right: 2px solid rgba(255, 255, 255, 0.92);
            border-bottom: 2px solid rgba(255, 255, 255, 0.92);
            transform: translateY(-65%) rotate(45deg);
            transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
        }

        .heading-card .heading-table {
            height: auto;
            opacity: 1;
            overflow: hidden;
            padding: 0 14px;
            transform-origin: top center;
            transform: translateY(0) scaleY(1);
            margin-top: 0;
            transition: height 0.58s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.34s ease, margin-top 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
            will-change: height, opacity, transform;
        }

        .heading-card.collapsed .heading-table {
            opacity: 0;
            margin-top: -4px;
            transform: translateY(-6px) scaleY(0.96);
        }

        .heading-card.collapsed .heading-toggle {
            transform: translateY(-35%) rotate(-135deg);
        }

        .heading-card.collapsed {
            padding-bottom: 0;
            background: transparent;
            border-color: transparent;
            border-radius: 0;
            box-shadow: none;
        }

        .heading-card.collapsed .heading-header {
            margin-bottom: 0;
            border-radius: 16px 16px 0 0;
        }

        /* === ТАБЛИЦА 3 СТОЛБЦА: ОБОРУДОВАНИЕ | ТЕКУЩИЕ | ПРОШЛЫЕ === */

        .heading-table {
            margin-top: 6px;
        }

        .heading-table-header,
        .heading-table-row {
            display: grid;
            grid-template-columns: 96px minmax(170px, 1.24fr) minmax(138px, 1fr);
            column-gap: 8px;
            align-items: center;
            margin-bottom: 8px;
        }

        .heading-table-header {
            font-size: 11px;
            color: var(--text-muted);
            margin-bottom: 6px;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .heading-table-header > div:nth-child(2),
        .heading-table-header > div:nth-child(3) {
            text-align: center;
        }

        .equipment-label {
            padding-right: 4px;
            font-size: 13px;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .field-prev {
            font-size: 14px;
            color: var(--text-muted);
            margin-left: 0;
            text-align: center;
            min-height: 44px;
            padding: 9px 12px;
            border-radius: 12px;
            background: #f8fafc;
            border: 1px solid #edf2f7;
            width: 100%;
            max-width: none;
            justify-self: stretch;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-wrap: wrap;
            gap: 4px;
            font-weight: 500;
            white-space: normal;
            word-break: break-word;
        }

        .field-prev-main {
            text-align: center;
        }

        .field-prev-diff {
            color: var(--text-green);
            font-weight: 600;
            white-space: nowrap;
        }

        .field-prev-empty {
            color: var(--text-muted);
            font-size: 13px;
            line-height: 1.2;
        }

        .field-input-wrap {
            position: relative;
            width: 100%;
            max-width: none;
            justify-self: stretch;
        }

        .field-input {
            width: 100%;
            max-width: 100%;
            min-height: 44px;
            padding: 9px 12px;
            border-radius: 12px;
            border: 1px solid var(--divider);
            background: #ffffff;
            font-size: 16px;
            font-weight: 600;
            text-align: center;
            user-select: none;
            -webkit-user-select: none;
            touch-action: manipulation;
            transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, color 0.16s ease;
        }

        .field-input:focus {
            outline: none;
            box-shadow: 0 0 0 3px var(--focus-ring);
        }

        /* Colors for validation */
        .field-input.green {
            color: var(--text-green);
        }

        .field-input.equal {
            color: var(--text-muted);
        }

        .field-input.error {
            color: var(--text-error);
        }

        .field-input.locked {
            background-color: #f3f4f6;
            color: #4b5563;
            padding-right: 34px;
        }

        .field-input.green:focus,
        .field-input.equal:focus {
            box-shadow: 0 0 0 3px var(--focus-ring-success);
        }

        .field-input.error:focus {
            box-shadow: 0 0 0 3px var(--focus-ring-error);
        }

        .field-input-wrap.locked .lock-badge {
            opacity: 1;
            transform: translateY(-50%) scale(1);
        }

        .lock-badge {
            position: absolute;
            top: 50%;
            right: 10px;
            transform: translateY(-50%) scale(0.9);
            width: 18px;
            height: 18px;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.16s ease, transform 0.16s ease;
            color: #64748b;
            overflow: hidden;
            text-indent: -999px;
            white-space: nowrap;
        }

        .lock-badge::before {
            content: "🔒";
            position: absolute;
            inset: 0;
            text-indent: 0;
            font-size: 15px;
            line-height: 18px;
        }

        /* Simple shake animation */
        @keyframes shake {
            0% { transform: translateX(0); }
            25% { transform: translateX(-3px); }
            50% { transform: translateX(3px); }
            75% { transform: translateX(-2px); }
            100% { transform: translateX(0); }
        }

        @keyframes connectionPulse {
            0% { transform: scale(1); opacity: 0.95; }
            50% { transform: scale(1.08); opacity: 1; }
            100% { transform: scale(1); opacity: 0.95; }
        }

        .shake {
            animation: shake 150ms ease-in-out 0s 2;
        }

        /* Toast */
        #toast {
            position: fixed;
            left: 50%;
            bottom: 90px;
            transform: translateX(-50%);
            background: rgba(255, 255, 255, 0.96);
            color: var(--text-main);
            padding: 10px 16px;
            border-radius: 24px;
            font-size: 15px;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s ease-out, transform 0.2s ease-out;
            z-index: 100;
            display: flex;
            align-items: center;
            box-shadow: var(--shadow-pill);
            max-width: calc(100vw - 28px);
        }

        #toast-icon {
            width: 20px;
            height: 20px;
            margin-right: 8px;
            flex-shrink: 0;
        }

        #toast-text {
            line-height: 1.3;
        }

        #toast.show {
            opacity: 1;
            transform: translateX(-50%) translateY(-4px);
        }

        /* Archive */
        #archive-title {
            display: none;
        }

        #archive-content {
            font-family: system-ui, -apple-system, BlinkMacSystemFont, "Roboto", sans-serif;
            font-size: 14px;
            color: #435161;
            background: transparent;
            border-radius: 0;
            border: none;
            padding: 0;
            margin: 0;
            overflow-x: hidden;
        }

        .archive-substation {
            background: var(--bg-card);
            border-radius: 18px;
            border: 1px solid var(--border-card);
            padding: 0 0 14px;
            margin-bottom: 12px;
            box-shadow: var(--shadow-soft);
        }

        .archive-substation-header {
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 0 0 12px;
            padding: 10px 14px;
            background: linear-gradient(135deg, #1f6fb2 0%, #2a8ad9 100%);
            border-radius: 16px 16px 0 0;
            position: relative;
            cursor: pointer;
            user-select: none;
            overflow: hidden;
        }

        .archive-substation-header-title {
            font-weight: 600;
            text-align: center;
            width: 100%;
            color: #ffffff;
            font-size: 16px;
            letter-spacing: 0.01em;
        }

        .archive-toggle {
            position: absolute;
            right: 14px;
            top: 50%;
            width: 10px;
            height: 10px;
            border-right: 2px solid rgba(255, 255, 255, 0.92);
            border-bottom: 2px solid rgba(255, 255, 255, 0.92);
            transform: translateY(-65%) rotate(45deg);
            transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
        }

        .archive-substation .archive-substation-body {
            height: auto;
            opacity: 1;
            overflow: hidden;
            padding: 0 10px;
            margin-top: 0;
            transition: height 0.58s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.34s ease, margin-top 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
            transform-origin: top center;
            transform: translateY(0) scaleY(1);
        }

        .archive-substation.collapsed {
            padding-bottom: 0;
            background: transparent;
            border-color: transparent;
            border-radius: 0;
            box-shadow: none;
        }

        .archive-substation.collapsed .archive-substation-header {
            margin-bottom: 0;
            border-radius: 16px 16px 0 0;
        }

        .archive-substation.collapsed .archive-substation-body {
            opacity: 0;
            margin-top: -4px;
            transform: translateY(-6px) scaleY(0.96);
        }

        .archive-substation.collapsed .archive-toggle {
            transform: translateY(-35%) rotate(-135deg);
        }

        .archive-table {
            width: 100%;
            border-collapse: collapse;
            table-layout: fixed;
        }

        .archive-table th,
        .archive-table td {
            padding: 6px 6px;
            font-size: 13px;
            text-align: left;
            border: none;
            white-space: normal;
            color: #4b5a6b;
            font-weight: 500;
            overflow-wrap: anywhere;
        }

        .archive-table th:first-child,
        .archive-table td:first-child {
            padding-left: 0;
            width: 58px;
        }

        .archive-table th:last-child,
        .archive-table td:last-child {
            padding-right: 0;
        }

        .archive-table th {
            color: #7a8796;
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.03em;
            text-transform: uppercase;
        }

        .archive-table th:not(:first-child),
        .archive-table td:not(:first-child) {
            text-align: center;
        }

        .archive-table tbody td:first-child {
            color: #7a8796;
            font-weight: 600;
        }

        .archive-table tbody td:not(:first-child) {
            color: #3f4c5c;
        }

        .archive-value-main {
            display: block;
        }

        .archive-value-diff {
            display: block;
            margin-top: 2px;
        }

        .diff-positive {
            color: #2b9d73;
            font-size: 11px;
            font-weight: 600;
        }

        .diff-negative {
            color: #c95a5a;
            font-size: 11px;
            font-weight: 600;
        }

        /* ====== LOGIN OVERLAY ====== */
        #login-overlay {
            position: fixed;
            inset: 0;
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        #login-backdrop {
            position: absolute;
            inset: 0;
            background: linear-gradient(180deg, #eef4fa 0%, #e6edf4 100%);
        }

        #login-dialog {
            position: relative;
            z-index: 1;
            width: 90%;
            max-width: 360px;
            background: #ffffff;
            border-radius: 20px;
            padding: 22px 18px 20px;
            border: 1px solid rgba(255, 255, 255, 0.9);
            box-shadow: var(--shadow-soft);
        }

        #login-title {
            margin: 0 0 4px;
            font-size: 18px;
            font-weight: 600;
            text-align: center;
        }

        #login-subtitle {
            margin: 0 0 12px;
            font-size: 13px;
            color: var(--text-muted);
            text-align: center;
        }

        #unlock-confirm-overlay {
            position: fixed;
            inset: 0;
            z-index: 900;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        #unlock-confirm-backdrop {
            position: absolute;
            inset: 0;
            background: rgba(0,0,0,0.35);
        }

        #unlock-confirm-dialog {
            position: relative;
            z-index: 1;
            width: 90%;
            max-width: 320px;
            background: #ffffff;
            border-radius: 16px;
            padding: 16px 16px 14px;
            box-shadow: 0 8px 20px rgba(0,0,0,0.35);
        }

        #unlock-confirm-text {
            margin: 0 0 12px;
            font-size: 14px;
            text-align: center;
        }

        #unlock-confirm-buttons {
            display: flex;
            gap: 8px;
            justify-content: center;
        }

        #unlock-confirm-buttons .btn {
            flex: 1 1 0;
        }

        .login-field {
            margin-bottom: 12px;
        }

        .login-label {
            display: block;
            font-size: 12px;
            font-weight: 600;
            color: var(--text-muted);
            margin-bottom: 4px;
        }

        .login-input {
            width: 100%;
            min-height: 44px;
            padding: 10px 12px;
            border-radius: 12px;
            border: 1px solid var(--divider);
            font-size: 14px;
        }

        .login-input:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px var(--focus-ring);
        }

        #login-error {
            min-height: 16px;
            font-size: 12px;
            color: var(--text-error);
            margin: 4px 0 8px;
            text-align: center;
        }

        #login-submit {
            width: 100%;
            justify-content: center;
        }

        .login-password-wrapper {
            position: relative;
            display: flex;
            align-items: center;
        }

        .login-password-wrapper .login-input {
            padding-right: 38px;
        }

        .password-toggle-btn {
            position: absolute;
            right: 6px;
            top: 50%;
            transform: translateY(-50%);
            border: none;
            background: transparent;
            width: 28px;
            height: 28px;
            border-radius: 999px;
            padding: 0;
            cursor: pointer;
            font-size: 16px;
            line-height: 1;
            color: var(--text-muted);
        }

        @media (max-width: 640px) {
            #top-pill {
                gap: 7px;
                padding: calc(8px + env(safe-area-inset-top)) 12px 6px;
                min-height: 44px;
            }

            #top-mode-switch {
                top: calc(env(safe-area-inset-top) + 46px);
                left: calc(10px + env(safe-area-inset-left));
                right: calc(10px + env(safe-area-inset-right));
            }

            #preview-badge {
                top: calc(env(safe-area-inset-top) + 88px);
                right: 12px;
                padding: 7px 10px;
            }

            #status-text {
                display: none;
            }

            #title-text {
                font-size: 14px;
            }

            #bottom-bar {
                left: calc(18px + env(safe-area-inset-left));
                right: calc(18px + env(safe-area-inset-right));
                bottom: calc(10px + env(safe-area-inset-bottom));
                padding: 0;
            }

            #bottom-bar .btn {
                padding: 0 12px;
                min-height: 35px;
            }

            .btn-text {
                font-size: 12px;
            }

            .heading-card,
            .archive-substation {
                border-radius: 16px;
            }

            #current-section,
            #archive-section {
                padding-top: 6px;
            }

            .heading-header,
            .archive-substation-header {
                border-radius: 16px 16px 0 0;
            }

            .heading-card .heading-table {
                padding-left: 12px;
                padding-right: 12px;
            }

            .archive-substation .archive-substation-body {
                padding-left: 9px;
                padding-right: 9px;
            }

            .heading-table-header,
            .heading-table-row {
                grid-template-columns: 76px minmax(112px, 1.08fr) minmax(98px, 0.94fr);
                column-gap: 5px;
            }

            .equipment-label,
            .field-prev,
            .field-input {
                font-size: 13px;
            }
        }

        @media (max-width: 400px) {
            .archive-table th,
            .archive-table td {
                font-size: 9px !important;
                white-space: nowrap;
            }

            #current-section,
            #archive-section {
                padding-top: 4px;
            }

            .diff-positive,
            .diff-negative {
                font-size: 8px !important;
            }

            #bottom-bar .btn {
                padding: 0 10px;
                min-height: 34px;
            }

            .btn-text {
                display: inline;
                font-size: 11px;
            }
        }

