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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 80px; /* 底部导航空间 */
}

.app-header {
    background: #1a73e8;
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.15rem;
}

.app-header .operator-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #fff;
}
.app-header .operator-name {
    font-weight: 600;
    color: #fff;
}
.app-header .change-btn {
    color: #fff;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* 用户信息栏 */
.app-header .user-info {
    font-size: 0.95rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}
.app-header .user-info a {
    color: rgba(255,255,255,0.85);
    font-size: 0.95rem;
    text-decoration: none;
}
.app-header .user-info a:hover {
    color: #fff;
    text-decoration: underline;
}
.app-header .sep {
    color: rgba(255,255,255,0.4);
    font-size: 0.95rem;
}
.app-header .change-pwd-link {
    word-break: break-all;
    white-space: normal;
    max-width: 2em;
    line-height: 1.1;
    text-align: center;
    display: inline-block;
    margin-right: 2px;
}

/* ===== 顶部导航 ===== */
.app-nav {
    background: white;
    padding: 10px 20px;
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    border-bottom: 1px solid #e0e0e0;
    overflow-x: auto;
}

.app-nav a {
    text-decoration: none;
    color: #666;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-nav a.active, .app-nav a:hover {
    background: #e8f0fe;
    color: #1a73e8;
}

/* ===== 卡片 ===== */
.card {
    background: white;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #444;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    min-width: 100px;
    min-height: 44px;
    transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.97); }

.btn-green { background: #34a853; color: white; }
.btn-yellow { background: #fbbc04; color: #333; }
.btn-red { background: #ea4335; color: white; }
.btn-blue { background: #1a73e8; color: white; }
.btn-gray { background: #e0e0e0; color: #666; }

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
    min-width: 140px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #1a73e8;
}

.form-control-large {
    font-size: 1.4rem;
    padding: 20px;
    text-align: center;
    letter-spacing: 2px;
}

/* 输入框聚焦时自动滚动，防止被虚拟键盘遮挡 */
input:focus, select:focus, textarea:focus {
    scroll-into-view: block;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-pending { background: #fff3e0; color: #e65100; }
.badge-running { background: #e8f5e9; color: #2e7d32; }
.badge-paused { background: #fff8e1; color: #f57f17; }
.badge-completed { background: #e3f2fd; color: #1565c0; }

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

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

.table th {
    background: #f5f7fa;
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
}

/* ===== 任务卡片（手机端替代表格） ===== */
.task-card {
    border-left: 4px solid #1a73e8;
    padding: 15px;
}

.task-card.status-running { border-left-color: #34a853; }
.task-card.status-paused { border-left-color: #fbbc04; }
.task-card.status-completed { border-left-color: #ea4335; }

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.task-card-title {
    font-weight: 600;
    font-size: 1rem;
}

.task-card-info {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 12px;
}

.task-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.timer {
    font-family: "Courier New", monospace;
    font-size: 1.8rem;
    font-weight: bold;
    color: #1a73e8;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1a73e8;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #888;
    margin-top: 5px;
}

.stat-card[style*="cursor"] {
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card[style*="cursor"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s;
}

.toast.show { opacity: 1; }
.toast-success { background: #34a853; }
.toast-error { background: #ea4335; }
.toast-info { background: #1a73e8; }

/* ===== 图表筛选器 ===== */
.chart-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
    overflow: hidden;
}

.filter-prefix {
    font-size: 0.85rem;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-input {
    width: 80px !important;
    font-size: 16px !important;
    flex-shrink: 1;
    min-width: 60px;
}

.filter-select {
    flex: 1 1 auto;
    font-size: 16px !important;
    min-width: 80px;
    max-width: 160px;
    width: auto !important;
}

/* 图表容器 */
#userChart {
    width: 100%;
    height: 300px;
    overflow: hidden;
}

#userChartCard {
    overflow-x: auto;
    overflow-y: hidden;
}

/* 备案 footer */
.beian-footer {
    text-align: center;
    padding: 10px 10px 8px;
    font-size: 10px;
    color: #bbb;
    background: #fafafa;
    border-top: 1px solid #eee;
    margin-top: 40px;
    line-height: 2;
}
.beian-footer a {
    color: #999;
    text-decoration: none;
}
.beian-footer a:hover {
    color: #666;
}
.beian-icon {
    width: 11px;
    height: 11px;
    vertical-align: middle;
    margin-right: 2px;
}
.beian-separator {
    margin: 0 5px;
    color: #eee;
}

/* ===== 手机端响应式 ===== */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .container {
        max-width: 100%;
        width: 100%;
        padding: 12px;
        padding-bottom: 20px;
        overflow-x: hidden;
    }

    /* 图表筛选器手机端 */
    .chart-filters {
        gap: 4px;
        overflow: hidden;
    }

    .filter-prefix {
        font-size: 0.85rem;
        font-size: 16px;
    }

    .filter-input {
        width: 75px !important;
        font-size: 16px !important;
        padding: 8px 6px;
    }

    .filter-select {
        font-size: 16px !important;
        padding: 8px 6px;
        max-width: 120px;
    }

    /* 导出日期输入框手机端 */
    .card input[type="date"],
    .card select {
        max-width: 100%;
    }

    /* 表格改成卡片布局 */
    .table-wrap {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .table-wrap table,
    .table-wrap thead,
    .table-wrap tbody,
    .table-wrap th,
    .table-wrap td,
    .table-wrap tr {
        display: block;
    }
    .table-wrap thead {
        display: none;
    }
    .table-wrap tr {
        background: white;
        border-radius: 8px;
        padding: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    .table-wrap td {
        padding: 4px 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .table-wrap td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #888;
        font-size: 0.8rem;
        flex-shrink: 0;
        margin-right: 10px;
    }

    .btn-large {
        width: 100%;
    }

    .form-control-large {
        font-size: 1.2rem;
        padding: 15px;
    }

    /* 扫码框自适应缩小 */
    .scan-box {
        width: 160px !important;
        height: 160px !important;
    }
    .scan-hint {
        bottom: calc(50% - 80px - 40px) !important;
    }

    /* 统计网格改二列 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .stat-card {
        padding: 12px 8px;
    }
    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    /* Tab 按钮全宽 */
    .tab-btn {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    /* 操作栏紧凑 */
    .operator-bar {
        padding: 8px 12px;
    }
}
