body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    margin: 0;
    background: #f4f6fb;
    color: #1f2937;
}

.container {
    width: min(1500px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.nav {
    background: #0f172a;
    color: #fff;
}

.nav-inner {
    width: min(1320px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    gap: 16px;
}

.nav a,
.nav button {
    color: #fff;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.nav-links a,
.nav-links button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
}

.nav-links a:hover,
.nav-links button:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.5);
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.28);
    box-sizing: border-box;
}

.card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    margin-bottom: 20px;
}

.card h2,
.card h3 {
    margin-top: 0;
}

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

.field {
    margin-bottom: 14px;
}

.field-pair {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(480px, 1fr);
    gap: 16px;
    align-items: start;
}

.home-form-row {
    display: grid;
    gap: 16px;
}

.home-form-row-primary {
    grid-template-columns: repeat(4, minmax(200px, 1fr));
}

.home-form-row-secondary {
    grid-template-columns:
        minmax(150px, 0.8fr)
        minmax(170px, 0.9fr)
        minmax(220px, 1.1fr)
        minmax(620px, 2.4fr);
}

.home-upload-pair {
    grid-column: auto;
    grid-template-columns: minmax(150px, 190px) minmax(420px, 1fr);
}

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

@media (max-width: 1200px) {
    .home-form-row-primary,
    .home-form-row-secondary {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .home-upload-pair {
        grid-column: 1 / -1;
    }
}

@media (max-width: 960px) {
    .field-pair,
    .atd-pair,
    .home-form-row-primary,
    .home-form-row-secondary,
    .home-upload-pair,
    .upload-input-grid {
        grid-template-columns: 1fr;
    }

    .finger-row-body,
    .finger-inputs {
        grid-template-columns: 1fr;
    }
}

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.required-mark {
    color: #dc2626;
    margin-left: 4px;
}

.form-control {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    background: #fff;
}

.placeholder-soft::placeholder {
    color: #94a3b8;
    opacity: 0.95;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    padding: 10px 16px;
    font-size: 14px;
    text-decoration: none;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-secondary {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-success {
    background: #059669;
    color: #fff;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
}

.messages li {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.messages .success {
    background: #dcfce7;
    color: #166534;
}

.messages .error {
    background: #fee2e2;
    color: #991b1b;
}

.messages .warning {
    background: #fef3c7;
    color: #92400e;
}

.messages .info {
    background: #dbeafe;
    color: #1d4ed8;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(2px);
}

.loading-overlay[hidden] {
    display: none !important;
}

.loading-dialog {
    width: min(420px, calc(100% - 32px));
    padding: 28px 24px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
    text-align: center;
}

.loading-dialog h3 {
    margin: 0 0 10px;
    font-size: 22px;
    color: #0f172a;
}

.loading-dialog p {
    margin: 0;
    color: #475569;
    line-height: 1.7;
}

.loading-spinner {
    width: 52px;
    height: 52px;
    margin: 0 auto 18px;
    border: 4px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: loading-spin 0.9s linear infinite;
}

body.loading-open {
    overflow: hidden;
}

@keyframes loading-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.errorlist {
    color: #dc2626;
    padding-left: 18px;
    margin: 6px 0 0;
}

.hint {
    color: #64748b;
    font-size: 13px;
    margin-top: 4px;
}

.field-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.checkbox-select {
    display: grid;
    gap: 8px;
}

.checkbox-select > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group {
    display: grid;
    gap: 10px;
}

.checkbox-option {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
}

.checkbox-option input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.page-title {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-title h1,
.case-name,
.finger-title {
    margin-top: 0;
}

.page-title h1 {
    margin-bottom: 0;
}

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

.summary-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table th,
.summary-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

.summary-table th {
    font-weight: 700;
}

.thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
}

.thumb-empty {
    display: inline-flex;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #94a3b8;
    font-size: 12px;
}

.thumb-large {
    width: 400px;
    height: 400px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
}

.thumb-empty-large {
    width: 400px;
    height: 400px;
    border-radius: 14px;
    font-size: 14px;
}

.entry-list {
    display: grid;
    gap: 16px;
}

.finger-row {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    background: #f8fafc;
}

.finger-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.finger-row-body {
    display: grid;
    grid-template-columns: minmax(380px, 1.8fr) minmax(240px, 0.9fr);
    gap: 20px;
    align-items: start;
}

.finger-media-list {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.finger-media-card {
    display: grid;
    gap: 8px;
}

.finger-variant-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 4px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 600;
}

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

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

.meta-item {
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 8px;
    text-align: left;
}

.inline-form {
    display: inline;
}

.tag {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
}

.auth-card-login {
    max-width: 480px;
    margin: 48px auto;
}

.auth-card-register {
    max-width: 560px;
    margin: 36px auto;
}

.user-form-card {
    max-width: 720px;
}

.alert-card-danger {
    border-left: 4px solid #dc2626;
}

.case-name {
    margin-bottom: 8px;
}

.form-actions-tight {
    margin-top: 0;
}

.upload-form {
    margin-top: 16px;
}

.section-card-muted {
    margin-top: 20px;
    background: #f8fafc;
}

.finger-media {
    margin-bottom: 12px;
}
