html,
body {
    height: 100%;
    background: #f4f6f8;
    color: #1f2937;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
}

.is-hidden {
    display: none !important;
}

.login-page {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background:
        linear-gradient(135deg, rgba(49, 130, 206, 0.11), rgba(22, 163, 74, 0.08)),
        #f6f8fb;
}

.login-card {
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.10);
    padding: 34px;
}

.login-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 26px;
}

.brand-mark,
.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #1677ff;
    color: #fff;
    font-weight: 700;
}

.login-brand h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.35;
    font-weight: 700;
}

.login-brand p,
.page-head p,
.section-title p,
.metric-card small {
    margin: 0;
    color: #7b8794;
}

.login-form .layui-form-item {
    position: relative;
}

.login-form .layui-input {
    height: 44px;
    padding-left: 42px;
    border-radius: 10px;
}

.input-icon {
    position: absolute;
    top: 8px;
    left: 12px;
    z-index: 2;
    color: #429488;
}

.input-icon .layui-icon {
    font-size: 22px;
}

.role-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 18px;
    padding: 4px;
    border-radius: 12px;
    background: #f1f5f9;
}

.role-pill,
.filter-pill {
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #536171;
    height: 34px;
}

.role-pill.active,
.filter-pill.active {
    background: #fff;
    color: #1677ff;
    box-shadow: 0 1px 8px rgba(15, 23, 42, 0.08);
}

.login-hint {
    margin-top: 16px;
    text-align: center;
    color: #8a96a3;
    font-size: 12px;
}

.app-header {
    height: 62px;
    background: #fff !important;
    border-bottom: 1px solid #e7ebf0;
    box-shadow: 0 1px 8px rgba(15, 23, 42, 0.04);
}

.header-left,
.header-right {
    height: 62px;
    display: flex;
    align-items: center;
}

.header-left {
    float: left;
    gap: 12px;
    padding-left: 20px;
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.header-title {
    color: #1f2937;
    font-size: 16px;
    line-height: 1.3;
    font-weight: 700;
}

.header-subtitle {
    color: #8a96a3;
    font-size: 12px;
    line-height: 1.3;
}

.header-right {
    float: right;
    gap: 12px;
    padding-right: 18px;
}

.user-name {
    color: #4b5563;
}

.app-side {
    top: 62px;
    width: 218px;
}

.app-side .layui-nav {
    background: #202735;
}

.app-side .layui-nav-item a {
    display: flex;
    gap: 10px;
    align-items: center;
}

.app-body {
    top: 62px;
    left: 218px;
    bottom: 0;
    background: #f4f6f8;
}

.content-wrap {
    padding: 24px;
    max-width: 1440px;
}

.page-head,
.section-title,
.table-toolbar,
.action-row,
.filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-head {
    margin-bottom: 18px;
}

.page-head h2 {
    margin: 0 0 6px;
    font-size: 26px;
    font-weight: 700;
    color: #111827;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.metric-card,
.work-card,
.image-tile,
.result-item,
.file-item {
    background: #fff;
    border: 1px solid #e5eaf0;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
}

.metric-card {
    padding: 17px;
    min-height: 118px;
}

.metric-card span {
    color: #667085;
    font-size: 13px;
}

.metric-card strong {
    display: block;
    margin: 8px 0 6px;
    font-size: 28px;
    line-height: 1.1;
    color: #111827;
}

.metric-card.warning strong {
    color: #b7791f;
}

.work-card {
    padding: 18px;
    margin-bottom: 18px;
}

.section-title {
    margin-bottom: 14px;
}

.section-title.compact {
    margin-bottom: 10px;
}

.section-title h3 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
}

.threshold-control {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
    color: #667085;
}

.threshold-control .layui-input {
    width: 78px;
    text-align: center;
    border-radius: 9px;
}

.upload-zone {
    position: relative;
    min-height: 170px;
    border: 1px dashed #b9c5d3;
    border-radius: 14px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #65758b;
    text-align: center;
    cursor: pointer;
}

.upload-zone.small {
    min-height: 126px;
}

.upload-zone:hover {
    border-color: #1677ff;
    background: #f5faff;
}

.upload-zone .layui-icon {
    font-size: 34px;
    color: #1677ff;
}

.upload-zone strong {
    color: #263142;
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.preview-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 14px 2px 4px;
}

.preview-card {
    width: 132px;
    flex: 0 0 132px;
    border: 1px solid #e6ebf1;
    border-radius: 12px;
    background: #fff;
    padding: 8px;
}

.preview-card img {
    width: 100%;
    height: 92px;
    object-fit: contain;
    background: #f3f5f8;
    border-radius: 9px;
}

.preview-card span {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #536171;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-row {
    justify-content: flex-start;
    margin-top: 14px;
}

.filter-row {
    justify-content: flex-start;
    margin-bottom: 14px;
}

.filter-pill {
    height: 32px;
    padding: 0 14px;
    border: 1px solid #d8dee7;
    background: #fff;
}

.result-list {
    display: grid;
    gap: 12px;
}

.result-item {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) 120px 130px;
    gap: 16px;
    align-items: center;
    padding: 12px;
}

.result-item img,
.file-icon,
.base-thumb {
    background: #f4f6f8;
    border-radius: 12px;
}

.result-item img {
    width: 90px;
    height: 90px;
    object-fit: contain;
}

.result-main strong,
.file-main strong,
.image-tile strong {
    display: block;
    color: #172033;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-main span,
.file-main span,
.image-tile span {
    display: block;
    margin-top: 5px;
    color: #7b8794;
    font-size: 12px;
}

.score-meter {
    height: 8px;
    border-radius: 999px;
    background: #e8eef5;
    overflow: hidden;
    margin-top: 8px;
}

.score-meter b {
    display: block;
    height: 100%;
    background: #1677ff;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    height: 28px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-violation {
    background: #fee2e2;
    color: #b91c1c;
}

.status-pass {
    background: #dcfce7;
    color: #15803d;
}

.status-failed {
    background: #f3f4f6;
    color: #6b7280;
}

.empty-state {
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8a96a3;
    border: 1px dashed #d6dee8;
    border-radius: 12px;
    background: #fbfcfe;
}

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

.image-tile {
    padding: 10px;
}

.base-thumb {
    width: 100%;
    height: 148px;
    object-fit: contain;
}

.tile-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.tile-actions .layui-btn {
    flex: 1;
}

.table-toolbar {
    margin-bottom: 14px;
}

.toolbar-search {
    display: flex;
    gap: 8px;
    width: min(420px, 100%);
}

.toolbar-search.wide {
    width: min(560px, 100%);
}

.file-list {
    display: grid;
    gap: 12px;
}

.file-item {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
}

.file-icon {
    width: 62px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e11d48;
    font-weight: 800;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
}

.settings-grid label span {
    display: block;
    margin-bottom: 7px;
    color: #5f6b7a;
}

.detail-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.detail-figure {
    border: 1px solid #e5eaf0;
    border-radius: 14px;
    padding: 12px;
    background: #fff;
}

.detail-figure img {
    width: 100%;
    height: 260px;
    object-fit: contain;
    background: #f5f7fa;
    border-radius: 10px;
}

.detail-figure h4 {
    margin: 12px 0 4px;
    font-size: 15px;
    font-weight: 700;
}

.detail-meta {
    margin-top: 12px;
    color: #5f6b7a;
    line-height: 1.8;
}

@media (max-width: 980px) {
    .app-side {
        width: 76px;
    }

    .app-body {
        left: 76px;
    }

    .app-side .layui-nav-item a {
        justify-content: center;
        font-size: 0;
    }

    .app-side .layui-icon {
        font-size: 20px;
    }

    .metric-grid,
    .settings-grid,
    .detail-compare {
        grid-template-columns: 1fr;
    }

    .result-item {
        grid-template-columns: 80px minmax(0, 1fr);
    }
}

@media (max-width: 720px) {
    .content-wrap {
        padding: 16px;
    }

    .page-head,
    .section-title,
    .table-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-title {
        font-size: 14px;
    }

    .header-subtitle,
    .user-name {
        display: none;
    }
}
