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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 12px;
    background: #f5f5f5;
    color: #333;
    line-height: 1.4;
}

/* 导航栏 */
.navbar {
    background: #1a1a2e;
    color: white;
    padding: 0 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 36px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar-brand {
    font-size: 13px;
    font-weight: bold;
    color: #4ecca3;
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    gap: 3px;
    list-style: none;
}

.navbar-nav a {
    color: #ccc;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 3px;
    transition: all 0.2s;
    font-size: 11px;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    color: white;
    background: rgba(255,255,255,0.1);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.navbar-user span {
    color: #4ecca3;
}

/* 移动端汉堡菜单按钮 */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 10px;
    }

    .navbar-toggle {
        display: block;
    }

    .navbar-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        padding-top: 10px;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: 8px;
    }

    .navbar-nav.show {
        display: flex;
    }

    .navbar-nav a {
        display: block;
        padding: 8px 10px;
        border-radius: 0;
    }

    .navbar-user {
        display: none;
        width: 100%;
        justify-content: center;
        padding-top: 10px;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: 8px;
    }

    .navbar-user.show {
        display: flex;
    }

    .main-content {
        padding: 8px;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .table {
        font-size: 10px;
    }

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

    .btn {
        padding: 4px 8px;
    }

    .btn-sm {
        padding: 3px 6px;
        font-size: 9px;
    }

    .btn-group {
        flex-wrap: wrap;
    }
}

/* 主内容区 */
.main-content {
    margin-top: 36px;
    padding: 10px;
    min-height: calc(100vh - 36px);
}

/* 卡片 */
.card {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    margin-bottom: 10px;
    overflow: hidden;
}

.card-header {
    background: #f8f9fa;
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 8px 10px;
}

/* 网格布局 */
.grid {
    display: grid;
    gap: 10px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 768px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* 响应式表格容器 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    gap: 3px;
}

.btn-primary { background: #4ecca3; color: white; }
.btn-primary:hover { background: #3db892; }

.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }

.btn-warning { background: #f39c12; color: white; }
.btn-warning:hover { background: #d68910; }

.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #5a6268; }

.btn-sm { padding: 2px 6px; font-size: 10px; }

.btn-group {
    display: flex;
    gap: 4px;
}

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

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

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #666;
    font-size: 10px;
    text-transform: uppercase;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* 状态标签 */
.badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* 统计卡片 */
.stat-card {
    text-align: center;
    padding: 12px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #1a1a2e;
}

.stat-label {
    color: #666;
    font-size: 11px;
    margin-top: 3px;
}

.stat-positive { color: #27ae60; }
.stat-negative { color: #e74c3c; }

/* 表单 */
.form-group {
    margin-bottom: 10px;
}

.form-label {
    display: block;
    margin-bottom: 3px;
    font-weight: 500;
    color: #333;
    font-size: 11px;
}

.form-control {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #4ecca3;
}

/* 提示消息 */
.alert {
    padding: 8px 12px;
    border-radius: 3px;
    margin-bottom: 10px;
    font-size: 11px;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    margin: 20px;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 日志显示 */
.log-viewer {
    background: #1a1a2e;
    color: #4ecca3;
    padding: 10px;
    border-radius: 3px;
    font-family: "Fira Code", "Consolas", monospace;
    font-size: 11px;
    line-height: 1.4;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
}

/* 加载中 */
.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-indicator {
    display: none;
}

/* 工具类 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #666; }
.text-success { color: #27ae60; }
.text-danger { color: #e74c3c; }
.text-warning { color: #f39c12; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
