* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #5555ff;
    --primary-dark: #3333dd;
    --primary-light: #7777ff;
    --secondary: #7777ff;
    --accent: #ff5599;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f5f5f5;
    --bg-dark: #1a1a1a;
    --bg-card: #ffffff;
    --text-primary: #111111;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e0e0e0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    background: white;
    min-height: 100vh;
    position: relative;
}

.header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    color: white;
    padding: 16px 32px;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(100, 200, 255, 0.1);
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 100, 200, 0.1);
    min-height: 80px;
}

.math-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-center {
    text-align: center;
    flex: 1;
}

.header-center h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(96, 165, 250, 0.3);
    position: relative;
}

.header-center p {
    font-size: 13px;
    opacity: 0.8;
    font-weight: 400;
    color: #94a3b8;
    letter-spacing: 1px;
}

.header-user {
    width: 140px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.tabs {
    display: flex;
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    overflow-x: auto;
    position: sticky;
    top: 76px;
    z-index: 999;
}

.tab {
    padding: 18px 32px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 600;
    color: #666666;
    white-space: nowrap;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    letter-spacing: 0.2px;
}

.tab:hover {
    color: #000000;
    background: #f5f5f5;
}

.tab.active {
    color: #000000;
    border-bottom-color: #000000;
    background: white;
}

.tab-content {
    display: none;
    padding: 32px;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section {
    margin-bottom: 36px;
}

.section h2 {
    font-size: 20px;
    color: #111827;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid #000000;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.section h3 {
    font-size: 17px;
    color: var(--text-primary);
    margin: 24px 0 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

.template-card {
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-card);
    position: relative;
    overflow: hidden;
}

.template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.template-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
}

.template-card:hover::before {
    opacity: 1;
}

.template-card.selected {
    border-color: var(--primary);
    border-width: 3px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
    box-shadow: var(--shadow-xl);
}

.template-card.selected::before {
    opacity: 1;
}

.template-check {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--shadow-md);
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.template-check:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: scale(1.1);
}

.template-card.selected::after {
    display: none;
}

.template-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.template-card h4 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 700;
}

.template-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.template-fields {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 2px dashed var(--border);
}

.template-fields small {
    color: var(--text-muted);
    font-size: 12px;
}

.file-uploaders {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.file-uploader {
    border: 3px dashed var(--border);
    border-radius: 20px;
    padding: 36px 24px;
    text-align: center;
    background: var(--bg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.file-uploader::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(168, 85, 247, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.file-uploader:hover {
    border-color: var(--primary);
    background: var(--bg-card);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.file-uploader:hover::before {
    opacity: 1;
}

.file-uploader label {
    cursor: pointer;
    display: block;
    position: relative;
    z-index: 1;
}

.file-uploader strong {
    display: block;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 700;
}

.file-uploader small {
    color: var(--text-secondary);
    font-size: 14px;
}

.file-uploader input[type="file"] {
    display: none;
}

.status {
    margin-top: 18px;
    font-size: 13px;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.status.pending {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.status.success {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
}

.status.error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
}

.file-info {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

.btn {
    padding: 13px 28px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.2px;
}

.btn-primary {
    background: #000000;
    color: #ffffff;
    cursor: pointer;
}

.btn-primary:hover {
    background: #333333;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #666666;
    color: white;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #444444;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.btn-success {
    background: #000000;
    color: white;
}

.btn-success:hover {
    background: #333333;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.btn-warning {
    background: #666666;
    color: white;
}

.btn-warning:hover {
    background: #444444;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.btn:disabled {
    background: #cccccc;
    color: #999999;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn:disabled:hover {
    background: #cccccc;
    box-shadow: none;
    transform: none;
}

.action-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.field-config {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.field-checkbox {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border: 2px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-card);
}

.field-checkbox:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.field-checkbox input {
    margin-right: 14px;
    width: 22px;
    height: 22px;
    accent-color: var(--primary);
}

.field-checkbox span {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

.field-mapping {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.mapping-item {
    display: flex;
    align-items: center;
    padding: 20px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mapping-item:hover {
    border-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.02);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.mapping-item.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: var(--shadow-md);
}

.mapping-checkbox {
    margin-right: 16px;
}

.mapping-checkbox input {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--primary);
}

.mapping-field {
    flex: 1;
}

.mapping-field-name {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 15px;
}

.mapping-source {
    font-size: 13px;
    color: var(--text-secondary);
}

.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
    border: 2px solid var(--border);
    border-radius: 20px;
    margin-top: 28px;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: #d4d0c8;
    color: #1f2937;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

th {
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.5px;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.total-row {
    background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
    font-weight: 800;
}

.table-info {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

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

.result-header .table-info {
    margin-bottom: 0;
}

.result-header .btn-primary {
    height: auto;
    line-height: normal;
    padding: 12px 28px;
    font-size: 15px;
}

.toast-container {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.toast {
    padding: 12px 28px;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 14px;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.toast-success {
    background: #000000;
    color: #ffffff;
}

.toast-error {
    background: #666666;
    color: #ffffff;
}

.structure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.structure-item {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.structure-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.structure-item h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.structure-item ul {
    list-style: none;
    max-height: 240px;
    overflow-y: auto;
}

.structure-item li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px dashed var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.structure-item li::before {
    content: '•';
    color: var(--primary);
    font-weight: bold;
}

.data-preview {
    margin-top: 28px;
    padding: 24px;
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border-radius: 16px;
    border: 2px solid #fde047;
}

.data-preview h4 {
    color: #854d0e;
    margin-bottom: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.data-preview table {
    font-size: 12px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.data-preview th, .data-preview td {
    padding: 10px 14px;
}

.data-preview thead {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.formula-panel {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 2px solid #86efac;
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 28px;
}

.formula-item {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 2px dashed rgba(134, 239, 172, 0.5);
}

.formula-item:last-child {
    border-bottom: none;
}

.formula-name {
    font-weight: 800;
    color: #166534;
    width: 220px;
    flex-shrink: 0;
}

.formula-expr {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    color: #065f46;
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    border: 2px solid #86efac;
    font-size: 14px;
    flex: 1;
}

.crowd-badge {
    display: inline-block;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 13px;
    margin: 4px;
    font-weight: 700;
    border: 2px solid var(--primary-light);
}

.group-by-section {
    margin-bottom: 28px;
    padding: 24px;
    background: linear-gradient(135deg, #fef3c7, #fef9c3);
    border: 2px solid #fde047;
    border-radius: 16px;
}

.group-by-options {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 16px;
}

.group-by-option {
    display: flex;
    align-items: center;
    padding: 12px 22px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.group-by-option:hover {
    border-color: #f59e0b;
    background: #fefce8;
    transform: translateY(-2px);
}

.group-by-option.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.group-by-option input {
    margin-right: 12px;
    width: 22px;
    height: 22px;
    accent-color: var(--primary);
}

.quick-select {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.quick-select button {
    padding: 12px 24px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.quick-select button:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.user-bar {
    display: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.7));
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    box-shadow: var(--shadow-md);
}

.user-name {
    font-size: 14px;
    color: white;
    font-weight: 600;
}

.btn-logout {
    padding: 10px 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.login-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #1e293b;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeInOverlay 0.3s ease;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 40px;
    width: 460px;
    max-width: 95%;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h2 {
    font-size: 26px;
    color: var(--text-primary);
    margin-bottom: 28px;
    text-align: center;
    font-weight: 800;
    letter-spacing: -0.3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.form-group label {
    display: block;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 700;
}

.form-group input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 14px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: var(--bg);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.modal-actions {
    display: flex;
    gap: 16px;
    margin-top: 32px;
}

.modal-actions .btn {
    flex: 1;
}

.modal-tabs {
    display: flex;
    margin-bottom: 28px;
    border-bottom: 2px solid var(--border);
    padding: 0 4px;
}

.modal-tab {
    flex: 1;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 15px;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-weight: 700;
    margin-bottom: -2px;
}

.modal-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.saved-templates-section {
    margin-top: 28px;
    padding: 24px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 2px solid #86efac;
    border-radius: 20px;
}

.saved-templates-section h3 {
    font-size: 18px;
    color: #166534;
    margin-bottom: 16px;
    font-weight: 800;
}

.saved-template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px;
    background: white;
    border: 2px solid #86efac;
    border-radius: 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.saved-template-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
    border-color: #10b981;
}

.saved-template-item:last-child {
    margin-bottom: 0;
}

.saved-template-info {
    flex: 1;
}

.saved-template-name {
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 16px;
}

.saved-template-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.saved-template-actions {
    display: flex;
    gap: 10px;
}

.btn-load {
    padding: 10px 18px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-load:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-edit {
    padding: 10px 18px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-delete {
    padding: 10px 18px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-delete:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-dark), var(--secondary));
}

.template-name-input {
    display: flex;
    gap: 14px;
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #fef3c7, #fef9c3);
    border: 2px solid #fde047;
    border-radius: 16px;
}

.template-name-input input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--border);
    border-radius: 14px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
}

.template-name-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.login-page {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1e293b 50%, var(--bg-dark) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 60px 60px;
}

.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    opacity: 0.4;
}

.shape-1 {
    width: 350px;
    height: 350px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    top: 8%;
    left: 8%;
    animation: float1 8s ease-in-out infinite;
}

.shape-2 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.1));
    transform: rotate(45deg);
    top: 55%;
    right: 12%;
    animation: float2 10s ease-in-out infinite;
}

.shape-3 {
    width: 180px;
    height: 180px;
    border: 3px solid rgba(168, 85, 247, 0.3);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    bottom: 12%;
    left: 18%;
    animation: float3 12s ease-in-out infinite;
}

.shape-4 {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.15));
    border-radius: 50%;
    top: 18%;
    right: 22%;
    animation: float4 9s ease-in-out infinite;
}

@keyframes float1 {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-40px) rotate(12deg); }
}

@keyframes float2 {
    0%, 100% { transform: rotate(45deg) translateY(0); }
    50% { transform: rotate(58deg) translateY(30px); }
}

@keyframes float3 {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.15); }
}

@keyframes float4 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(25px, -25px); }
}

/* ==================== 平台选择页面样式 ==================== */
.platform-select-page {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1e293b 50%, var(--bg-dark) 100%);
    position: relative;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.platform-select-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 60px 60px;
}

.platform-select-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1000px;
}

.platform-select-header {
    text-align: center;
    margin-bottom: 50px;
}

.platform-select-header h1 {
    font-size: 42px;
    font-weight: 800;
    color: white;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.platform-select-header p {
    font-size: 16px;
    color: #94a3b8;
    font-weight: 500;
}

.platform-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.platform-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 32px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.platform-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.6s ease;
}

.platform-card:hover::before {
    left: 100%;
}

.platform-card:hover {
    transform: translateY(-8px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.platform-card.selected {
    border-color: #60a5fa;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(167, 139, 250, 0.08));
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

.platform-icon {
    width: 90px;
    height: 90px;
    border-radius: 18px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: none;
}

.platform-icon.douyin {
    background: transparent;
    box-shadow: none;
}

.platform-icon svg,
.platform-icon img {
    width: 65px;
    height: 65px;
    object-fit: contain;
}

.platform-info {
    flex: 1;
    text-align: left;
}

.platform-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin-bottom: 6px;
}

.platform-info p {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 12px;
}

.platform-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.platform-tags .tag {
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    font-size: 12px;
    color: #cbd5e1;
    font-weight: 500;
}

.platform-arrow {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.platform-card:hover .platform-arrow {
    background: #60a5fa;
    color: white;
    transform: translateX(4px);
}

.platform-footer {
    text-align: center;
}

.platform-footer .hint {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 20px;
}

.platform-footer .btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.platform-footer .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ==================== 平台标识样式 ==================== */
.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
}

.platform-badge.xiaohongshu {
    background: linear-gradient(135deg, rgba(254, 44, 85, 0.1), rgba(255, 107, 157, 0.05));
    color: #FE2C55;
    border: 1px solid rgba(254, 44, 85, 0.2);
}

.platform-badge.douyin {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.1), rgba(37, 37, 37, 0.05));
    color: #000000;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.platform-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #60a5fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.platform-switch-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

/* Tab中的平台选择样式 */
.tab.platform-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.2);
    transition: all 0.3s ease;
}

.tab.platform-tab:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.08));
}

.platform-icon-inline {
    width: 28px;
    height: 28px;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;
}

.switch-arrow {
    font-size: 12px;
    opacity: 0.6;
    margin-left: 4px;
    transition: transform 0.2s ease;
}

.tab.platform-tab:hover .switch-arrow {
    transform: translateY(2px);
}

/* Tab内容中的平台选择网格 */
.platform-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.platform-select-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

.platform-select-card:hover {
    border-color: #6366f1;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
    transform: translateY(-4px);
}

.platform-select-card.selected {
    border-color: #6366f1;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(168, 85, 247, 0.02));
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
}

.platform-select-card-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
    overflow: hidden;
}

.platform-select-card-icon img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.platform-select-card-icon.red {
    background: transparent;
    box-shadow: none;
}

.platform-select-card-icon.black {
    background: transparent;
    box-shadow: none;
}

.platform-select-card-info {
    flex: 1;
    text-align: left;
}

.platform-select-card-info h3 {
    font-size: 20px;
    font-weight: 700;
    color: #111;
    margin-bottom: 6px;
}

.platform-select-card-info p {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.platform-select-card-check {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #6366f1;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.platform-select-card.selected .platform-select-card-check {
    opacity: 1;
    transform: scale(1);
}

.login-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    width: 100%;
}

.login-left, .login-right {
    width: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-left {
    color: white;
    padding: 48px;
}

.left-content {
    max-width: 480px;
}

.left-title {
    font-size: 40px;
    font-weight: 900;
    margin-bottom: 36px;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #818cf8, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.feature-item {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    background: rgba(255,255,255,0.05);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(255,255,255,0.08);
    transform: translateX(8px);
}

.feature-icon {
    font-size: 36px;
    flex-shrink: 0;
}

.feature-content h3 {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 6px;
}

.feature-content p {
    font-size: 14px;
    opacity: 0.8;
    line-height: 1.6;
}

.divider-line {
    width: 2px;
    height: 500px;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.3), transparent);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
}

.login-right {
    padding: 48px;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-box {
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(32px);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-xl), 0 25px 80px rgba(99, 102, 241, 0.25);
    border: 2px solid rgba(255,255,255,0.2);
}

.login-header {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 28px;
}

.login-header h1 {
    font-size: 30px;
    margin-bottom: 10px;
    font-weight: 900;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    font-size: 14px;
    opacity: 0.7;
    font-weight: 600;
    color: var(--text-secondary);
}

/* 新手提示卡片 */
.hint-card {
    background: #fff9e6;
    border: 1px solid #ffe066;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.hint-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.hint-content h4 {
    font-size: 15px;
    font-weight: 700;
    color: #996600;
    margin-bottom: 6px;
}

.hint-content p {
    font-size: 14px;
    color: #666666;
    line-height: 1.6;
}
