﻿:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #9333ea;
    --bg: #f4f6fb;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft Yahei', Arial, sans-serif;
    margin: 0;
    color: var(--text);
    background: var(--bg);
}

.app-shell {
    min-height: 100vh;
    background: linear-gradient(120deg, #eef2ff, #fdf2ff);
}

.topbar {
    height: 64px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    box-shadow: 0 4px 20px rgba(15,23,42,0.08);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-dark);
}

.topbar-subtitle {
    color: var(--muted);
    font-size: 14px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-menu {
    position: relative;
}

.user-trigger {
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 999px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
}

.user-badge .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-role {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.caret {
    font-size: 12px;
    color: var(--muted);
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: 110%;
    min-width: 160px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(15,23,42,0.15);
    padding: 8px 0;
    display: none;
    flex-direction: column;
    z-index: 50;
}

.user-menu.open .user-dropdown,
.user-menu:hover .user-dropdown {
    display: flex;
}

.user-dropdown a {
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}

.user-dropdown a:hover {
    background: #eef2ff;
}

.logout {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
}

.app-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

.sidebar {
    width: 230px;
    background: rgba(15,23,42,0.96);
    color: #cbd5f5;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 16px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav a {
    color: inherit;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.sidebar-divider {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 16px;
    color: rgba(255,255,255,0.6);
}

.sidebar-meta {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
}

.app-container {
    flex: 1;
    padding: 32px 48px;
    background: var(--bg);
}

.card {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 35px rgba(15,23,42,0.07);
}

.hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.table-card {
    margin-top: 24px;
}

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

.info-card {
    background: linear-gradient(135deg, #1d4ed8, #9333ea);
    color: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(15,23,42,0.2);
}

.info-card.compact {
    background: linear-gradient(135deg,#0ea5e9,#6366f1);
}

.info-card ul {
    padding-left: 18px;
    line-height: 1.7;
}

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

.form-panel {
    background: var(--surface);
    border-radius: 16px;
}

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

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h2 {
    margin: 0;
}

.grid {
    display: grid;
    gap: 24px;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 16px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.table th {
    background: #f8fafc;
    font-size: 14px;
    color: var(--muted);
}

.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: #eef2ff;
    color: var(--primary);
}

.badge.inactive {
    background: #fee2e2;
    color: #b91c1c;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(37,99,235,0.1);
    color: var(--primary-dark);
    font-size: 14px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: linear-gradient(120deg, #2563eb, #7c3aed);
    color: #fff;
    border-radius: 12px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    box-shadow: 0 15px 30px rgba(124, 58, 237, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 35px rgba(124, 58, 237, 0.35);
}

.button.secondary {
    background: linear-gradient(120deg, #0ea5e9, #2563eb);
    box-shadow: 0 12px 25px rgba(14, 165, 233, 0.25);
}

.button.ghost {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: none;
}

.button.ghost:hover {
    background: rgba(59, 130, 246, 0.2);
    box-shadow: none;
}

.button.ghost.danger {
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(248, 113, 113, 0.15);
}

.button.ghost.copied {
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.18);
}

.button-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.download-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.download-link code {
    background: #0f172a;
    color: #fff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 13px;
}

.app-icon-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-icon-thumb {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 10px 20px rgba(15,23,42,0.15);
}

.app-icon-thumb.placeholder {
    background: rgba(99,102,241,0.15);
    color: #4c1d95;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-transform: uppercase;
}

.app-meta .app-title {
    font-weight: 600;
}

.app-meta .app-subtitle {
    color: var(--muted);
    font-size: 13px;
}

.form-group {
    margin-bottom: 16px;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 11px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 14px;
    background: #fff;
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    background: #fee2e2;
    color: #b91c1c;
}

.toggle-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.toggle-group .pill {
    cursor: pointer;
    border: 1px solid rgba(37,99,235,0.3);
}

.toggle-group .pill input {
    display: none;
}

.toggle-group .pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.stat-card {
    padding: 20px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 12px 25px rgba(15,23,42,0.04);
}

.stat-card h3 {
    margin: 0;
    font-size: 15px;
    color: var(--muted);
}

.stat-card .value {
    font-size: 34px;
    margin-top: 8px;
    font-weight: 700;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table-actions form {
    margin: 0;
}

.app-footer {
    margin-top: 24px;
    text-align: center;
    color: var(--muted);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.form-actions.inline-actions {
    justify-content: flex-start;
}

.upload-progress-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(37,99,235,0.08);
    border: 1px solid rgba(37,99,235,0.16);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.upload-progress-bar.active {
    opacity: 1;
    transform: translateY(0);
}

.upload-progress-bar[data-state="error"] {
    border-color: rgba(239,68,68,0.4);
    background: rgba(248,113,113,0.15);
}

.progress-track {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: rgba(148,163,184,0.4);
    overflow: hidden;
}

.progress-value {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(120deg, #2563eb, #7c3aed);
    transition: width 0.2s ease;
}

.progress-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    min-width: 56px;
    text-align: right;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.upload-form.compact-form {
    gap: 18px;
}

.upload-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    gap: 28px;
}

.upload-grid.dual-pane {
    grid-template-columns: minmax(0, 1.5fr) 340px;
}

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

.upload-panel {
    background: #fff;
    border-radius: 20px;
    padding: 28px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 30px 45px rgba(15,23,42,0.08);
}

.upload-panel.slim-panel {
    padding: 22px;
}

.upload-aside {
    background: linear-gradient(160deg, rgba(37,99,235,0.95), rgba(147,51,234,0.95));
    color: #fff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 30px 40px rgba(79,70,229,0.35);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upload-aside h3 {
    margin: 0;
}

.upload-tips {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upload-tips li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.upload-tips li::before {
    content: '•';
    font-size: 20px;
    color: rgba(255,255,255,0.7);
}

.field-cluster {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.inline-row {
    display: grid;
    gap: 10px;
}

.inline-row.two-cols {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.inline-row.three-cols {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.collapse-toggle {
    width: 100%;
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 10px;
    text-align: left;
    cursor: pointer;
}

.collapse-card {
    margin-top: 10px;
    transition: max-height 0.2s ease, opacity 0.2s ease;
}

.collapse-card.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.dropzone {
    border: 2px dashed rgba(37,99,235,0.4);
    border-radius: 16px;
    padding: 24px;
    background: rgba(37,99,235,0.05);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: block;
    text-align: center;
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone strong {
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
}

.dropzone span {
    color: var(--muted);
    font-size: 13px;
}

.icon-dropzone {
    border-style: solid;
    background: rgba(236, 72, 153, 0.06);
    border-color: rgba(236,72,153,0.4);
}

.icon-preview {
    margin-bottom: 8px;
}

.icon-preview img {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: 0 12px 24px rgba(15,23,42,0.25);
}

.upload-aside .badge {
    align-self: flex-start;
    background: rgba(255,255,255,0.18);
    color: #fff;
}

.download-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 16px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 20px 35px rgba(15,23,42,0.25);
}

.download-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.form-card {
    padding: 28px 32px;
}

.form-card.tight-card {
    padding: 22px 24px;
}

.two-col-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.two-col-form.tight-form {
    gap: 14px;
}

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

.two-col-form .form-grid.compact-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.two-col-form .full-width {
    grid-column: 1 / -1;
}

.inline-upload {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.inline-upload.compact-inline {
    gap: 16px;
}

.inline-upload .upload-box {
    background: #f8fafc;
    border-radius: 18px;
    padding: 16px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.inline-upload.compact-inline .upload-box {
    padding: 14px;
}

.inline-upload .upload-box .dropzone {
    margin-top: 8px;
}

.upload-card {
    margin-top: 12px;
}

.stacked-blocks .field-cluster {
    height: 100%;
}

.description-row {
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
    gap: 14px;
}

.stacked-upload {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tight-dropzone {
    padding: 10px;
}

.grow-textarea {
    min-height: 70px;
}

.dual-upload {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 8px;
}

.dual-upload .dropzone {
    min-height: 80px;
}

.download-template {
    min-height: 100vh;
    background: linear-gradient(135deg,#0b5ed7,#6610f2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.download-card {
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 32px;
    width: 100%;
    max-width: 520px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.download-card h1 {
    margin-top: 0;
    text-align: center;
}

.download-card .meta {
    margin: 16px 0;
    opacity: 0.9;
    text-align: center;
}

.download-card p {
    text-align: left;
}

.download-card a.button {
    width: 100%;
    justify-content: center;
    font-size: 18px;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    background: radial-gradient(circle at top, rgba(147,51,234,0.5), transparent 60%), #0f172a;
    position: relative;
    overflow: hidden;
}

.auth-page::before,
.auth-page::after {
    content: '';
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,0.4), transparent 70%);
    filter: blur(60px);
    opacity: 0.7;
}

.auth-page::before {
    top: -120px;
    left: -60px;
}

.auth-page::after {
    bottom: -160px;
    right: -80px;
}

.auth-wrapper {
    width: 100%;
    max-width: 1100px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 40px;
    position: relative;
    z-index: 2;
}

.auth-hero {
    color: #f8fafc;
    padding: 24px;
}

.auth-hero .badge {
    display: inline-flex;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    font-size: 14px;
    letter-spacing: 0.04em;
    margin-bottom: 20px;
}

.auth-hero h2 {
    font-size: 32px;
    margin: 0 0 12px;
}

.auth-hero p {
    margin: 0 0 16px;
    color: rgba(248,250,252,0.9);
}

.auth-hero ul {
    padding-left: 20px;
    margin: 0;
    color: rgba(248,250,252,0.85);
    line-height: 1.8;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
}

.auth-card h1 {
    margin-top: 0;
    text-align: center;
}

.auth-card p {
    text-align: center;
}

@media (max-width: 960px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .app-container {
        padding: 24px;
    }

    .hero-card {
        flex-direction: column;
        align-items: flex-start;
    }
}
