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

body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
background: #f5f7fa;
color: #333;
}

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

h1 {
text-align: center;
margin-bottom: 30px;
color: #2c3e50;
}

.tabs {
display: flex;
border-bottom: 2px solid #e1e8ed;
margin-bottom: 20px;
}

.tab {
padding: 12px 24px;
cursor: pointer;
border: none;
background: none;
font-size: 16px;
color: #666;
transition: all 0.3s;
}

.tab:hover {
color: #3498db;
}

.tab.active {
color: #3498db;
border-bottom: 2px solid #3498db;
margin-bottom: -2px;
}

.tab-content {
display: none;
}

.tab-content.active {
display: block;
}

.card {
background: white;
border-radius: 8px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.form-group label {
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 8px;
font-weight: 600;
color: #2c3e50;
font-size: 14px;
}

.form-group label .label-icon {
width: 20px;
height: 20px;
display: inline-flex;
align-items: center;
justify-content: center;
background: #eef2f7;
border-radius: 4px;
font-size: 12px;
}

.form-group .form-hint {
font-size: 12px;
color: #999;
margin-top: 4px;
font-weight: 400;
}

.form-control {
width: 100%;
padding: 10px 14px;
border: 1.5px solid #e1e8ed;
border-radius: 8px;
font-size: 14px;
transition: all 0.2s;
background: #fafbfc;
}

.form-control:focus {
outline: none;
border-color: #3498db;
background: white;
box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

select {
background: #fafbfc;
cursor: pointer;
}

select[multiple] {
padding: 6px;
}

select[multiple] option {
padding: 8px 12px;
border-radius: 4px;
margin-bottom: 2px;
cursor: pointer;
transition: background 0.15s;
}

select[multiple] option:hover {
background: #eef2f7;
}

select[multiple] option:checked {
background: #3498db;
color: white;
}

.btn {
padding: 8px 20px;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.2s;
}

.btn-primary {
background: #3498db;
color: white;
}

.btn-primary:hover {
background: #2980b9;
}

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

.btn-success:hover {
background: #229954;
}

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

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

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

.btn-warning:hover {
background: #d35400;
}

.btn-secondary {
background: #eef2f7;
color: #555;
border: 1px solid #e1e8ed;
}

.btn-secondary:hover {
background: #dde4ed;
color: #333;
}

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

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

th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #e1e8ed;
}

th {
background: #f8f9fa;
font-weight: 600;
color: #555;
}

tr:hover {
background: #f8f9fa;
}

.checkbox-group {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 6px;
max-height: 240px;
overflow-y: auto;
padding: 12px;
border: 1.5px solid #e1e8ed;
border-radius: 8px;
background: #fafbfc;
}

.checkbox-group::-webkit-scrollbar {
width: 6px;
}

.checkbox-group::-webkit-scrollbar-track {
background: transparent;
}

.checkbox-group::-webkit-scrollbar-thumb {
background: #ccc;
border-radius: 3px;
}

.checkbox-group::-webkit-scrollbar-thumb:hover {
background: #aaa;
}

.selected-fields-order {
display: flex;
flex-direction: column;
gap: 4px;
padding: 12px;
border: 1.5px dashed #4a90e2;
border-radius: 8px;
background: #f8fbff;
min-height: 40px;
}

.selected-field-item {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 10px;
background: #f0f9ff;
border: 1px solid #bae6fd;
border-radius: 4px;
font-size: 12px;
}

.selected-field-item .field-index {
color: #0284c7;
font-weight: 600;
min-width: 24px;
}

.selected-field-item .field-name {
flex: 1;
font-size: 13px;
color: #333;
}

.selected-field-item .field-actions {
display: flex;
gap: 4px;
}

.selected-field-item .btn-move {
width: 20px;
height: 20px;
border: 1px solid #cbd5e1;
background: white;
border-radius: 3px;
cursor: pointer;
font-size: 12px;
line-height: 1;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
}

.selected-field-item .btn-move:hover:not(:disabled) {
background: #e2e8f0;
border-color: #94a3b8;
}

.selected-field-item .btn-move:disabled {
opacity: 0.4;
cursor: not-allowed;
}
}

.selected-field-item .field-index {
font-size: 11px;
color: #999;
background: #f0f0f0;
padding: 2px 6px;
border-radius: 10px;
}

.checkbox-item {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 10px;
border-radius: 6px;
cursor: pointer;
transition: all 0.15s;
user-select: none;
}

.checkbox-item:hover {
background: #eef2f7;
}

.checkbox-item.checked {
background: #e8f4fd;
border: 1px solid #bee5eb;
}

.checkbox-item.required-field {
background: #fff3cd;
border: 1px solid #ffc107;
}

.checkbox-item.required-field:hover {
background: #fff3cd;
cursor: default;
}

.required-badge {
display: inline-block;
padding: 2px 6px;
background: #ffc107;
color: #000;
border-radius: 3px;
font-size: 11px;
font-weight: 500;
margin-left: 4px;
}

.checkbox-item input[type="checkbox"] {
width: 16px;
height: 16px;
accent-color: #3498db;
cursor: pointer;
flex-shrink: 0;
}

.checkbox-item label {
font-size: 13px;
color: #444;
cursor: pointer;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.status-badge {
display: inline-block;
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
}

.status-active {
background: #d4edda;
color: #155724;
}

.status-inactive {
background: #f8d7da;
color: #721c24;
}

.alert {
padding: 12px 16px;
border-radius: 4px;
margin-bottom: 15px;
}

.alert-success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}

.alert-error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}

.alert-info {
background: #d1ecf1;
color: #0c5460;
border: 1px solid #bee5eb;
}

.loading {
text-align: center;
padding: 20px;
color: #666;
}

.empty {
text-align: center;
padding: 40px;
color: #999;
}

.action-buttons {
display: flex;
gap: 5px;
}

.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.4);
z-index: 1000;
backdrop-filter: blur(2px);
}

.modal.active {
display: flex;
align-items: center;
justify-content: center;
animation: fadeIn 0.2s ease;
}

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

.modal-content {
background: white;
border-radius: 16px;
padding: 0;
max-width: 860px;
width: 92%;
max-height: 90vh;
overflow-y: auto;
box-shadow: 0 20px 60px rgba(0,0,0,0.15);
animation: slideUp 0.25s ease;
}

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

.modal-content::-webkit-scrollbar {
width: 6px;
}

.modal-content::-webkit-scrollbar-track {
background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
background: #ddd;
border-radius: 3px;
}

.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 28px;
border-bottom: 1px solid #eef2f7;
background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
border-radius: 16px 16px 0 0;
position: sticky;
top: 0;
z-index: 10;
}

.modal-title {
font-size: 18px;
font-weight: 700;
color: #2c3e50;
display: flex;
align-items: center;
gap: 8px;
}

.modal-title::before {
content: '';
display: inline-block;
width: 4px;
height: 20px;
background: #3498db;
border-radius: 2px;
}

.close-btn {
background: none;
border: none;
font-size: 22px;
cursor: pointer;
color: #999;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 8px;
transition: all 0.2s;
}

.close-btn:hover {
background: #eef2f7;
color: #333;
}

.modal-body {
padding: 24px 28px;
}

.modal-footer {
display: flex;
gap: 10px;
justify-content: flex-end;
padding: 16px 28px;
border-top: 1px solid #eef2f7;
background: #fafbfc;
border-radius: 0 0 16px 16px;
}

.form-section {
margin-bottom: 24px;
padding-bottom: 20px;
border-bottom: 1px dashed #eef2f7;
}

.form-section:last-child {
border-bottom: none;
margin-bottom: 0;
padding-bottom: 0;
}

.form-section-title {
font-size: 13px;
font-weight: 600;
color: #3498db;
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 14px;
display: flex;
align-items: center;
gap: 8px;
}

.form-section-title .section-num {
width: 22px;
height: 22px;
display: inline-flex;
align-items: center;
justify-content: center;
background: #3498db;
color: white;
border-radius: 50%;
font-size: 12px;
font-weight: 700;
}

/* 时段编辑器样式 */
.time-period-editor {
background: #f8f9fa;
border-radius: 10px;
padding: 16px;
border: 1px solid #e9ecef;
}

.time-period-header {
margin-bottom: 12px;
}

.time-period-hint {
font-size: 12px;
color: #6c757d;
}

.time-period-tools {
display: flex;
gap: 8px;
margin-bottom: 12px;
flex-wrap: wrap;
}

.tp-tool-btn {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 6px 12px;
border: 1px solid #dee2e6;
border-radius: 6px;
background: white;
font-size: 12px;
cursor: pointer;
transition: all 0.2s;
}

.tp-tool-btn:hover {
background: #f8f9fa;
border-color: #adb5bd;
}

.tp-tool-btn.active {
background: #3498db;
color: white;
border-color: #3498db;
}

.tp-tool-btn.tp-sharp { background: #e74c3c; color: white; border-color: #e74c3c; }
.tp-tool-btn.tp-peak { background: #f39c12; color: white; border-color: #f39c12; }
.tp-tool-btn.tp-flat { background: #27ae60; color: white; border-color: #27ae60; }
.tp-tool-btn.tp-valley { background: #3498db; color: white; border-color: #3498db; }

.time-period-grid-wrapper {
overflow-x: auto;
margin-bottom: 12px;
}

.tp-hours-header {
display: flex;
gap: 2px;
margin-bottom: 4px;
}

.tp-label-col {
width: 50px;
flex-shrink: 0;
}

.tp-hours-row {
display: flex;
gap: 2px;
flex: 1;
}

.tp-hour-label {
width: 28px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
font-size: 10px;
color: #6c757d;
flex-shrink: 0;
}

.tp-period-rows {
display: flex;
flex-direction: column;
gap: 4px;
}

.tp-period-row {
display: flex;
gap: 2px;
align-items: center;
}

.tp-period-label {
width: 50px;
flex-shrink: 0;
font-size: 12px;
font-weight: 600;
padding: 4px 8px;
border-radius: 4px;
text-align: center;
}

.tp-period-label.sharp { background: #e74c3c; color: white; }
.tp-period-label.peak { background: #f39c12; color: white; }
.tp-period-label.flat { background: #27ae60; color: white; }
.tp-period-label.valley { background: #3498db; color: white; }

.tp-period-cells {
display: flex;
gap: 2px;
flex: 1;
}

.tp-cell {
width: 28px;
height: 28px;
border: 1px solid #dee2e6;
border-radius: 4px;
background: white;
cursor: pointer;
transition: all 0.15s;
display: flex;
align-items: center;
justify-content: center;
font-size: 10px;
flex-shrink: 0;
}

.tp-cell:hover {
border-color: #adb5bd;
transform: scale(1.05);
}

.tp-cell.sharp { background: #e74c3c; border-color: #e74c3c; color: white; }
.tp-cell.peak { background: #f39c12; border-color: #f39c12; color: white; }
.tp-cell.flat { background: #27ae60; border-color: #27ae60; color: white; }
.tp-cell.valley { background: #3498db; border-color: #3498db; color: white; }

.time-period-summary {
font-size: 12px;
color: #495057;
padding: 8px 12px;
background: white;
border-radius: 6px;
border: 1px solid #e9ecef;
}

.time-period-summary span {
margin-right: 12px;
}

.time-period-summary .tp-count {
font-weight: 600;
}

.entity-select-wrapper {
position: relative;
}

.entity-select-wrapper .selected-count {
position: absolute;
top: -8px;
right: 12px;
background: #3498db;
color: white;
font-size: 11px;
padding: 2px 8px;
border-radius: 10px;
font-weight: 600;
z-index: 1;
}

.pagination {
display: flex;
justify-content: center;
align-items: center;
gap: 10px;
margin-top: 20px;
}

.pagination button {
padding: 6px 12px;
border: 1px solid #ddd;
background: white;
cursor: pointer;
border-radius: 4px;
}

.pagination button:hover:not(:disabled) {
background: #f0f0f0;
}

.pagination button:disabled {
cursor: not-allowed;
opacity: 0.5;
}

.pagination span {
color: #666;
}
