: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;
}

.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) 34px;
}

.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;
}

.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-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 {
    background: #0f1f1d;
}

.video-player-wrap video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0f1f1d;
}

.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-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;
}

.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);
}

#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;
}

.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;
}

.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;
    }

    .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 24px;
    }

    .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 24px;
    }

    .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;
    }
}
