:root {
    --primary: #0f766e;
    --primary-deep: #134e4a;
    --secondary: #2563eb;
    --accent: #f59e0b;
    --sidebar: #102a43;
    --sidebar-soft: #163a5f;
    --paper: rgba(255, 255, 255, 0.94);
    --paper-strong: #ffffff;
    --soft: rgba(240, 247, 247, 0.9);
    --line: rgba(0, 77, 64, 0.14);
    --text: #263238;
    --muted: #617176;
    --blue: #2f62b3;
    --green: #20885d;
    --amber: #a96908;
    --red: #b42318;
    --violet: #6750a4;
    --shadow: 0 14px 36px rgba(0, 77, 64, 0.12);
    --small-shadow: 0 8px 22px rgba(0, 77, 64, 0.08);
    --radius: 8px;
    --content-width: min(94vw, 1480px);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;
    color: var(--text);
    font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    letter-spacing: 0;
    background:
        linear-gradient(135deg, rgba(245, 250, 249, 0.94), rgba(224, 242, 241, 0.88)),
        url("assets/background.jpg") center 35% / cover fixed;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(0, 121, 107, 0.06) 1px, transparent 1px),
        linear-gradient(rgba(0, 121, 107, 0.05) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent 82%);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

.svg-sprite {
    display: none;
}

.hidden {
    display: none !important;
}

.client-agent-content {
    display: grid;
    gap: 14px;
}

.client-agent-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--small-shadow);
}

.client-agent-overview > div {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 10px;
    min-height: 82px;
    padding: 14px 18px;
    border-right: 1px solid var(--line);
}

.client-agent-overview > div:last-child {
    border-right: 0;
}

.client-agent-overview strong {
    grid-row: 1 / 3;
    color: var(--primary-deep);
    font-size: 25px;
    line-height: 1;
}

.client-agent-overview small {
    align-self: start;
    color: var(--muted);
    font-size: 12px;
}

.agent-live-dot {
    grid-row: 1 / 3;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22a06b;
    box-shadow: 0 0 0 5px rgba(34, 160, 107, 0.12);
}

.client-agent-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 52px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

.client-agent-toolbar .page-info {
    flex: 1;
}

.client-agent-select-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
}

.client-agent-select-all input,
.client-agent-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.client-agent-table {
    min-height: 230px;
    max-height: 48vh;
    overflow: auto;
    background: var(--paper-strong);
}

.client-agent-table table {
    min-width: 1080px;
}

.client-agent-table th,
.client-agent-table td {
    vertical-align: middle;
    white-space: nowrap;
}

.client-agent-table .agent-select-column {
    width: 44px;
    min-width: 44px;
    text-align: center;
}

.client-agent-online {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--green);
    font-weight: 700;
}

.client-agent-online i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22a06b;
    box-shadow: 0 0 0 4px rgba(34, 160, 107, 0.11);
}

.client-agent-lower-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.75fr) minmax(420px, 1.25fr);
    gap: 14px;
    min-width: 0;
}

.client-agent-message-panel,
.client-agent-command-panel {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--small-shadow);
}

.client-agent-message-panel {
    display: grid;
    gap: 12px;
    align-content: start;
}

.client-agent-message-panel textarea {
    width: 100%;
    min-height: 116px;
    padding: 11px 12px;
    resize: vertical;
    color: var(--text);
    font: inherit;
    line-height: 1.65;
}

.client-agent-message-panel .form-actions {
    margin: 0;
}

.client-agent-command-list {
    display: grid;
    gap: 8px;
    max-height: 300px;
    margin-top: 10px;
    padding-right: 4px;
    overflow-y: auto;
}

.client-agent-command-item {
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper-strong);
}

.client-agent-command-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.client-agent-command-head time,
.client-agent-command-meta,
.client-agent-command-empty {
    color: var(--muted);
    font-size: 12px;
}

.client-agent-command-meta {
    margin-top: 3px;
}

.client-agent-command-item p {
    margin: 8px 0 0;
    color: var(--text);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.client-agent-command-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.agent-result {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: var(--soft);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-result b {
    color: var(--text);
}

.agent-result.succeeded {
    color: var(--green);
    border-color: rgba(32, 136, 93, 0.22);
    background: rgba(32, 136, 93, 0.08);
}

.agent-result.failed,
.agent-result.offline {
    color: var(--red);
    border-color: rgba(180, 35, 24, 0.2);
    background: rgba(180, 35, 24, 0.07);
}

.agent-result.sent {
    color: var(--blue);
    border-color: rgba(47, 98, 179, 0.2);
    background: rgba(47, 98, 179, 0.07);
}

@media (max-width: 900px) {
    .client-agent-overview {
        grid-template-columns: 1fr;
    }

    .client-agent-overview > div {
        min-height: 66px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .client-agent-overview > div:last-child {
        border-bottom: 0;
    }

    .client-agent-toolbar {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .client-agent-toolbar .page-info {
        min-width: calc(100% - 90px);
    }

    .client-agent-toolbar .row-actions {
        width: 100%;
    }

    .client-agent-lower-grid {
        grid-template-columns: 1fr;
    }
}

.app-shell {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-self: start;
    height: 100vh;
    padding: 18px 16px;
    overflow-y: auto;
    color: #ffffff;
    background:
        linear-gradient(180deg, rgba(16, 42, 67, 0.98), rgba(19, 78, 74, 0.97)),
        url("assets/background.jpg") center / cover;
    box-shadow: 8px 0 24px rgba(16, 42, 67, 0.22);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    color: var(--primary-deep);
    background: linear-gradient(145deg, #ffffff, #80cbc4);
    font-size: 15px;
    font-weight: 900;
    box-shadow: inset 0 -1px 0 rgba(0, 77, 64, 0.14);
}

.brand-block h1 {
    margin: 0;
    font-size: 19px;
    line-height: 1.2;
}

.brand-block p {
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.76);
    font-size: 12px;
}

.nav-list {
    display: grid;
    gap: 8px;
    width: 100%;
}

.nav-item {
    display: grid;
    grid-template-columns: 20px auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: rgba(255, 255, 255, 0.9);
    background: transparent;
    text-align: left;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.nav-item svg,
.icon-text-btn svg,
.icon-btn svg,
.entry-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-item:hover,
.nav-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.side-section {
    display: grid;
    gap: 10px;
    width: 100%;
    min-height: 0;
    padding-top: 2px;
}

.side-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.side-search {
    min-height: 36px;
    color: #eaf5f3;
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
}

.side-search::placeholder {
    color: rgba(255, 255, 255, 0.56);
}

.side-search:focus {
    border-color: rgba(245, 158, 11, 0.8);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.portal-menu-list {
    display: grid;
    gap: 7px;
}

.portal-menu-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 7px 9px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    text-align: left;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.portal-menu-item:hover {
    border-color: rgba(245, 158, 11, 0.46);
    background: rgba(255, 255, 255, 0.14);
    transform: translateX(2px);
}

.portal-menu-item.is-locked {
    cursor: not-allowed;
    opacity: 0.72;
    border-style: dashed;
}

.portal-menu-item.is-locked:hover {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    transform: none;
}

.portal-menu-item.is-locked .portal-menu-icon {
    color: rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.08);
}

.portal-menu-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    color: #f9d68a;
    background: rgba(255, 255, 255, 0.1);
}

.portal-menu-icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.portal-menu-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.portal-menu-title,
.portal-menu-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-menu-title {
    font-size: 13px;
    font-weight: 800;
}

.portal-menu-meta {
    color: rgba(255, 255, 255, 0.58);
    font-size: 11px;
}

.portal-menu-message {
    padding: 10px;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: var(--radius);
    color: rgba(255, 255, 255, 0.68);
    font-size: 12px;
}

.main-area {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 20px clamp(18px, 3vw, 36px) 74px;
}

.main-area > *,
.protected-content {
    min-width: 0;
    max-width: 100%;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 16px;
    min-height: 72px;
    padding: 16px 18px;
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(12px);
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.topbar h2,
.section-head h3,
.banner h3 {
    margin: 0;
    font-size: 23px;
    line-height: 1.25;
}

.session-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.top-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.ghost-btn {
    width: 32px;
    min-height: 32px;
    color: rgba(255, 255, 255, 0.82);
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
}

.ghost-btn:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.14);
}

.session-label {
    min-width: 74px;
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

.icon-text-btn,
.icon-btn {
    display: inline-grid;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--paper-strong);
    box-shadow: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.icon-text-btn {
    grid-template-columns: 18px auto;
    gap: 8px;
    padding: 0 13px;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.icon-btn {
    width: 36px;
    padding: 0;
}

.icon-text-btn:hover,
.icon-btn:hover {
    border-color: rgba(0, 121, 107, 0.32);
    background: #f9fdfc;
    box-shadow: 0 6px 16px rgba(0, 77, 64, 0.08);
    transform: translateY(-1px);
}

.icon-text-btn.primary {
    color: #ffffff;
    background: linear-gradient(145deg, var(--secondary), var(--primary));
    border-color: transparent;
}

.icon-text-btn.primary:hover {
    background: linear-gradient(145deg, #00a693, #00695c);
}

.icon-text-btn.danger {
    color: #a33030;
    border-color: rgba(163, 48, 48, 0.2);
    background: #fff7f7;
}

.icon-text-btn.danger:hover {
    border-color: rgba(163, 48, 48, 0.36);
    background: #fff0f0;
}

.view {
    display: none;
    min-width: 0;
    max-width: 100%;
}

.active-view {
    display: block;
    min-width: 0;
    max-width: 100%;
}

.banner {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    min-height: 178px;
    padding: 26px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    color: #ffffff;
    background:
        linear-gradient(90deg, rgba(0, 77, 64, 0.94), rgba(0, 150, 136, 0.68)),
        url("assets/background.jpg") center 42% / cover;
    box-shadow: var(--shadow);
}

.banner p {
    margin: 0 0 8px;
    color: #d8f4f1;
    font-weight: 800;
}

.banner .icon-text-btn {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.32);
}

.home-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
    align-items: end;
    gap: 28px;
    min-height: 360px;
    padding: clamp(24px, 4vw, 46px);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius);
    color: #ffffff;
    background:
        linear-gradient(115deg, rgba(16, 42, 67, 0.94), rgba(15, 118, 110, 0.76) 58%, rgba(37, 99, 235, 0.58)),
        url("assets/background.jpg") center 42% / cover;
    box-shadow: var(--shadow);
}

.home-panel h3 {
    margin: 0;
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1.12;
}

.home-copy {
    max-width: 680px;
    margin: 16px 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 15px;
    line-height: 1.8;
}

.home-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.home-stat {
    min-height: 96px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
}

.home-stat span {
    display: block;
    color: #f9d68a;
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
}

.home-stat p {
    margin: 10px 0 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
}

.home-laptop-inline {
    display: grid;
    gap: 8px;
    width: min(760px, 100%);
    max-width: 100%;
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(8, 60, 62, 0.28));
    color: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
}

.home-laptop-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.home-laptop-main strong,
#homeLaptopStatus {
    font-size: 13px;
    font-weight: 900;
}

#homeLaptopStatus {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}

.home-laptop-inline small {
    color: rgba(255, 255, 255, 0.66);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.home-laptop-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.home-laptop-inline > .home-laptop-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}

.home-laptop-node {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    background: rgba(5, 25, 38, 0.22);
}

.home-laptop-node-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.home-laptop-node-head strong {
    color: rgba(255, 255, 255, 0.92);
    font-size: 13px;
    font-weight: 900;
}

.home-laptop-node-head em {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
}

.home-laptop-node.is-online .home-laptop-node-head em {
    color: #86efac;
    background: rgba(22, 163, 74, 0.16);
}

.home-laptop-node.is-offline .home-laptop-node-head em {
    color: #fca5a5;
    background: rgba(220, 38, 38, 0.16);
}

.home-laptop-speed {
    display: grid;
    gap: 7px;
    padding-top: 2px;
}

.home-laptop-speed-row,
.home-laptop-speed-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.home-laptop-speed-btn {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid rgba(134, 239, 172, 0.34);
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.2);
    color: rgba(255, 255, 255, 0.92);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.home-laptop-speed-btn:hover:not(:disabled) {
    background: rgba(20, 184, 166, 0.32);
}

.monitor-report-btn {
    border-color: rgba(250, 204, 21, 0.45);
    background: rgba(250, 204, 21, 0.16);
    color: #fff7d1;
}

.monitor-report-btn:hover:not(:disabled) {
    background: rgba(250, 204, 21, 0.28);
}

.home-laptop-speed-btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.home-laptop-speed-text {
    min-width: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.home-laptop-speed-track {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}

.home-laptop-speed-track i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #5eead4, #facc15);
    transition: width 0.18s ease;
}

.home-laptop-speed-meta {
    color: rgba(255, 255, 255, 0.68);
    font-size: 11px;
}

.home-laptop-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(5, 25, 38, 0.24);
    color: rgba(255, 255, 255, 0.82);
    font-size: 12px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.home-laptop-meta b {
    color: rgba(255, 255, 255, 0.58);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.home-laptop-inline.is-online #homeLaptopStatus {
    color: #86efac;
    background: rgba(22, 163, 74, 0.16);
}

.home-laptop-inline.is-offline #homeLaptopStatus {
    color: #fca5a5;
    background: rgba(220, 38, 38, 0.16);
}

.home-laptop-inline.is-checking #homeLaptopStatus {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.16);
}

.monitor-report-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(37, 99, 235, 0.08));
}

.monitor-report-header h3 {
    margin: 4px 0;
    color: var(--ink);
    font-size: 28px;
}

.monitor-report-header p {
    margin: 0;
    color: var(--muted);
}

.monitor-live-state {
    display: grid;
    justify-items: end;
    gap: 5px;
    color: var(--muted);
    font-size: 13px;
}

.monitor-live-state b {
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.12);
    color: #0f766e;
}

.monitor-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.monitor-metric-card {
    display: grid;
    gap: 9px;
    min-width: 0;
    padding: 15px;
    border: 1px solid rgba(15, 118, 110, 0.14);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.monitor-metric-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.monitor-metric-card strong {
    color: var(--ink);
    font-size: 26px;
    line-height: 1.1;
}

.monitor-metric-card p {
    min-height: 34px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.monitor-meter {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8f1ef;
}

.monitor-meter i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #0f766e;
}

.monitor-metric-card.is-warn .monitor-meter i {
    background: #f59e0b;
}

.monitor-metric-card.is-danger .monitor-meter i {
    background: #dc2626;
}

.monitor-report-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
    gap: 14px;
}

.monitor-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid rgba(15, 118, 110, 0.14);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-soft);
}

.wide-monitor-card {
    grid-column: span 1;
}

.monitor-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.monitor-card-head h4 {
    margin: 0;
    color: var(--ink);
    font-size: 16px;
}

.monitor-card-head span {
    color: var(--muted);
    font-size: 12px;
}

.monitor-trend {
    min-height: 260px;
}

.monitor-trend svg {
    display: block;
    width: 100%;
    min-height: 260px;
}

.monitor-axis {
    stroke: rgba(15, 23, 42, 0.18);
    stroke-width: 1;
}

.monitor-axis-text {
    fill: var(--muted);
    font-size: 12px;
}

.monitor-legend,
.monitor-trend-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
}

.monitor-legend {
    justify-content: flex-start;
    margin-bottom: 8px;
}

.monitor-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.monitor-legend i {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.monitor-detail-list {
    display: grid;
    gap: 8px;
}

.monitor-detail-row {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.monitor-detail-row b {
    color: var(--muted);
    font-size: 12px;
}

.monitor-detail-row span {
    color: var(--ink);
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

#machineMonitorHistory {
    max-height: 520px;
    overflow: auto;
}

#machineMonitorHistory table {
    min-width: 860px;
}

@media (max-width: 980px) {
    .monitor-report-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .monitor-live-state {
        justify-items: start;
    }

    .monitor-report-grid {
        grid-template-columns: 1fr;
    }
}

.home-service-panel {
    display: grid;
    gap: 14px;
    margin-top: 16px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
}

.home-service-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.home-service-head h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
}

#homePortalFilter {
    max-width: 320px;
}

.section-head,
.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
}

.toolbar-row {
    justify-content: flex-start;
}

.text-input {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid rgba(0, 77, 64, 0.18);
    border-radius: var(--radius);
    color: var(--text);
    background: #ffffff;
    outline: none;
}

.text-input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(0, 150, 136, 0.14);
}

#entryFilter,
#archiveKeyword {
    max-width: 460px;
}

.entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 14px;
}

.entry-grid.compact {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 14px;
}

.video-card {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.93);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
}

.video-player-wrap {
    position: relative;
    z-index: 2;
    isolation: isolate;
    overflow: hidden;
    background: #0f1f1d;
}

.video-player-wrap video {
    position: relative;
    z-index: 3;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    pointer-events: auto !important;
    touch-action: auto;
    background: #0f1f1d;
}

.video-card-body {
    position: relative;
    z-index: 1;
}

.video-link-preview {
    display: grid;
    place-items: center;
    min-height: 180px;
    color: #ffffff;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.92), rgba(37, 99, 235, 0.78)),
        url("assets/background.jpg") center / cover;
}

.video-link-preview svg {
    width: 46px;
    height: 46px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.video-card-body {
    display: grid;
    gap: 12px;
    padding: 14px;
}

.video-card-body h4 {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.video-card-body p:not(.eyebrow) {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.entry-card {
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 13px;
    width: 100%;
    min-height: 126px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--radius);
    color: var(--text);
    background: rgba(255, 255, 255, 0.93);
    text-align: left;
    text-decoration: none;
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.entry-card:hover {
    border-color: rgba(0, 150, 136, 0.38);
    box-shadow: 0 16px 34px rgba(0, 77, 64, 0.16);
    transform: translateY(-4px);
}

.entry-card.is-locked {
    cursor: not-allowed;
    opacity: 0.78;
    border-style: dashed;
}

.entry-card.is-locked:hover {
    border-color: rgba(0, 150, 136, 0.16);
    box-shadow: var(--small-shadow);
    transform: none;
}

.entry-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: var(--radius);
    color: var(--primary);
    background: linear-gradient(145deg, #e0f7f3, #ffffff);
    border: 1px solid rgba(0, 150, 136, 0.16);
}

.entry-card:nth-child(3n + 2) .entry-icon {
    color: var(--blue);
    background: linear-gradient(145deg, #e9f0ff, #ffffff);
}

.entry-card:nth-child(3n + 3) .entry-icon {
    color: var(--violet);
    background: linear-gradient(145deg, #f0edff, #ffffff);
}

.entry-content {
    min-width: 0;
}

.entry-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.entry-title-row h4 {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.entry-content p {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.tag {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-height: 23px;
    max-width: 120px;
    padding: 0 8px;
    border-radius: 999px;
    color: var(--primary);
    background: #e3f4f1;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag.locked-tag {
    color: #8a5a00;
    background: #fff1c7;
}

.data-list {
    display: grid;
    gap: 10px;
}

.log-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: flex-start;
    padding: 5px;
    margin-bottom: 14px;
    border: 1px solid rgba(0, 77, 64, 0.14);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--small-shadow);
}

.log-tab {
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: calc(var(--radius) - 2px);
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-weight: 800;
}

.log-tab.active {
    color: #ffffff;
    background: linear-gradient(145deg, var(--primary), var(--secondary));
    box-shadow: 0 8px 18px rgba(0, 121, 107, 0.18);
}

.log-pane {
    display: none;
}

.log-pane.active-log-pane {
    display: block;
}

.log-list {
    display: grid;
    gap: 9px;
}

.log-row {
    display: grid;
    gap: 7px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--small-shadow);
}

.log-row.log-warning {
    border-left-color: #d58b00;
}

.log-row.log-error {
    border-left-color: #b83232;
}

.log-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.log-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 77, 64, 0.07);
}

.log-message {
    color: var(--text);
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.console-log-message {
    font-family: Consolas, "Cascadia Mono", "Microsoft YaHei UI", monospace;
}

.log-refresh-status {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--muted);
    background: rgba(0, 77, 64, 0.07);
    font-size: 12px;
    font-weight: 700;
}

.log-refresh-status.paused {
    color: #8a5a00;
    background: #fff1c7;
}

.list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 62px;
    padding: 13px 15px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
}

.list-row h4 {
    margin: 0 0 4px;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.list-row p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.download-row h4 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-row h4 svg {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    color: var(--primary);
}

.download-folder-row {
    border-style: dashed;
}

.download-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.download-upload-panel {
    margin: 0 0 12px;
    padding: 14px;
    border: 1px solid rgba(0, 77, 64, 0.12);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--small-shadow);
}

.video-upload-panel {
    display: grid;
    gap: 12px;
}

.embedded-form {
    margin-bottom: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.download-upload-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
}

.download-upload-copy h4 {
    margin: 2px 0 0;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.file-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(0, 77, 64, 0.18);
    border-radius: var(--radius);
    color: var(--text);
    background: #fff;
    font-weight: 800;
    cursor: pointer;
}

.file-picker input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-status {
    min-height: 18px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.upload-progress {
    display: grid;
    gap: 7px;
    margin-top: 12px;
}

.upload-progress-head,
.upload-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

.upload-progress-head {
    color: var(--text);
    font-weight: 800;
}

.upload-progress-track {
    position: relative;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(0, 77, 64, 0.12);
}

.upload-progress-bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #1fa38f);
    box-shadow: 0 0 12px rgba(0, 121, 107, 0.28);
    transition: width 120ms linear;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.inline-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 24px;
    margin: 4px 0 12px;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 760px) {
    .download-upload-form {
        grid-template-columns: 1fr;
    }

    .file-picker,
    .download-upload-form .icon-text-btn {
        width: 100%;
    }

    .download-actions {
        justify-content: stretch;
    }

    .download-actions .icon-text-btn {
        flex: 1 1 120px;
    }

    .upload-progress-head,
    .upload-progress-meta {
        display: grid;
        gap: 4px;
    }
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    padding: 4px 11px;
    border: 1px solid rgba(0, 77, 64, 0.12);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--small-shadow);
}

.stat-chip .count {
    color: var(--primary);
    font-weight: 800;
}

.inline-link {
    margin-left: 8px;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-weight: 800;
}

.archive-row {
    display: block;
}

.archive-row summary {
    cursor: pointer;
}

.archive-row summary span {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.archive-row pre {
    overflow: auto;
    margin: 12px 0 0;
    padding: 12px;
    border-radius: var(--radius);
    background: #10231f;
    color: #d8ebe7;
    font-size: 12px;
}

.archive-card {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
}

.archive-card-header {
    display: grid;
    grid-template-columns: minmax(42px, auto) minmax(0, 1fr) auto 20px;
    gap: 12px;
    align-items: center;
    width: 100%;
    min-height: 56px;
    padding: 13px 15px;
    border: 0;
    color: var(--text);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.archive-card-header:hover {
    background: rgba(0, 150, 136, 0.07);
}

.card-no {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.card-filename {
    color: var(--primary-deep);
    font-size: 14px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.card-chevron {
    color: var(--muted);
    transition: transform 0.18s ease;
}

.archive-card.open .card-chevron {
    transform: rotate(180deg);
}

.archive-card-detail {
    display: none;
    padding: 0 15px 15px;
    border-top: 1px solid rgba(0, 77, 64, 0.1);
}

.archive-card.open .archive-card-detail {
    display: block;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px 18px;
    padding-top: 14px;
}

.detail-item {
    display: grid;
    gap: 3px;
}

.detail-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.detail-value {
    color: var(--text);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.detail-value.path,
.detail-value.mono,
.archive-json {
    font-family: "Cascadia Code", Consolas, monospace;
}

.process-steps,
.archive-json-box {
    grid-column: 1 / -1;
}

.process-steps {
    padding-top: 10px;
    border-top: 1px dashed rgba(0, 77, 64, 0.16);
}

.process-steps h4 {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 12px;
}

.step-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.step-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid rgba(0, 77, 64, 0.12);
    border-radius: var(--radius);
    background: #f3fbfa;
    font-size: 12px;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #90a4ae;
}

.dot.done {
    background: var(--green);
}

.dot.started {
    background: var(--amber);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.badge-done {
    color: #116c37;
    background: #dcfce7;
}

.badge-started {
    color: #075985;
    background: #dff3ff;
}

.badge-pending {
    color: #8a5a00;
    background: #fff2cc;
}

.badge-locked {
    color: #6d28d9;
    background: #eee8ff;
}

.archive-json {
    overflow: auto;
    max-height: 360px;
    margin: 8px 0 0;
    padding: 12px;
    border-radius: var(--radius);
    color: #d8ebe7;
    background: #10231f;
    font-size: 12px;
}

.archive-more {
    justify-self: center;
    margin-top: 4px;
}

.settings-panel {
    order: 10;
    margin-top: 0;
}

.settings-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: flex-start;
    padding: 5px;
    border: 1px solid rgba(0, 77, 64, 0.14);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--small-shadow);
}

.settings-tab {
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: calc(var(--radius) - 2px);
    color: var(--muted);
    background: transparent;
    font-weight: 800;
    cursor: pointer;
}

.settings-tab.active {
    color: #ffffff;
    background: linear-gradient(145deg, var(--primary), var(--secondary));
    box-shadow: 0 8px 18px rgba(0, 121, 107, 0.18);
}

.settings-pane {
    display: none;
}

.settings-pane.active-settings-pane {
    display: block;
}

.settings-pane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
}

.settings-pane-head h3 {
    margin: 2px 0 0;
    font-size: 18px;
}

.compact-head {
    margin-bottom: 10px;
}

.compact-form {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.security-auth-panel {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
}

.security-auth-toggle {
    justify-content: flex-start;
    width: fit-content;
    min-height: 42px;
    padding: 0 12px;
    background: #ffffff;
}

.security-auth-copy,
.security-auth-status {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.security-auth-status {
    padding: 10px 12px;
    border: 1px solid rgba(0, 77, 64, 0.12);
    border-radius: var(--radius);
    background: rgba(240, 247, 247, 0.86);
}

.payment-test-grid {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(280px, 1fr);
    gap: 18px;
    align-items: start;
}

.payment-test-card,
.payment-qr-panel {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--small-shadow);
}

.payment-qr-panel h3,
.payment-test-card h3 {
    margin: 0;
}

.payment-qr-box {
    display: grid;
    place-items: center;
    min-height: 260px;
    padding: 18px;
    border: 1px dashed rgba(15, 118, 110, 0.28);
    border-radius: var(--radius);
    background: rgba(240, 247, 247, 0.72);
}

.payment-qr-box img {
    width: min(240px, 72vw);
    height: min(240px, 72vw);
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    box-shadow: var(--small-shadow);
}

.qr-text {
    max-width: 100%;
    word-break: break-all;
    padding: 12px;
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
}

.payment-order-info {
    display: grid;
    gap: 8px;
}

.payment-order-info div {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-radius: var(--radius);
    background: rgba(15, 118, 110, 0.06);
}

.payment-order-info b {
    color: var(--muted);
    font-size: 13px;
}

.payment-order-info span {
    min-width: 0;
    word-break: break-all;
}

.payment-status {
    min-height: 22px;
    margin: 0;
    color: var(--muted);
}

.site-footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 292px;
    z-index: 14;
    margin: 0;
    padding: 8px 12px 10px;
    border-top: 1px solid rgba(0, 77, 64, 0.12);
    color: rgba(38, 50, 56, 0.68);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 -8px 22px rgba(0, 77, 64, 0.08);
    backdrop-filter: blur(12px);
    font-size: 12px;
    line-height: 1.8;
    text-align: center;
}

.site-footer a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

#settings .protected-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#settings #entryForm {
    order: 30;
}

#settings #entryTable {
    order: 40;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 12px;
    padding: 16px;
    margin-bottom: 14px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
}

.form-grid label,
.module-box {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
}

.wide-label,
.module-box {
    grid-column: 1 / -1;
}

.check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.check-line {
    display: flex !important;
    grid-template-columns: 18px 1fr;
    align-items: center;
    gap: 8px !important;
    min-height: 38px;
}

.check-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(0, 77, 64, 0.16);
    border-radius: var(--radius);
    color: var(--text);
    background: #f3fbfa;
    font-size: 13px;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
}

.statistics-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    margin-bottom: 14px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
}

.statistics-tab {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(0, 77, 64, 0.16);
    border-radius: var(--radius);
    color: var(--text);
    background: #ffffff;
    font-weight: 800;
}

.statistics-tab.active {
    color: #ffffff;
    border-color: var(--primary);
    background: var(--primary);
}

.statistics-pane {
    display: none;
    min-width: 0;
    max-width: 100%;
}

.statistics-pane.active-statistics-pane {
    display: grid;
    gap: 14px;
    min-width: 0;
    max-width: 100%;
}

.statistics-filter-panel,
.statistics-card,
.stat-card {
    min-width: 0;
    max-width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--small-shadow);
    backdrop-filter: blur(10px);
}

.statistics-filter-panel {
    padding: 14px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    align-items: end;
    min-width: 0;
}

.filter-grid label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.statistics-check {
    align-self: end;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid rgba(0, 77, 64, 0.12);
    border-radius: var(--radius);
    background: #ffffff;
}

.statistics-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    min-width: 0;
}

.stat-card {
    min-height: 118px;
    padding: 16px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    color: var(--primary-deep);
    font-size: 28px;
    line-height: 1.1;
}

.stat-card p {
    display: -webkit-box;
    margin: 8px 0 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.statistics-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    min-width: 0;
    max-width: 100%;
}

.statistics-chart-grid > *,
.statistics-summary-grid > *,
.filter-grid > * {
    min-width: 0;
}

.statistics-card {
    padding: 14px;
}

.statistics-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.statistics-card-head h4 {
    margin: 0;
    color: var(--text);
    font-size: 16px;
}

.chart-box {
    min-height: 260px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.chart-box-large {
    min-height: 500px;
}

.bar-chart {
    display: grid;
    gap: 10px;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.9fr) minmax(140px, 2fr) 82px;
    gap: 8px;
    align-items: center;
}

.interactive-bar {
    padding: 4px 6px;
    margin: -4px -6px;
    border-radius: var(--radius);
}

.interactive-bar:hover {
    background: rgba(0, 121, 107, 0.06);
}

.bar-label {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(0, 77, 64, 0.08);
}

.bar-track span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: inherit;
}

.bar-value {
    color: var(--primary-deep);
    font-size: 12px;
    font-weight: 900;
    text-align: right;
}

.bar-meta {
    grid-column: 1 / -1;
    margin-top: -4px;
    color: var(--muted);
    font-size: 11px;
}

.series-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.series-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid rgba(0, 77, 64, 0.12);
    border-radius: 999px;
    color: var(--text);
    background: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.series-toggle span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--series-color);
}

.series-toggle.muted-series {
    opacity: 0.46;
}

.line-chart-scroll {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid rgba(0, 77, 64, 0.08);
    border-radius: var(--radius);
    background: #ffffff;
}

.line-chart-svg {
    display: block;
    width: auto;
    max-width: none;
    height: auto;
}

.line-hit-point {
    fill: transparent;
    stroke: transparent;
    pointer-events: all;
    cursor: crosshair;
}

.chart-bg {
    fill: #ffffff;
}

.chart-grid-line {
    stroke: rgba(0, 77, 64, 0.12);
    stroke-width: 1;
}

.chart-axis {
    stroke: rgba(0, 77, 64, 0.32);
    stroke-width: 1.2;
}

.line-chart-svg text {
    fill: var(--muted);
    font-size: 11px;
}

.page-info {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.tool-usage-admin-table {
    min-width: 1120px;
}

.tool-usage-user,
.tool-usage-file {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.tool-usage-user strong,
.tool-usage-file strong {
    color: var(--text);
    font-weight: 900;
}

.tool-usage-user span,
.tool-usage-file span {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tool-usage-file {
    max-width: 420px;
}

.tool-usage-file .file-path {
    display: block;
    max-width: 420px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
    line-height: 1.45;
}

.tool-usage-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.tool-usage-status.charged {
    color: #047857;
    border: 1px solid rgba(52, 211, 153, 0.72);
    background: rgba(209, 250, 229, 0.9);
}

.tool-usage-status.duplicate {
    color: #0369a1;
    border: 1px solid rgba(125, 211, 252, 0.7);
    background: rgba(224, 242, 254, 0.92);
}

.tool-usage-status.rejected {
    color: #b45309;
    border: 1px solid rgba(251, 191, 36, 0.72);
    background: rgba(254, 243, 199, 0.92);
}

.tool-usage-export-card {
    padding: 16px;
}

.tool-usage-export-controls {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-top: 14px;
}

.tool-usage-export-controls > label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.tool-usage-export-actions {
    justify-content: flex-end;
}

.tool-usage-export-users {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    max-height: 280px;
    margin-top: 12px;
    padding: 10px;
    overflow: auto;
    border: 1px solid rgba(15, 118, 110, 0.14);
    border-radius: var(--radius);
    background: rgba(248, 250, 252, 0.84);
}

.tool-usage-export-user {
    display: flex;
    gap: 10px;
    align-items: center;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
}

.tool-usage-export-user:has(input:checked) {
    border-color: rgba(13, 148, 136, 0.52);
    background: rgba(204, 251, 241, 0.48);
    box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.12);
}

.tool-usage-export-user input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.tool-usage-export-user span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.tool-usage-export-user strong,
.tool-usage-export-user small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tool-usage-export-user strong {
    color: var(--text);
}

.tool-usage-export-user small {
    color: var(--muted);
}

@media (max-width: 760px) {
    .tool-usage-export-controls {
        grid-template-columns: 1fr;
    }

    .tool-usage-export-actions {
        justify-content: flex-start;
    }
}

.part-name-cell {
    min-width: 320px;
    max-width: 680px;
    word-break: break-all;
}

.repeat-count,
.repeat-count-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.12);
    color: var(--primary-deep);
    font-weight: 900;
}

.repeat-count-btn {
    border: 0;
    text-decoration: none;
}

.duplicate-title {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(0, 77, 64, 0.12);
    border-radius: var(--radius);
    background: rgba(240, 247, 247, 0.9);
    color: var(--text);
    font-size: 13px;
    word-break: break-all;
}

.wide-modal-panel {
    width: min(980px, calc(100vw - 28px));
}

#partDuplicateDialog {
    width: min(1120px, calc(100vw - 28px));
}

#partDuplicateDialog .modal-panel {
    max-height: min(820px, calc(100vh - 32px));
    overflow: hidden;
}

#partDuplicateList {
    max-height: min(620px, calc(100vh - 230px));
    overflow: auto;
}

.statistics-tooltip {
    position: fixed;
    z-index: 90;
    width: min(420px, calc(100vw - 28px));
    max-height: min(520px, calc(100vh - 28px));
    padding: 12px;
    overflow: hidden;
    border: 1px solid rgba(0, 77, 64, 0.18);
    border-radius: var(--radius);
    color: var(--text);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 42px rgba(0, 77, 64, 0.22);
    pointer-events: auto;
}

.statistics-tooltip-title {
    margin-bottom: 5px;
    color: var(--primary-deep);
    font-size: 14px;
    font-weight: 900;
    word-break: break-word;
}

.statistics-tooltip-total,
.statistics-tooltip-subtitle {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.statistics-tooltip-subtitle {
    margin-top: 10px;
    margin-bottom: 7px;
    color: var(--text);
}

.statistics-tooltip-list {
    display: grid;
    gap: 6px;
    max-height: 360px;
    overflow: auto;
    padding-right: 3px;
    overscroll-behavior: contain;
}

.statistics-tooltip-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    align-items: start;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(240, 247, 247, 0.82);
}

.statistics-tooltip-row span {
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.statistics-tooltip-row strong {
    color: var(--primary-deep);
    font-size: 12px;
}

.statistics-tooltip-row small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    word-break: break-word;
}

.statistics-tooltip-empty {
    padding: 8px;
    border-radius: 6px;
    color: var(--muted);
    background: rgba(240, 247, 247, 0.82);
    font-size: 12px;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid rgba(0, 77, 64, 0.12);
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

th {
    color: #ffffff;
    background: var(--primary);
    font-weight: 800;
}

.sortable-th {
    padding: 0;
}

.table-sort-btn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 43px;
    padding: 11px 12px;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    font-weight: 900;
    text-align: left;
    cursor: pointer;
}

.table-sort-btn:hover,
.table-sort-btn.active {
    background: rgba(255, 255, 255, 0.14);
}

tr:last-child td {
    border-bottom: none;
}

.row-highlight td {
    animation: rowFlash 2.2s ease-out;
}

@keyframes rowFlash {
    0% {
        background: rgba(255, 193, 7, 0.34);
    }
    100% {
        background: transparent;
    }
}

.row-actions {
    display: flex;
    gap: 6px;
}

.license-user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 146px;
}

.license-avatar {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    box-sizing: border-box;
    border-radius: 12px;
    color: #ffffff;
    background: linear-gradient(145deg, var(--primary), #2f7d75);
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
}

.license-avatar.avatar-two {
    gap: 1px;
    font-size: 15px;
}

.license-avatar.avatar-three {
    flex-direction: column;
    gap: 3px;
    height: auto;
    min-height: 68px;
    padding: 9px 0;
    font-size: 14px;
    white-space: normal;
}

.license-avatar.avatar-long {
    gap: 2px;
    padding: 8px 0;
    font-size: 12px;
}

.license-avatar span {
    display: block;
}

.license-user-name {
    min-width: 0;
    font-weight: 800;
    color: var(--text);
    overflow-wrap: anywhere;
}

.masked-license-code {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 8px;
    border: 1px solid rgba(0, 77, 64, 0.18);
    border-radius: 999px;
    color: var(--primary);
    background: #eef8f6;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.masked-license-code:hover {
    border-color: rgba(0, 77, 64, 0.34);
    background: #dff1ee;
}

.license-module-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    min-width: 130px;
}

.license-module-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 9px;
    border-radius: 999px;
    color: #31524d;
    background: #edf7f5;
    font-size: 12px;
    font-weight: 800;
}

.license-type-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    max-width: 150px;
    padding: 2px 10px;
    border: 1px solid var(--type-border);
    border-radius: 999px;
    color: var(--type-color);
    background: var(--type-bg);
    font-size: 12px;
    font-weight: 900;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.status-ok {
    color: var(--green);
    font-weight: 800;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    margin-left: 8px;
    padding: 0 8px;
    border-radius: 999px;
    color: var(--primary);
    background: #e3f4f1;
    font-size: 12px;
    font-weight: 800;
}

.status-warn {
    color: var(--amber);
    font-weight: 800;
}

.status-off {
    color: var(--muted);
}

.license-expire {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    white-space: nowrap;
}

.license-expire-warn,
.license-expire-danger {
    padding: 2px 9px;
    border-radius: 999px;
    font-weight: 800;
}

.license-expire-warn {
    border: 1px solid rgba(217, 119, 6, 0.26);
    color: #9a4d00;
    background: #fff3d8;
}

.license-expire-danger {
    border: 1px solid rgba(220, 38, 38, 0.26);
    color: #b91c1c;
    background: #fee2e2;
}

.protected-placeholder {
    display: none;
    padding: 16px;
    border: 1px dashed rgba(0, 121, 107, 0.32);
    border-radius: var(--radius);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--small-shadow);
}

.requires-login .protected-content {
    display: none;
}

#settings.requires-login .protected-content {
    display: none;
}

.requires-login .protected-placeholder {
    display: block;
}

.modal {
    width: min(420px, calc(100vw - 28px));
    border: 0;
    padding: 0;
    border-radius: var(--radius);
    box-shadow: 0 18px 48px rgba(0, 77, 64, 0.25);
}

.license-modal {
    width: min(880px, calc(100vw - 28px));
}

.modal::backdrop {
    background: rgba(0, 49, 43, 0.42);
    backdrop-filter: blur(4px);
}

.modal-panel {
    display: grid;
    gap: 12px;
    padding: 18px;
    background: var(--paper-strong);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-head h3 {
    margin: 0;
}

.modal-form-grid {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    backdrop-filter: none;
}

#licenseDialog .module-box {
    gap: 10px;
}

#licenseDialog .check-grid {
    gap: 12px;
    align-items: stretch;
}

#licenseDialog .check-pill {
    justify-content: center;
    min-width: 126px;
    min-height: 58px;
    padding: 9px 14px;
    border-color: rgba(0, 121, 107, 0.18);
    border-radius: 10px;
    background: #f2fbfa;
}

#licenseDialog .check-pill input {
    width: 16px;
    height: 16px;
}

.license-modal .modal-panel {
    max-height: min(760px, calc(100vh - 36px));
    overflow: auto;
}

.modal-actions {
    justify-content: flex-end;
    margin: 0;
}

.code-dialog-text {
    padding: 12px;
    border: 1px solid rgba(0, 77, 64, 0.16);
    border-radius: var(--radius);
    color: var(--text);
    background: #f4fbfa;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.muted-text {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.error-text {
    min-height: 20px;
    margin: 0;
    color: var(--red);
    font-size: 13px;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 40;
    max-width: min(420px, calc(100vw - 36px));
    padding: 11px 14px;
    border-radius: var(--radius);
    color: #ffffff;
    background: linear-gradient(145deg, var(--primary), var(--primary-deep));
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.18s, transform 0.18s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.mobile-sidebar-toggle,
.mobile-sidebar-backdrop,
.mobile-sidebar-close {
    display: none;
}

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
        align-items: flex-start;
        flex-direction: column;
    }

    .brand-block {
        min-width: 0;
    }

    .nav-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        justify-content: flex-start;
        width: 100%;
    }

    .portal-menu-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .session-actions {
        grid-column: 1 / -1;
    }

    .home-panel {
        grid-template-columns: 1fr;
    }

    .payment-test-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 1080px) {
    body {
        background-attachment: scroll;
    }

    .sidebar {
        gap: 12px;
        padding: 12px 14px 10px;
        box-shadow: 0 8px 22px rgba(16, 42, 67, 0.18);
    }

    .brand-block {
        padding-bottom: 10px;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
    }

    .main-area {
        width: 100%;
        margin-top: 0;
        padding: 12px 12px 74px;
    }

    .topbar,
    .section-head,
    .toolbar-row,
    .banner {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        grid-template-columns: 1fr;
        gap: 12px;
        min-height: 0;
        padding: 14px;
    }

    .top-tools {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .top-tools .icon-text-btn {
        width: 100%;
    }

    .session-actions {
        justify-content: flex-start;
    }

    .topbar h2,
    .section-head h3,
    .banner h3 {
        font-size: 20px;
    }

    .nav-list {
        display: flex;
        gap: 7px;
        overflow-x: auto;
        padding-bottom: 3px;
        scrollbar-width: none;
    }

    .nav-list::-webkit-scrollbar,
    .portal-menu-list::-webkit-scrollbar {
        display: none;
    }

    .side-section {
        gap: 8px;
    }

    .side-search {
        min-height: 34px;
    }

    .portal-menu-list {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 3px;
    }

    .nav-item {
        flex: 0 0 auto;
        justify-content: center;
        width: auto;
        min-width: 112px;
        min-height: 38px;
        padding: 0 10px;
    }

    .portal-menu-item {
        flex: 0 0 168px;
        min-height: 46px;
        grid-template-columns: 32px minmax(0, 1fr);
        gap: 8px;
        padding: 7px 8px;
    }

    .portal-menu-icon {
        width: 32px;
        height: 32px;
    }

    .home-panel {
        min-height: 0;
        padding: 20px;
        gap: 18px;
    }

    .home-panel h3 {
        font-size: 30px;
    }

    .home-copy {
        margin-top: 12px;
        font-size: 14px;
        line-height: 1.65;
    }

    .home-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
    }

    .home-stat {
        min-height: 70px;
        padding: 10px 8px;
    }

    .home-stat span {
        font-size: 19px;
        overflow-wrap: anywhere;
    }

    .home-stat p {
        margin-top: 7px;
        font-size: 11px;
    }

    .nav-item,
    .portal-menu-item,
    .icon-text-btn {
        min-width: 0;
    }

    .entry-grid,
    .entry-grid.compact,
    .video-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .list-row {
        grid-template-columns: 1fr;
    }

    .session-actions {
        justify-content: flex-start;
    }

    .tag {
        max-width: 90px;
    }
}

@media (max-width: 1080px) {
    body {
        padding-bottom: calc(78px + env(safe-area-inset-bottom));
    }

    .app-shell {
        display: block;
        min-height: 100vh;
    }

    .sidebar {
        position: relative;
        z-index: 25;
        display: block;
        height: auto;
        min-height: 0;
        padding: 10px 12px;
        overflow: visible;
        box-shadow: 0 8px 22px rgba(16, 42, 67, 0.16);
    }

    .brand-block {
        gap: 10px;
        padding: 0;
        border-bottom: 0;
    }

    .brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        font-size: 13px;
    }

    .brand-block h1 {
        font-size: 16px;
    }

    .brand-block p {
        max-width: calc(100vw - 92px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11px;
    }

    .side-section {
        display: none;
    }

    .nav-list {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        z-index: 60;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
        width: auto;
        padding: 6px;
        overflow: visible;
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 14px;
        background: rgba(16, 42, 67, 0.96);
        box-shadow: 0 12px 28px rgba(16, 42, 67, 0.28);
        backdrop-filter: blur(14px);
    }

    .nav-item {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-width: 0;
        width: 100%;
        min-height: 54px;
        padding: 5px 2px;
        border-radius: 10px;
        text-align: center;
        font-size: 10px;
        line-height: 1.1;
    }

    .nav-item svg {
        width: 20px;
        height: 20px;
    }

    .nav-item span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nav-item:hover,
    .nav-item.active {
        transform: none;
        background: rgba(15, 118, 110, 0.92);
        border-color: rgba(255, 255, 255, 0.22);
    }

    .main-area {
        padding: 10px 10px calc(94px + env(safe-area-inset-bottom));
    }

    .topbar {
        position: static;
        gap: 10px;
        padding: 12px;
        margin-bottom: 12px;
    }

    .topbar .eyebrow {
        display: none;
    }

    .topbar h2,
    .section-head h3,
    .home-service-head h3 {
        font-size: 18px;
    }

    .top-tools,
    .session-actions,
    .row-actions,
    .modal-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    .session-label {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        text-align: left;
    }

    .icon-text-btn {
        min-height: 42px;
        padding: 0 10px;
        white-space: normal;
    }

    .section-head,
    .toolbar-row {
        gap: 10px;
        padding: 12px;
        margin-bottom: 12px;
    }

    .home-panel {
        min-height: 0;
        padding: 18px;
        gap: 16px;
    }

    .home-panel h3 {
        font-size: 26px;
    }

    .home-copy {
        margin-top: 10px;
        font-size: 13px;
        line-height: 1.65;
    }

    .home-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .home-stat {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: 10px;
        min-height: 52px;
        padding: 10px 12px;
    }

    .home-stat span {
        font-size: 20px;
    }

    .home-stat p {
        margin: 0;
    }

    .home-service-panel {
        margin-top: 12px;
        padding: 12px;
    }

    .home-service-head {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #homePortalFilter,
    #entryFilter,
    #archiveKeyword {
        max-width: none;
    }

    .entry-grid.compact,
    .entry-grid,
    .video-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .entry-card {
        min-height: 72px;
        padding: 12px;
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .entry-icon {
        width: 40px;
        height: 40px;
    }

    .entry-title-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .list-row,
    .log-row,
    .download-upload-panel {
        padding: 12px;
    }

    .table-wrap {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 640px;
    }

    th,
    td {
        padding: 9px 8px;
        font-size: 12px;
    }

    .modal {
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
    }

    .modal-panel {
        gap: 10px;
        padding: 14px;
    }

    .license-modal .modal-panel {
        max-height: calc(100dvh - 16px);
    }

    #licenseDialog .check-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    #licenseDialog .check-pill {
        justify-content: flex-start;
        width: 100%;
        min-width: 0;
        min-height: 46px;
    }
}

@media (max-width: 1080px) {
    body {
        padding-bottom: 0;
        overflow-x: hidden;
    }

    .app-shell {
        display: block;
        min-height: 100vh;
    }

    .mobile-sidebar-toggle {
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 80;
        display: inline-grid;
        grid-template-columns: 18px auto;
        align-items: center;
        gap: 6px;
        min-height: 38px;
        padding: 0 12px;
        border: 1px solid rgba(0, 77, 64, 0.16);
        border-radius: var(--radius);
        color: var(--text);
        background: rgba(255, 255, 255, 0.94);
        box-shadow: 0 10px 24px rgba(16, 42, 67, 0.16);
        backdrop-filter: blur(10px);
    }

    .mobile-sidebar-toggle svg,
    .mobile-sidebar-close svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    body.sidebar-open .mobile-sidebar-toggle {
        opacity: 0;
        pointer-events: none;
    }

    .mobile-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 70;
        display: block;
        border: 0;
        padding: 0;
        background: rgba(0, 34, 31, 0.42);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.18s ease;
    }

    body.sidebar-open .mobile-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 75;
        display: flex;
        flex-direction: column;
        gap: 18px;
        width: min(86vw, 320px);
        height: 100dvh;
        padding: 16px;
        overflow-y: auto;
        transform: translateX(calc(-100% - 16px));
        transition: transform 0.22s ease;
        box-shadow: 12px 0 32px rgba(16, 42, 67, 0.3);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .brand-block {
        gap: 10px;
        padding-bottom: 14px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    }

    .brand-mark {
        width: 40px;
        height: 40px;
        border-radius: 8px;
    }

    .brand-block h1 {
        font-size: 17px;
    }

    .brand-block p {
        max-width: 190px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11px;
    }

    .mobile-sidebar-close {
        display: inline-grid;
        flex: 0 0 auto;
        margin-left: auto;
        color: rgba(255, 255, 255, 0.9);
        border-color: rgba(255, 255, 255, 0.16);
        background: rgba(255, 255, 255, 0.08);
    }

    .nav-list {
        position: static;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        width: 100%;
        padding: 0;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
    }

    .nav-item {
        display: grid;
        grid-template-columns: 20px minmax(0, 1fr);
        flex: none;
        align-items: center;
        justify-content: start;
        gap: 8px;
        width: 100%;
        min-width: 0;
        min-height: 42px;
        padding: 0 12px;
        border-radius: var(--radius);
        text-align: left;
        font-size: 14px;
        line-height: 1.2;
    }

    .nav-item svg {
        width: 18px;
        height: 18px;
    }

    .nav-item span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nav-item:hover,
    .nav-item.active {
        transform: none;
        background: rgba(255, 255, 255, 0.14);
        border-color: rgba(255, 255, 255, 0.22);
    }

    .side-section {
        display: grid;
        gap: 10px;
        width: 100%;
        min-height: 0;
        padding-top: 2px;
    }

    .side-search {
        min-height: 36px;
    }

    .portal-menu-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 7px;
        overflow: visible;
        padding: 0;
    }

    .portal-menu-item {
        flex: none;
        width: 100%;
        min-height: 48px;
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 10px;
        padding: 7px 9px;
    }

    .portal-menu-icon {
        width: 34px;
        height: 34px;
    }

    .main-area {
        width: 100%;
        margin: 0;
        padding: 58px 10px 74px;
    }

    .site-footer {
        left: 0;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    }

    .topbar {
        position: static;
        grid-template-columns: 1fr;
        gap: 10px;
        min-height: 0;
        padding: 12px;
        margin-bottom: 12px;
    }

    .topbar .eyebrow {
        display: none;
    }

    .topbar h2,
    .section-head h3,
    .banner h3 {
        font-size: 18px;
    }

    .top-tools,
    .session-actions,
    .row-actions,
    .modal-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    .session-label {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        text-align: left;
    }

    .icon-text-btn {
        min-height: 42px;
        padding: 0 10px;
        white-space: normal;
    }

    .statistics-tabs,
    .statistics-filter-panel,
    .statistics-card {
        padding: 10px;
    }

    .filter-grid,
    .statistics-chart-grid,
    .statistics-summary-grid {
        grid-template-columns: 1fr;
    }

    .statistics-card-head {
        display: grid;
        align-items: start;
    }

    .series-legend {
        justify-content: flex-start;
    }

    .bar-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .bar-value {
        text-align: left;
    }

    .part-name-cell {
        min-width: 240px;
        max-width: 520px;
    }

    .chart-box {
        min-height: 220px;
    }

    .chart-box-large {
        min-height: 430px;
    }

    .payment-test-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .payment-test-card,
    .payment-qr-panel {
        padding: 14px;
    }

    .payment-order-info {
        grid-template-columns: 1fr;
    }

    .payment-qr-box {
        min-height: 160px;
        padding: 12px;
    }

    .qr-text {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

.dual-upload-progress { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.upload-channel-card { padding: 14px; border: 1px solid rgba(47,91,85,.16); border-radius: 12px; background: rgba(255,255,255,.64); }
.upload-channel-card.high-speed { border-color: rgba(230,139,45,.28); background: linear-gradient(135deg, rgba(255,249,238,.94), rgba(255,255,255,.72)); }
.upload-channel-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.upload-channel-title strong { color: #163d39; }
.upload-channel-title span { font-size: 12px; color: #6f817e; }
@media (max-width: 720px) { .dual-upload-progress { grid-template-columns: 1fr; } }

.node-network-traffic { display: grid; gap: 8px; padding: 11px 12px; border: 1px solid rgba(94,234,212,.24); border-radius: 12px; background: linear-gradient(135deg, rgba(10,45,58,.62), rgba(14,90,88,.24)); }
.node-network-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.node-network-title span { color: rgba(255,255,255,.92); font-size: 12px; font-weight: 900; }
.node-network-title small { color: rgba(255,255,255,.58); font-size: 11px; }
.node-network-values { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.node-network-values > div { display: flex; align-items: center; gap: 9px; padding: 9px; border-radius: 10px; background: rgba(3,19,29,.3); }
.node-network-values em { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #99f6e4; background: rgba(20,184,166,.18); font-size: 18px; font-style: normal; }
.node-network-values span { display: grid; min-width: 0; }
.node-network-values b { color: rgba(255,255,255,.58); font-size: 10px; }
.node-network-values strong { overflow: hidden; color: #fff; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }


.site-footer {
    pointer-events: none;
}

.site-footer a {
    pointer-events: auto;
}


.client-agent-table .client-assist-btn {
    min-width: 112px;
    justify-content: center;
    white-space: nowrap;
}

.client-assist-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.client-assist-actions .client-assist-btn {
    min-width: max-content;
}

.client-screenshot-modal {
    width: min(1440px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
}

.client-screenshot-panel {
    grid-template-rows: auto auto minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    height: min(900px, calc(100vh - 32px));
    max-height: calc(100vh - 32px);
    overflow: hidden;
}

.client-screenshot-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
}

.client-screenshot-toolbar > div {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.client-screenshot-toolbar strong {
    color: var(--text);
    font-size: 14px;
}

.client-screenshot-toolbar strong[data-mode="loading"] {
    color: var(--blue);
}

.client-screenshot-toolbar strong[data-mode="ready"] {
    color: var(--green);
}

.client-screenshot-toolbar strong[data-mode="error"] {
    color: var(--red);
}

.client-screenshot-toolbar span {
    color: var(--muted);
    font-size: 12px;
}

.client-screenshot-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 360px;
    min-width: 0;
    width: 100%;
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: radial-gradient(circle at 50% 38%, rgba(41, 86, 145, 0.22), transparent 44%), #0b111b;
}

.client-screenshot-stage img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.client-screenshot-stage img[hidden] {
    display: none;
}

.client-live-stage video {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #05080d;
}

.client-live-stage video[hidden] {
    display: none;
}

.client-screenshot-placeholder {
    display: grid;
    place-items: center;
    gap: 12px;
    color: rgba(222, 234, 249, 0.62);
    font-weight: 700;
}

.client-screenshot-placeholder[hidden] {
    display: none;
}

.client-screenshot-placeholder svg {
    width: 52px;
    height: 52px;
    opacity: 0.5;
}

.subtle-text {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.part-processing-filter-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.part-processing-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.part-processing-actions .row-actions,
.part-processing-table-head .row-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.part-processing-section {
    display: grid;
    gap: 12px;
}

.part-processing-table-head > div:first-child,
.part-processing-section .statistics-card-head > div:first-child {
    display: grid;
    gap: 4px;
}

.part-processing-summary-table {
    min-width: max-content;
}

.part-processing-files-table {
    width: 100%;
    min-width: 900px;
    table-layout: fixed;
}

.part-processing-summary-table th,
.part-processing-summary-table td {
    text-align: center;
}

.part-processing-summary-table thead tr:first-child > th:first-child,
.part-processing-summary-table tbody td:first-child {
    position: sticky;
    left: 0;
    min-width: 140px;
    text-align: left;
}

.part-processing-summary-table thead tr:first-child > th:first-child {
    z-index: 4;
    background: var(--primary);
}

.part-processing-summary-table tbody td:first-child {
    z-index: 2;
    background: var(--paper-strong);
}

.part-processing-pagination {
    display: grid;
    grid-template-columns: auto minmax(170px, auto) auto;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.part-processing-pagination .page-info {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.part-processing-pagination .icon-text-btn {
    grid-template-columns: auto;
    min-width: 74px;
    padding: 0 14px;
}

.part-processing-table-wrap {
    max-height: min(102vh, 1140px);
}

.part-processing-files-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #eef7f6;
    color: #183f3c;
}

.part-processing-files-table .drawing-set-info-column {
    width: 30%;
}

.part-processing-files-table .drawing-set-result-column {
    width: 150px;
}

.part-processing-files-table td {
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
    padding: 16px 14px;
}

.part-processing-drawing-set-row td {
    background: #f8fbfb;
    border-top: 2px solid #b7d8d4;
}

.part-processing-drawing-set-row.needs-attention td {
    background: #fffcf2;
}

.part-processing-drawing-set-row .drawing-set-folder {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.part-processing-drawing-set-row .drawing-set-path,
.part-processing-file-child-row .file-evidence-note {
    color: var(--muted);
    font-size: 12px;
}

.part-processing-file-child-row td {
    background: var(--paper-strong);
}

.part-processing-file-child-row .file-child-name {
    display: grid;
    gap: 8px;
    padding-left: 14px;
    border-left: 3px solid #b7d8d4;
    min-width: 0;
}

.drawing-set-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.drawing-set-title strong {
    flex: 1;
    min-width: 100px;
    font-size: 15px;
}

.drawing-set-file-count {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.drawing-set-meta {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 5px 10px;
    font-size: 12px;
    line-height: 1.5;
}

.drawing-set-meta > span,
.drawing-set-meta small {
    color: var(--muted);
}

.drawing-set-meta b {
    font-weight: 500;
}

.drawing-set-meta small {
    display: block;
    font-size: 11px;
}

.drawing-set-path {
    line-height: 1.5;
}

.drawing-set-result {
    display: grid;
    justify-items: start;
    gap: 12px;
}

.drawing-set-amount {
    color: var(--primary);
    font-size: 18px;
}

.drawing-set-amount small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.part-processing-files-table .inline-link {
    text-align: left;
    line-height: 1.5;
    white-space: normal;
    padding: 3px 0;
}

.part-processing-expand-btn svg {
    transform: rotate(-90deg);
    transition: transform 160ms ease;
}

.part-processing-expand-btn[aria-expanded="true"] svg {
    transform: rotate(0);
}

.part-processing-files-table .stage-column {
    min-width: 160px;
}

.part-processing-files-table .stage-column small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-weight: 600;
}

.part-processing-file-row.needs-attention td {
    background: rgba(255, 248, 226, 0.68);
}

.cell-stack,
.stage-result-content {
    display: grid;
    gap: 4px;
}

.cell-stack span,
.stage-result-content > span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.stage-result-cell {
    min-width: 160px;
    vertical-align: top;
}

.stage-result-content {
    gap: 8px;
    align-content: start;
}

.stage-result-content > .stage-exception-text {
    color: #985b13;
}

.stage-result-cell.missing-stage {
    color: var(--amber);
}

.stage-result-cell.exception-stage {
    color: var(--red);
}

.stage-result-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.part-processing-files-table .part-processing-badge {
    white-space: nowrap;
}

.stage-result-meta b,
.amount-cell {
    white-space: nowrap;
}

.part-processing-badge,
.manual-month-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
}

.quality-confirmed,
.status-confirmed {
    color: #176b3a;
    border-color: #95d5b2;
    background: #dff7ea;
}

.quality-historical_inferred,
.status-historical_inferred {
    color: #075985;
    border-color: #9ed2f3;
    background: #e5f3ff;
}

.quality-manual_assigned,
.status-manual_assigned {
    color: #6b3f00;
    border-color: #f5bd62;
    background: #fff1d6;
}

.quality-adder,
.status-adder {
    color: #6941a5;
    border-color: #c4b5fd;
    background: #f3edff;
}

.quality-manual_conflict,
.quality-adder_conflict {
    color: #991b1b;
    border-color: #fecaca;
    background: #fef2f2;
}

.quality-missing,
.status-missing,
.manual-month-badge {
    color: #854d0e;
    border-color: #fde047;
    background: #fef9c3;
}

.status-exception {
    color: #991b1b;
    border-color: #fecaca;
    background: #fef2f2;
}

#partProcessingConfigDialog,
#partProcessingDetailDialog,
#partProcessingManualOwnerDialog {
    width: min(1180px, calc(100vw - 28px));
}

#partProcessingManualOwnerDialog {
    width: min(620px, calc(100vw - 28px));
}

.part-processing-config-dialog,
.part-processing-detail-dialog,
.part-processing-manual-owner-dialog {
    max-height: calc(100vh - 36px);
    overflow: hidden;
}

.part-processing-config-stages,
.part-processing-detail-content {
    min-height: 0;
    overflow: auto;
}

.part-processing-config-stages {
    display: grid;
    gap: 10px;
    padding-right: 4px;
}

.part-processing-config-stage {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fbfb;
}

.part-processing-config-stage-head,
.part-processing-config-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.part-processing-config-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 0.8fr) minmax(150px, 0.6fr);
    gap: 12px;
}

.part-processing-config-grid label,
#partProcessingMonthDialog label,
.part-processing-manual-owner-fields label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.part-processing-module-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: 6px 10px;
}

.part-processing-module-grid .check-line {
    min-height: 32px;
    padding: 0 8px;
    border: 1px solid rgba(0, 77, 64, 0.1);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--text);
    font-size: 12px;
}

.danger-icon-btn {
    color: var(--red);
}

.part-processing-config-footer {
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.part-processing-config-footer .form-status {
    flex: 1 1 auto;
    color: var(--red);
    font-size: 12px;
}

.part-processing-detail-content {
    display: grid;
    gap: 16px;
    padding-right: 4px;
}

.part-processing-detail-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--line);
}

.part-processing-detail-summary span {
    display: grid;
    gap: 5px;
    padding: 12px;
    background: #f8fbfb;
}

.part-processing-detail-summary b {
    color: var(--muted);
    font-size: 11px;
}

.part-processing-detail-stages {
    display: grid;
    gap: 0;
    border-top: 1px solid var(--line);
}

.part-processing-detail-stages > section {
    display: grid;
    gap: 8px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.part-processing-detail-stages p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.part-processing-detail-stage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.part-processing-raw-title {
    margin: 0;
}

.part-processing-exception-actions,
.part-processing-manual-owner-footer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.part-processing-exception-actions {
    min-width: 210px;
}

.part-processing-exception-actions .icon-text-btn {
    min-height: 34px;
}

.part-processing-manual-owner-dialog {
    display: grid;
    gap: 16px;
}

.part-processing-manual-owner-fields {
    display: grid;
    gap: 14px;
}

#partProcessingManualOwnerDialog [hidden] {
    display: none !important;
}

.part-processing-manual-owner-fields textarea {
    min-height: 82px;
    padding-top: 10px;
    resize: vertical;
}

.part-processing-manual-owner-evidence,
.manual-assignment-meta {
    color: #6b3f00;
    font-size: 12px;
    line-height: 1.6;
}

.part-processing-manual-owner-evidence {
    padding: 10px 12px;
    border-left: 3px solid #f5bd62;
    background: #fff8e8;
}

.part-processing-manual-owner-footer {
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.part-processing-manual-owner-footer .form-status {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--red);
    font-size: 12px;
}

.part-processing-manual-owner-footer .form-actions {
    flex: 0 0 auto;
    min-width: max-content;
}

.part-processing-manual-owner-footer .icon-text-btn {
    flex: 0 0 auto;
}

#cancelPartProcessingManualOwnerBtn,
.part-processing-manual-owner-cancel {
    grid-template-columns: auto;
    min-width: 76px;
}

@media (max-width: 700px) {
    .client-screenshot-panel {
        height: calc(100vh - 20px);
    }

    .client-screenshot-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .client-screenshot-stage {
        min-height: 260px;
    }

    .part-processing-filter-grid,
    .part-processing-config-grid,
    .part-processing-detail-summary {
        grid-template-columns: 1fr;
    }

    .part-processing-pagination {
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        width: 100%;
    }

    .part-processing-pagination .icon-text-btn {
        width: 100%;
    }

    .part-processing-actions,
    .part-processing-config-stage-head,
    .part-processing-config-footer,
    .part-processing-manual-owner-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .part-processing-actions .row-actions,
    .part-processing-config-footer .form-actions {
        justify-content: stretch;
    }

    .part-processing-actions .icon-text-btn,
    .part-processing-config-footer .icon-text-btn {
        flex: 1 1 auto;
    }

    .part-processing-module-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 701px) and (max-width: 1180px) {
    .part-processing-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .part-processing-module-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
