@charset "UTF-8";

:root {
    /* 紧凑业务界面共用的颜色、阴影和布局变量。 */
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f9fbfd;
    --ink: #14212b;
    --muted: #66758a;
    --line: #dbe3ee;
    --line-strong: #c7d2e1;
    --primary: #0f766e;
    --primary-dark: #0b5f59;
    --blue: #2563eb;
    --amber: #b7791f;
    --red: #b42318;
    --violet: #6d28d9;
    --shadow: 0 18px 42px rgba(16, 24, 40, 0.10);
    --shadow-soft: 0 8px 22px rgba(16, 24, 40, 0.07);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    line-height: 1.55;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    color: #1742a4;
}

button,
input,
select,
textarea {
    font: inherit;
}

.shell {
    /* 登录后的主布局：左侧导航固定，右侧内容自适应。 */
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 22px;
    height: 100vh;
    padding: 22px 16px;
    color: #edf7f5;
    background: #1d312f;
}

.brand {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    color: #fff;
}

.brand:hover {
    color: #fff;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0f766e, #2563eb);
    font-weight: 900;
    letter-spacing: 0;
}

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

.brand small,
.account span,
.topbar span,
.muted {
    color: var(--muted);
}

.brand small,
.account span {
    color: #a9bfbb;
    font-size: 12px;
}

.nav {
    display: grid;
    align-content: start;
    gap: 7px;
}

.nav a,
.ghost-button {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 12px;
    color: #d8e7e4;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 800;
}

.nav a:hover,
.ghost-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.14);
}

.account {
    display: grid;
    gap: 10px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
}

.account strong {
    overflow-wrap: anywhere;
}

.account form {
    margin: 0;
}

.ghost-button {
    width: 100%;
    justify-content: center;
    cursor: pointer;
}

.main {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 58px;
    padding: 0 30px;
    background: rgba(245, 247, 251, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.page {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.guest {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.hero {
    /* 仪表盘、列表页和编辑页共用的页面头部。 */
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: end;
    margin-bottom: 20px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.kicker {
    display: inline-flex;
    width: fit-content;
    min-height: 26px;
    align-items: center;
    padding: 3px 10px;
    color: var(--primary-dark);
    background: #e7f5f2;
    border: 1px solid #b9ded8;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.title {
    margin: 8px 0 0;
    font-size: 32px;
    line-height: 1.18;
    letter-spacing: 0;
}

.note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 8px;
    font-weight: 900;
    line-height: 1.25;
    white-space: nowrap;
    cursor: pointer;
}

.button:hover {
    color: #fff;
    background: var(--primary-dark);
}

.button.secondary {
    color: var(--primary-dark);
    background: #fff;
    border-color: #bdd6d2;
}

.button.secondary:hover {
    color: var(--primary-dark);
    background: #f1faf8;
}

.button.danger {
    color: var(--red);
    background: #fff;
    border-color: #efb8b2;
}

.button.danger:hover {
    color: #fff;
    background: var(--red);
    border-color: var(--red);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.card,
.panel,
.login-card {
    /* 卡片和面板使用统一底色、边框和阴影，保持视觉一致。 */
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border-top: 4px solid var(--primary);
}

.app-card {
    min-height: 180px;
    align-content: space-between;
}

.device-card {
    align-content: start;
}

.device-thumb {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.device-thumb-placeholder {
    display: grid;
    place-items: center;
    color: var(--primary-dark);
    background: linear-gradient(135deg, #e7f5f2, #eef4ff);
    font-weight: 900;
}

.device-thumb-placeholder span {
    overflow-wrap: anywhere;
}

.panel {
    overflow: hidden;
    margin-bottom: 16px;
}

.panel-head {
    padding: 16px 18px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}

.panel-body {
    padding: 16px 18px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.metric {
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-top: 4px solid var(--primary);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.metric strong {
    display: block;
    margin-top: 6px;
    font-size: 30px;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.search-form,
.inline-form,
.filter-form {
    /* 搜索和筛选区域在小屏幕自动换行，避免横向溢出。 */
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.search-form input,
.filter-form input[type="text"],
.filter-form select,
.form-shell input,
.form-shell select,
.form-shell textarea {
    width: 100%;
    min-height: 42px;
    padding: 8px 11px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
}

.search-form input {
    flex: 1;
    min-width: 220px;
}

.filter-form input[type="text"] {
    flex: 2;
    min-width: 260px;
}

.filter-form select {
    width: auto;
    min-width: 150px;
}

.check-option {
    display: inline-flex;
    gap: 7px;
    align-items: center;
    min-height: 42px;
    color: #405064;
    font-weight: 900;
    white-space: nowrap;
}

.form-shell {
    display: grid;
    gap: 14px;
}

.form-shell p {
    display: grid;
    gap: 6px;
    margin: 0;
}

.form-shell label {
    color: #405064;
    font-size: 13px;
    font-weight: 900;
}

.form-shell textarea {
    min-height: 110px;
}

.errorlist {
    margin: 0;
    padding-left: 18px;
    color: var(--red);
}

.table-wrap {
    /* 表格可能比视口宽，横向滚动限制在表格容器内。 */
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: #475467;
    background: var(--surface-2);
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

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

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    color: #344054;
    background: #eef2f7;
    border: 1px solid #d6dee8;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.pill.success {
    color: var(--primary-dark);
    background: #e7f5f2;
    border-color: #b9ded8;
}

.pill.warning {
    color: var(--amber);
    background: #fff7e6;
    border-color: #f3d49b;
}

.pill.danger {
    color: var(--red);
    background: #fff0ed;
    border-color: #efb8b2;
}

.branch-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 12px;
    margin-bottom: 14px;
}

.summary-item {
    padding: 13px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.summary-item strong {
    display: block;
    margin-top: 5px;
    font-size: 24px;
    line-height: 1.15;
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.pill-row.compact {
    margin-top: 0;
}

.latest-strip {
    padding: 12px;
    background: #f8fbfd;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.version-table-wrap {
    margin-top: 10px;
}

.version-table {
    min-width: 980px;
}

.branch-table {
    min-width: 1120px;
}

.version-table td:first-child {
    min-width: 160px;
}

.table-action {
    min-height: 32px;
    padding: 5px 10px;
}

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

.table-more {
    margin-top: 10px;
    padding: 10px 12px;
    color: var(--muted);
    background: #fbfcfe;
    border: 1px dashed #c7d2e1;
    border-radius: 8px;
    font-size: 14px;
}

.table-more a {
    font-weight: 900;
}

.chain-preview {
    /* 升级链预览通过可展开的省略段保持长链可读。 */
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding: 14px;
    background: #f8fbfd;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.chain-title {
    font-size: 14px;
    font-weight: 900;
}

.chain-line {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.chain-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.chain-pill,
.chain-gap,
.chain-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.chain-toggle {
    color: var(--primary-dark);
    cursor: pointer;
}

.chain-toggle:hover {
    background: #f1faf8;
}

.chain-gap-wrap,
.chain-hidden-segment {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.chain-hidden-segment[hidden] {
    display: none;
}

.chain-pill.current {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.full-chain {
    align-items: center;
}

.chain-gap {
    color: var(--muted);
}

.chain-arrow {
    color: var(--muted);
    font-weight: 900;
}

.guidance-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.guidance-grid > div {
    display: grid;
    gap: 5px;
    padding: 13px;
    background: #f8fbfd;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.guidance-grid strong {
    overflow-wrap: anywhere;
}

.warning-note {
    margin: 12px 0 0;
    padding: 10px 12px;
    color: #7a4b12;
    background: #fff7e6;
    border: 1px solid #f3d49b;
    border-radius: 8px;
}

.messages {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.message {
    padding: 11px 13px;
    color: #123f35;
    background: #ebf8f4;
    border: 1px solid #bfe5da;
    border-radius: 8px;
}

.message.error {
    color: var(--red);
    background: #fff0ed;
    border-color: #efb8b2;
}

.empty {
    padding: 24px;
    color: var(--muted);
    background: #fff;
    border: 1px dashed #b7c3d0;
    border-radius: 8px;
    text-align: center;
}

.login-card {
    width: min(440px, 100%);
    padding: 34px;
    border-top: 6px solid var(--primary);
    box-shadow: var(--shadow);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.device-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.image-preview {
    display: block;
    width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: zoom-in;
}

.image-preview:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 3px;
    border-radius: 8px;
}

.image-lightbox {
    /* 页面内轻量图片预览，不依赖外部 JS 库。 */
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 48px 24px 24px;
    background: rgba(10, 18, 26, 0.72);
}

.image-lightbox[hidden] {
    display: none;
}

.image-lightbox img {
    max-width: min(960px, 94vw);
    max-height: 82vh;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.lightbox-close {
    position: fixed;
    top: 18px;
    right: 18px;
    min-height: 36px;
    padding: 7px 12px;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-weight: 900;
    cursor: pointer;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 14px;
}

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

    .sidebar {
        position: static;
        height: auto;
    }

    .nav {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .account {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }

    .topbar {
        display: none;
    }
}

@media (max-width: 720px) {
    .page {
        width: min(100% - 28px, 1240px);
    }

    .hero,
    .metrics,
    .guidance-grid {
        grid-template-columns: 1fr;
    }

    .actions {
        justify-content: stretch;
    }

    .button,
    .ghost-button {
        width: 100%;
    }

    .account {
        grid-template-columns: 1fr;
    }

    .branch-summary,
    .chain-line {
        grid-template-columns: 1fr;
    }

    .device-thumb {
        height: 180px;
    }

    .filter-form input[type="text"],
    .filter-form select,
    .check-option {
        width: 100%;
    }
}
