:root {
    --bg-color: #f4f7fa;
    --text-primary: #333;
    --text-muted: #6b7280;
    --bg-card: #ffffff;
    --border: #e5e7eb;
    
    --primary: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --border-radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
}

.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-content p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.nav-tabs {
    display: flex;
    gap: 1rem;
}

.tab {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

/* Scheduler Widget */
.scheduler-card {
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scheduler-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.scheduler-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.scheduler-body {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.tag.is-active {
    background: var(--success);
    color: white;
    width: max-content;
}

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

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-top: 4px solid var(--border);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.stat-card.primary { border-top-color: var(--primary); }
.stat-card.success { border-top-color: var(--success); }
.stat-card.danger { border-top-color: var(--danger); }
.stat-card.warning { border-top-color: var(--warning); }

/* Charts */
.chart-container {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    height: 400px;
    width: 100%;
}

.chart-container h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

/* Controls */
.controls {
    margin-bottom: 1rem;
}

#search-listings {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    outline: none;
    transition: border-color 0.2s;
}

#search-listings:focus {
    border-color: var(--primary);
}

/* Tables */
.table-wrapper {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

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

.data-table a {
    color: var(--primary);
    text-decoration: none;
}

.data-table a:hover {
    text-decoration: underline;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e0e7ff;
    color: #4f46e5;
}

/* Timeline/Changes */
.timeline {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}

.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.5rem;
    border-left: 2px solid var(--border);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
}

.timeline-item:last-child {
    border-left-color: transparent;
}

.timeline-item h4 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.timeline-item .meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.change-new h4 { color: var(--success); }
.change-new::before { background: var(--success); }

.change-removed h4 { color: var(--danger); text-decoration: line-through; }
.change-removed::before { background: var(--danger); }

.change-price_changed h4 { color: var(--warning); }
.change-price_changed::before { background: var(--warning); }