:root {
    --sys-green: #16a34a;
    --sys-green-dark: #15803d;
    --sys-green-soft: #ecfdf3;
    --sys-bg: #f4f6f8;
    --sys-panel: #ffffff;
    --sys-line: #e5e7eb;
    --sys-line-strong: #d7dde5;
    --sys-text: #111827;
    --sys-muted: #6b7280;
    --sys-soft-text: #94a3b8;
    --sys-danger: #dc2626;
    --sys-danger-soft: #fff1f2;
    --sys-warning: #b45309;
    --sys-warning-soft: #fffbeb;
    --sys-radius: 8px;
    --sys-width: 1320px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--sys-bg);
}

body {
    margin: 0;
    background: var(--sys-bg);
    color: var(--sys-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

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

button {
    cursor: pointer;
}

.sys-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 64px;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--sys-line);
    backdrop-filter: blur(12px);
}

.sys-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 70;
    width: 224px;
    background: #fff;
    border-right: 1px solid var(--sys-line);
    display: flex;
    flex-direction: column;
}

.sys-side-brand {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid var(--sys-line);
}

.sys-side-brand img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.sys-side-brand strong {
    font-size: 16px;
    font-weight: 900;
}

.sys-side-nav {
    flex: 1;
    padding: 16px 12px;
    overflow: auto;
}

.sys-side-nav a {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    margin-bottom: 4px;
    border-radius: 7px;
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    font-weight: 850;
}

.sys-side-nav a.active {
    background: var(--sys-green-soft);
    color: var(--sys-green-dark);
}

.sys-side-group {
    margin: 14px 12px 7px;
    color: var(--sys-muted);
    font-size: 12px;
    font-weight: 900;
}

.sys-side-foot {
    height: 54px;
    display: flex;
    align-items: center;
    padding: 0 18px;
    color: var(--sys-muted);
    border-top: 1px solid var(--sys-line);
    font-size: 13px;
    font-weight: 850;
}

.sys-topbar-inner {
    max-width: var(--sys-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.sys-mobile-appbar {
    display: none;
}

@media (min-width: 761px) {
    .sys-topbar {
        left: 224px;
        right: 0;
    }

    .sys-topbar-inner {
        max-width: none;
    }

    .sys-topbar .sys-brand img,
    .sys-topbar .sys-brand strong {
        display: none;
    }

    .sys-shell {
        max-width: none;
        margin-left: 224px;
        padding-left: 24px;
        padding-right: 24px;
    }
}

.sys-brand,
.sys-nav-actions,
.sys-row,
.sys-inline-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sys-brand img,
.brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: cover;
}

.sys-brand strong {
    font-size: 17px;
    font-weight: 900;
    white-space: nowrap;
}

.sys-shell {
    max-width: var(--sys-width);
    margin: 18px auto 42px;
    padding: 0 18px;
}

.sys-page-head {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
}

.sys-page-head h1,
.sys-panel-title h2,
.sys-section-title {
    margin: 0;
    color: var(--sys-text);
    font-weight: 900;
    line-height: 1.25;
}

.sys-page-head h1 {
    font-size: 24px;
}

.sys-page-head p,
.sys-panel-title span,
.sys-muted {
    color: var(--sys-muted);
    font-size: 13px;
    font-weight: 750;
    line-height: 1.6;
}

.sys-grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 12px;
    align-items: start;
}

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

.sys-panel {
    background: var(--sys-panel);
    border: 1px solid var(--sys-line);
    border-radius: var(--sys-radius);
    overflow: hidden;
}

.sys-panel-title {
    min-height: 58px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--sys-line);
}

.sys-panel-title h2 {
    font-size: 18px;
}

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

.sys-btn {
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid var(--sys-line-strong);
    border-radius: 7px;
    background: #fff;
    color: #374151;
    font-weight: 850;
    white-space: nowrap;
}

.sys-btn.primary {
    border-color: var(--sys-green);
    background: var(--sys-green);
    color: #fff;
}

.sys-btn.soft {
    border-color: #bbf7d0;
    background: var(--sys-green-soft);
    color: var(--sys-green-dark);
}

.sys-btn.danger {
    border-color: #fecaca;
    background: var(--sys-danger-soft);
    color: var(--sys-danger);
}

.sys-btn.ghost {
    border-color: transparent;
    background: transparent;
}

.sys-input,
.sys-select,
.sys-textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--sys-line-strong);
    border-radius: 7px;
    background: #fff;
    color: var(--sys-text);
    outline: none;
    padding: 0 12px;
}

.sys-textarea {
    min-height: 86px;
    padding: 10px 12px;
    resize: vertical;
}

.sys-input:focus,
.sys-select:focus,
.sys-textarea:focus {
    border-color: var(--sys-green);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .10);
}

.sys-label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    color: #374151;
    font-weight: 850;
}

.sys-label b {
    color: var(--sys-danger);
    margin-left: 3px;
}

.sys-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.sys-form-row {
    margin-bottom: 14px;
}

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

.sys-stat {
    padding: 14px;
    border: 1px solid var(--sys-line);
    border-radius: var(--sys-radius);
    background: #fff;
}

.sys-stat b {
    display: block;
    font-size: 24px;
    line-height: 1.1;
}

.sys-stat span {
    display: block;
    margin-top: 6px;
    color: var(--sys-muted);
    font-size: 12px;
    font-weight: 850;
}

.sys-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.sys-chip {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    border: 1px solid var(--sys-line);
    border-radius: 7px;
    background: #fff;
    color: #374151;
    font-weight: 850;
}

.sys-chip.active {
    border-color: var(--sys-green);
    background: var(--sys-green-soft);
    color: var(--sys-green-dark);
}

.sys-check {
    width: 18px;
    height: 18px;
    border: 1.5px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    position: relative;
    flex: 0 0 18px;
}

.active .sys-check {
    border-color: var(--sys-green);
    background: var(--sys-green);
}

.active .sys-check:after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.sys-table-wrap {
    overflow: auto;
}

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

.sys-table th,
.sys-table td {
    height: 44px;
    padding: 0 12px;
    border-bottom: 1px solid var(--sys-line);
    text-align: left;
    white-space: nowrap;
    font-size: 14px;
}

.sys-table th {
    color: var(--sys-muted);
    background: #f8fafc;
    font-size: 12px;
    font-weight: 900;
}

.sys-table td {
    color: #1f2937;
    font-weight: 650;
}

.sys-empty {
    padding: 64px 18px;
    text-align: center;
    color: var(--sys-muted);
    font-weight: 800;
}

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

.sys-card {
    border: 1px solid var(--sys-line);
    border-radius: var(--sys-radius);
    background: #fff;
    padding: 14px;
}

.sys-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.sys-card-title {
    color: var(--sys-text);
    font-size: 16px;
    font-weight: 900;
    line-height: 1.35;
}

.sys-card-meta {
    margin-top: 6px;
    color: var(--sys-muted);
    font-size: 12px;
    font-weight: 750;
}

.mobile-card-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    margin: 14px -14px -14px;
    border-top: 1px solid var(--sys-line);
    background: var(--sys-line);
}

.mobile-card-actions button {
    min-height: 42px;
    border: 0;
    background: #fff;
    color: var(--sys-text);
    font-weight: 850;
}

.mobile-card-actions button:first-child {
    color: var(--sys-green-dark);
}

.mobile-submit-panel {
    margin-top: 12px;
}

.mobile-submit-panel .sys-btn {
    width: 100%;
}

.sys-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    border: 1px solid #bbf7d0;
    background: var(--sys-green-soft);
    color: var(--sys-green-dark);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.sys-pill.danger {
    border-color: #fecaca;
    background: var(--sys-danger-soft);
    color: var(--sys-danger);
}

.sys-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
}

.sys-info-cell {
    min-width: 0;
}

.sys-info-cell span {
    display: block;
    color: var(--sys-muted);
    font-size: 12px;
    font-weight: 850;
}

.sys-info-cell b {
    display: block;
    margin-top: 3px;
    color: var(--sys-text);
    font-size: 14px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.sys-bottom-bar {
    display: none;
}

.sys-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 2000;
    transform: translateX(-50%);
    display: none;
    max-width: calc(100vw - 40px);
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(17, 24, 39, .94);
    color: #fff;
    font-size: 14px;
}

.admin-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.admin-layout.desktop-only {
    display: grid;
}

.project-side {
    position: sticky;
    top: 82px;
    max-height: calc(100vh - 100px);
    overflow: hidden;
}

.project-menu {
    height: calc(100vh - 242px);
    min-height: 260px;
    max-height: 640px;
    overflow: auto;
    padding-bottom: 8px;
}

.project-menu-item {
    width: 100%;
    min-height: 46px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 0 14px;
    border: 0;
    border-left: 3px solid transparent;
    background: transparent;
    text-align: left;
    color: #4b5563;
    overflow: hidden;
}

.project-menu-item.active {
    border-left-color: var(--sys-green);
    background: var(--sys-green-soft);
    color: var(--sys-green-dark);
}

.project-menu-item span,
.project-menu-item b {
    min-width: 0;
    max-width: 100%;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-menu-item span {
    font-weight: 900;
}

.project-menu-item b {
    font-size: 12px;
}

.admin-main {
    min-width: 0;
}

.export-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.export-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--sys-line);
    border-radius: var(--sys-radius);
    background: #fff;
}

.export-step.active {
    border-color: var(--sys-green);
    background: var(--sys-green-soft);
}

.export-step:not(.active) b {
    background: #eef2f7;
    color: var(--sys-muted);
}

.export-step.active span {
    color: var(--sys-green-dark);
}

.export-step b {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--sys-green);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.export-step span {
    color: var(--sys-text);
    font-weight: 900;
}

.export-project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.select-card {
    width: 100%;
    min-height: 92px;
    border: 1px solid var(--sys-line);
    border-radius: var(--sys-radius);
    background: #fff;
    padding: 13px;
    text-align: left;
}

.select-card.active {
    border-color: var(--sys-green);
    background: var(--sys-green-soft);
}

.sticky-export {
    position: sticky;
    bottom: 12px;
    margin-top: 12px;
    border: 1px solid var(--sys-line);
    border-radius: var(--sys-radius);
    background: rgba(255, 255, 255, .98);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

.sys-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, .42);
}

.sys-modal-box {
    width: min(460px, 100%);
    max-height: 86vh;
    overflow: auto;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--sys-line);
}

.sys-modal-head,
.sys-modal-body,
.sys-modal-actions {
    padding: 16px;
}

.sys-modal-head {
    border-bottom: 1px solid var(--sys-line);
}

.sys-modal-head h3 {
    margin: 0;
    font-size: 18px;
}

.sys-modal-actions {
    border-top: 1px solid var(--sys-line);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 760px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block;
    }

    .sys-topbar {
        height: 58px;
        position: sticky;
        background: #fff;
    }

    .sys-topbar-inner {
        display: none;
    }

    .sys-mobile-appbar {
        height: 58px;
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        align-items: center;
        padding: 0 14px;
        background: #fff;
        border-bottom: 1px solid var(--sys-line);
    }

    .sys-mobile-appbar strong {
        text-align: center;
        font-size: 17px;
        font-weight: 900;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sys-mobile-appbar button {
        width: 36px;
        height: 36px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--sys-text);
        font-size: 22px;
        line-height: 1;
    }

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

    .sys-nav-actions {
        gap: 6px;
    }

    .sys-nav-actions .sys-btn:not(.primary),
    .sys-brand img.mobile-hide {
        display: none;
    }

    .sys-shell {
        margin-top: 12px;
        padding: 0 12px 78px;
    }

    .sys-page-head {
        min-height: auto;
        display: block;
        margin-bottom: 12px;
    }

    .sys-page-head h1 {
        font-size: 22px;
    }

    .sys-grid-2,
    .sys-grid-equal,
    .sys-form-grid,
    .sys-info-grid,
    .sys-stat-grid {
        grid-template-columns: 1fr;
    }

    .sys-panel-title {
        min-height: 54px;
        padding: 12px;
    }

    .sys-panel-body {
        padding: 12px;
    }

    .sys-card {
        padding: 13px;
    }

    .sys-table {
        min-width: 680px;
    }

    .sys-btn {
        min-height: 38px;
        padding: 0 12px;
    }

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

    .sys-inline-actions .sys-btn {
        width: 100%;
    }

    .sys-bottom-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        height: 62px;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        padding: 7px 6px max(7px, env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, .98);
        border-top: 1px solid var(--sys-line);
    }

    .sys-bottom-bar a {
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 7px;
        color: var(--sys-muted);
        text-decoration: none;
        font-size: 13px;
        font-weight: 900;
    }

    .sys-bottom-bar a.active {
        background: var(--sys-green-soft);
        color: var(--sys-green-dark);
    }

    .admin-layout,
    .export-steps,
    .export-project-grid {
        grid-template-columns: 1fr;
    }

    .project-side {
        position: static;
        max-height: none;
    }

    .sticky-export {
        left: 12px;
        right: 12px;
        bottom: 74px;
        display: block;
    }

    .sticky-export .sys-btn {
        width: 100%;
        margin-top: 10px;
    }

    .mobile-submit-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 74px;
        z-index: 65;
        margin: 0;
    }

    .mobile-submit-panel .sys-btn {
        min-height: 46px;
        box-shadow: 0 12px 28px rgba(22, 163, 74, .22);
    }

    .mobile-hero {
        margin-bottom: 12px;
        padding: 18px;
        border-radius: 12px;
        background: linear-gradient(135deg, #16a34a 0%, #0f8f3a 100%);
        color: #fff;
        position: relative;
        overflow: hidden;
    }

    .mobile-hero:after {
        content: "";
        position: absolute;
        right: 18px;
        top: 24px;
        width: 72px;
        height: 72px;
        border-radius: 16px;
        background: rgba(255,255,255,.18);
    }

    .mobile-hero h2 {
        margin: 0 0 6px;
        font-size: 22px;
    }

    .mobile-hero p {
        margin: 0;
        color: rgba(255,255,255,.86);
        font-size: 13px;
        font-weight: 800;
    }

    .mobile-hero-metrics {
        position: relative;
        z-index: 1;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1px;
        margin-top: 18px;
        border-radius: 10px;
        overflow: hidden;
        background: rgba(255,255,255,.22);
    }

    .mobile-hero-metrics div {
        background: #fff;
        padding: 12px 8px;
        text-align: center;
        color: var(--sys-text);
    }

    .mobile-hero-metrics b {
        display: block;
        font-size: 20px;
    }

    .mobile-hero-metrics small {
        color: var(--sys-muted);
        font-weight: 850;
    }

    .export-steps {
        grid-template-columns: repeat(3, 1fr);
        gap: 0;
        background: #fff;
        border: 1px solid var(--sys-line);
        border-radius: 10px;
        padding: 10px;
    }

    .export-step {
        padding: 0;
        border: 0;
        background: transparent;
        justify-content: center;
        gap: 6px;
    }

    .export-step span {
        font-size: 12px;
        white-space: nowrap;
    }
}

@media (min-width: 761px) {
    .sys-topbar {
        left: 224px;
        right: 0;
    }

    .sys-shell {
        width: calc(100% - 224px);
        max-width: none;
        margin: 18px 0 42px 224px;
        padding-left: 24px;
        padding-right: 24px;
    }

    .collect-wrap,
    .qr-layout {
        width: min(720px, calc(100% - 272px));
        margin-left: calc(224px + ((100% - 224px - min(720px, calc(100% - 272px))) / 2));
        margin-right: 24px;
    }
}
