/* Base reset */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    color: #0f172a;
    background: #f1f3f5;
    min-height: 100vh;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    transition: all 0.3s ease;
}

/* 响应式容器 */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
        padding: 24px;
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .container {
        max-width: 1200px;
        padding: 20px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 1000px;
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
}

.app-header {
    background: #0f172a;
    color: #fff;
}

.app-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.4px;
}

.spacer {
    flex: 1;
}

.page {
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Grid */
.grid {
    display: grid;
    gap: 16px;
}

.grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 960px) {
    .grid.cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {

    .grid.cols-3,
    .grid.cols-2 {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 12px;
    }

    .card {
        padding: 12px;
    }

    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 13px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 14px;
    }

    .row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .row .btn,
    .row .input,
    .row .select {
        width: 100%;
        max-width: none;
    }
}

/* Cards - 高性能毛玻璃效果 */
.card {
    position: relative;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 20px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    max-width: 100%;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    will-change: transform;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: 16px;
    pointer-events: none;
    z-index: -1;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* 响应式卡片 */
@media (min-width: 1400px) {
    .card {
        padding: 32px;
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .card {
        padding: 28px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .card {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 16px;
        border-radius: 12px;
    }
}

.card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card h3 {
    margin-top: 0;
    font-size: 16px;
    color: #0f172a;
}

.stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.stat .value {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}

.stat .label {
    color: #64748b;
    font-size: 12px;
}

/* Tables - 高性能毛玻璃效果 */
.table {
    position: relative;
    width: 100%;
    border-collapse: collapse;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    will-change: transform;
}

.table::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: 12px;
    pointer-events: none;
    z-index: -1;
}

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

.table th {
    background: rgba(255, 255, 255, 0.4);
    color: #0f172a;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Forms */
.form {
    display: grid;
    gap: 12px;
    max-width: 640px;
}

.input-row {
    display: grid;
    gap: 8px;
}

.label {
    font-size: 12px;
    color: #475569;
}

.input,
.select,
.textarea {
    position: relative;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    will-change: background-color, box-shadow;
}

.input::before,
.select::before,
.textarea::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: 12px;
    pointer-events: none;
    z-index: -1;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: #6366f1;
    background: rgba(255, 255, 255, 0.8);
    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.15),
        0 6px 20px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.textarea {
    min-height: 96px;
    resize: vertical;
}

/* Buttons - 简洁美观样式 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn.primary {
    background: #6366f1;
    color: #fff;
    border: 1px solid #6366f1;
}

.btn.primary:hover {
    background: #4f46e5;
}

.btn.outline {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

.btn.outline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.btn.danger {
    background: #ef4444;
    color: #fff;
    border: 1px solid #ef4444;
}

.btn.danger:hover {
    background: #dc2626;
}

/* Badges - 简洁美观样式 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
}

.badge.success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.badge.warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fbbf24;
}

.badge.danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #f87171;
}

/* Modal/Dialog Styles - 高性能毛玻璃效果 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modalFadeIn 0.2s ease;
    will-change: opacity;
}

.modal-content {
    position: relative;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 32px;
    width: 90%;
    max-width: 500px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    animation: modalSlideIn 0.3s ease;
    will-change: transform, opacity;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: 20px;
    pointer-events: none;
    z-index: -1;
}

.modal-content h3 {
    margin: 0 0 24px 0;
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    text-align: center;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate3d(0, -20px, 0) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

/* Performance optimizations */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Optimize scrolling performance */
.mobile-nav {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Reduce paint operations */
.card,
.table,
.btn,
.input,
.select,
.textarea {
    contain: layout style paint;
}

/* Optimize animations for better performance */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Helper */
.row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.muted {
    color: #64748b;
}

.small {
    font-size: 12px;
}

/* Additional responsive styles */
@media (max-width: 480px) {
    .container {
        padding: 0 8px;
    }

    .card {
        padding: 8px;
        border-radius: 8px;
    }

    .card h3 {
        font-size: 14px;
    }

    .stat .value {
        font-size: 24px;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 6px 4px;
    }

    .input,
    .select,
    .textarea {
        padding: 8px 10px;
        font-size: 14px;
    }

    .btn {
        padding: 8px 10px;
        font-size: 13px;
    }

    .badge {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* Table responsive behavior */
@media (max-width: 640px) {
    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .table thead,
    .table tbody,
    .table th,
    .table td,
    .table tr {
        display: block;
    }

    .table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table tr {
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        margin-bottom: 8px;
        padding: 8px;
    }

    .table td {
        border: none;
        position: relative;
        padding-left: 50%;
        white-space: normal;
        text-align: left;
    }

    .table td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: #475569;
    }
}