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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    height: 100vh;
}

.app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: #1a1a2e;
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #2d2d44;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.nav-tabs {
    list-style: none;
    padding: 10px 0;
}

.nav-tab {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    border-left: 3px solid transparent;
}

.nav-tab:hover {
    background: #2d2d44;
}

.nav-tab.active {
    background: #2d2d44;
    border-left-color: #4a9eff;
    font-weight: 600;
}

/* Content */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.tab-panel {
    display: none;
}

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

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

.panel-header h1 {
    font-size: 24px;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.85;
}

.btn-primary {
    background: #4a9eff;
    color: #fff;
}

.btn-success {
    background: #34c759;
    color: #fff;
}

.btn-danger {
    background: #ff3b30;
    color: #fff;
}

.btn-secondary {
    background: #8e8e93;
    color: #fff;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    margin-bottom: 10px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

.card .meta {
    color: #666;
    font-size: 13px;
    margin-bottom: 12px;
}

.card .stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.card .stat {
    text-align: center;
}

.card .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #4a9eff;
}

.card .stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

.calendar-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 8px;
}

.calendar-available {
    background: #e8f5e9;
    color: #2e7d32;
}

.calendar-busy {
    background: #fff3e0;
    color: #e65100;
}

.calendar-unknown {
    background: #f5f5f5;
    color: #757575;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.settings-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.settings-section h2 {
    font-size: 16px;
    margin-bottom: 12px;
}

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

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.modal-header h2 {
    font-size: 18px;
}

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

.modal-body {
    padding: 20px;
}

/* Forms */
.form-group {
    margin-bottom: 14px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    height: 80px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4a9eff;
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

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

/* State badge */
.state-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: #e3f2fd;
    color: #1565c0;
}

.state-badge.terminal {
    background: #e8f5e9;
    color: #2e7d32;
}

/* History timeline */
.timeline {
    margin: 16px 0;
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-left: 2px solid #ddd;
    padding-left: 16px;
    margin-left: 8px;
    position: relative;
}

.timeline-item::before {
    content: '';
    width: 10px;
    height: 10px;
    background: #4a9eff;
    border-radius: 50%;
    position: absolute;
    left: -6px;
    top: 12px;
}

.timeline-item .time {
    color: #888;
    font-size: 12px;
    white-space: nowrap;
    min-width: 140px;
}

.timeline-item .description {
    font-size: 13px;
}

/* Filters */
.filters {
    display: flex;
    gap: 8px;
}

.filters select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        width: 180px;
    }
}
