:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-gray: #f5f7fa;
    --dark-gray: #34495e;
    --border-color: #e1e4e8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 25px 0;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.header-content {
    padding: 0 25px;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.refresh-link {
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.refresh-link:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* 搜索区域整体布局 - 单行布局 */
.search-area {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 15px;
}

/* 搜索单行布局 */
.search-single-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    justify-content: center;
}

/* 搜索框样式 - 缩短 */
.search-box {
    flex: 0 1 250px;
    min-width: 200px;
    max-width: 300px;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.search-box:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    outline: none;
    transform: translateY(-1px);
}

/* 按钮基础样式 - 紧凑版本 */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: auto;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 3px 8px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #2573a7);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(52, 152, 219, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    box-shadow: 0 3px 8px rgba(46, 204, 113, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #27ae60, #219653);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(46, 204, 113, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    box-shadow: 0 3px 8px rgba(23, 162, 184, 0.3);
}

.btn-info:hover {
    background: linear-gradient(135deg, #138496, #117a8b);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(23, 162, 184, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    box-shadow: 0 3px 8px rgba(243, 156, 18, 0.3);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(243, 156, 18, 0.4);
}

.btn-warning:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
    box-shadow: 0 3px 8px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268, #495057);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(108, 117, 125, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    box-shadow: 0 3px 8px rgba(231, 76, 60, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(231, 76, 60, 0.4);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    min-width: auto;
}

.edit-btn {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-btn:hover {
    background: linear-gradient(135deg, #138496, #117a8b);
    transform: translateY(-1px);
}
/* 搜索历史记录切换按钮 - 紧凑版本 */
.search-history-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 13px;
    color: white;
    white-space: nowrap;
}

.search-history-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.search-history-toggle.active {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 3px 8px rgba(255, 255, 255, 0.3);
}

.search-history-toggle input {
    display: none;
}

.toggle-icon {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.search-history-toggle.active .toggle-icon {
    transform: scale(1.1);
}

/* 全部展开按钮 - 紧凑版本 */
.expand-all-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(155, 89, 182, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.expand-all-btn:hover {
    background: linear-gradient(135deg, #8e44ad, #7d3c98);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(155, 89, 182, 0.4);
}

.expand-all-btn:active {
    transform: translateY(0);
}

/* 筛选器样式 */
.filters {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 180px;
}

.filter-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark-gray);
    font-size: 14px;
}

.filter-select, .filter-input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.filter-select:focus, .filter-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

/* 列表容器 */
.list-container {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

/* 调整列表头部和项目的网格列 */
.list-header {
    display: grid;
    grid-template-columns: 50px 150px 120px 120px 60px 60px 120px 1fr 80px;
    background-color: var(--secondary-color);
    color: white;
    font-weight: 600;
    padding: 15px 20px;
    gap: 10px;
}

.list-item {
    display: grid;
    grid-template-columns: 50px 150px 120px 120px 60px 60px 120px 1fr 80px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    gap: 10px;
}

.list-item:hover {
    background-color: var(--light-gray);
}

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

.list-item.active {
    background-color: rgba(52, 152, 219, 0.08);
    border-left: 4px solid #3498db;
}

.list-header > div:nth-child(-n+8) {
    text-align: center;
}

.list-item > div:nth-child(-n+8) {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-header > div:nth-child(9) {
    text-align: left;
}

.list-item > div:nth-child(9) {
    text-align: left;
    justify-content: flex-start;
}

/* 话费查询列表的特殊样式（10列） */
.list-header.with-expense {
    grid-template-columns: 50px 140px 100px 100px 60px 60px 100px 90px 90px 1fr 80px;
}

.list-item.with-expense {
    grid-template-columns: 50px 140px 100px 100px 60px 60px 100px 90px 90px 1fr 80px;
}

.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.status-yes {
    background-color: rgba(46, 204, 113, 0.2);
    color: var(--success-color);
}

.status-no {
    background-color: rgba(231, 76, 60, 0.2);
    color: var(--danger-color);
}

/* 历史记录容器 */
.history-container {
    grid-column: 1 / -1;
    background-color: #f8f9fa;
    border-radius: 5px;
    margin-top: 15px;
    padding: 0;
    display: none !important;
}

.history-container.active {
    display: block !important;
}

.list-item.active .history-container {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
}

/* 历史记录表格样式 */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 0;
    font-weight: 600;
    font-size: 14px;
    color: var(--dark-gray);
    background-color: #e9ecef;
    border-radius: 4px 4px 0 0;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #eaecef;
    font-size: 13px;
    line-height: 1.5;
    transition: background-color 0.2s ease;
}

.history-item:hover {
    background-color: #f8f9fa;
}

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

/* 历史记录列宽分配 */
.history-header > div:nth-child(1),
.history-item > div:nth-child(1) {
    width: 60px;
    text-align: center;
    flex-shrink: 0;
}

.history-header > div:nth-child(2),
.history-item > div:nth-child(2) {
    width: 120px;
    text-align: left;
    flex-shrink: 0;
}

.history-header > div:nth-child(3),
.history-item > div:nth-child(3) {
    width: 120px;
    text-align: center;
    flex-shrink: 0;
}

.history-header > div:nth-child(4),
.history-item > div:nth-child(4) {
    width: 120px;
    text-align: center;
    flex-shrink: 0;
}

.history-header > div:nth-child(5),
.history-item > div:nth-child(5) {
    width: 100px;
    text-align: center;
    flex-shrink: 0;
}

.history-header > div:nth-child(6),
.history-item > div:nth-child(6) {
    width: 120px;
    text-align: left;
    flex-shrink: 0;
}

.history-header > div:nth-child(7),
.history-item > div:nth-child(7) {
    flex: 1;
    text-align: left;
    min-width: 200px;
}

/* 历史记录中的状态徽章 */
.history-item .status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--dark-gray);
}

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

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--dark-gray);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--dark-gray);
}

.number-exists {
    border-color: var(--success-color) !important;
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2) !important;
}

.number-not-exists {
    border-color: var(--warning-color) !important;
    box-shadow: 0 0 0 2px rgba(243, 156, 18, 0.2) !important;
}

.expense-amount {
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.expense-amount.has-expense {
    color: var(--success-color);
}

.expense-amount.no-expense {
    color: var(--dark-gray);
}

/* 超支金额样式 - 添加可点击样式 */
.over-budget {
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.over-budget:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.over-budget.yes {
    background-color: rgba(231, 76, 60, 0.2);
    color: var(--danger-color);
}

.over-budget.no {
    background-color: rgba(46, 204, 113, 0.2);
    color: var(--success-color);
}

/* 排序指示器 */
.sort-indicator {
    margin-left: 5px;
    font-size: 10px;
}

.form-info {
    padding: 8px 12px;
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 5px;
    color: #0066cc;
    font-size: 14px;
    white-space: nowrap;
}

/* 加载动画 */
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 历史记录加载状态 */
.history-container .loading {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    margin: 10px;
}

/* 消息提示 */
.message-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: 600;
    z-index: 1001;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .container {
        padding: 15px;
    }
    
    .search-single-row {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: flex-start;
    }
    
    .search-box {
        flex: 1;
        min-width: 180px;
        max-width: 250px;
    }
    
    .list-header, .list-item {
        grid-template-columns: 40px 120px 100px 100px 50px 50px 100px 1fr;
        gap: 8px;
        font-size: 13px;
    }
    
    .list-header.with-expense, 
    .list-item.with-expense {
        grid-template-columns: 40px 120px 90px 90px 50px 50px 90px 80px 80px 1fr;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 15px;
    }
    
    .search-area {
        padding: 12px 15px;
    }
    
    .search-single-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .search-box {
        min-width: 100%;
        max-width: 100%;
        order: -1;
    }
    
    .btn, .search-history-toggle, .expand-all-btn {
        width: 100%;
        justify-content: center;
    }
    
    .list-header {
        display: none;
    }
    
    .list-item {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 20px;
        border-bottom: 1px solid var(--border-color);
        white-space: normal;
    }
    
    .mobile-field {
        display: flex;
        justify-content: space-between;
    }
    
    .mobile-label {
        font-weight: 600;
        color: var(--dark-gray);
    }
    
    .history-container {
        margin-top: 10px;
        padding: 10px;
        white-space: normal;
    }
    
    .history-header {
        display: none;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 12px;
        border: 1px solid var(--border-color);
        border-radius: 5px;
        margin-bottom: 8px;
    }
    
    .history-item > div {
        width: 100% !important;
        display: flex;
        justify-content: space-between;
    }
    
    .history-item > div::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--dark-gray);
        min-width: 80px;
    }
    
    .history-item > div:nth-child(1)::before { content: "序号:"; }
    .history-item > div:nth-child(2)::before { content: "使用人:"; }
    .history-item > div:nth-child(3)::before { content: "领取时间:"; }
    .history-item > div:nth-child(4)::before { content: "归还时间:"; }
    .history-item > div:nth-child(5)::before { content: "是否仅卡:"; }
    .history-item > div:nth-child(6)::before { content: "所属部门:"; }
    .history-item > div:nth-child(7)::before { content: "备注信息:"; }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 20px 0;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .search-area {
        padding: 10px;
    }
    
    .filters {
        padding: 15px;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .btn, .search-history-toggle, .expand-all-btn {
        font-size: 12px;
        padding: 8px 10px;
    }
}