:root {
    --bg: #0f172a;
    --card: #1e293b;
    --border: #334155;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --good: #4ade80;
    --warning: #fbbf24;
    --bad: #f87171;
}

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

/* Skeleton loader */
.skeleton-loader {
    color: var(--muted);
    font-size: 0.8rem;
    padding: 1.5rem 0;
    text-align: center;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

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

.private-badge {
    background: var(--bad);
    color: var(--bg);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    vertical-align: middle;
    letter-spacing: 0.05em;
}
.subtitle { color: var(--muted); margin-top: 0.25rem; }
h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--accent); }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}

.card.wide {
    grid-column: 1 / -1;
}

.big-number {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    margin: 0.5rem 0;
}

.big-number.urgent { color: var(--bad); }
.big-number.warning { color: var(--warning); }

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

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

td, th {
    padding: 0.35rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

th { color: var(--muted); font-weight: 500; }

.money { text-align: right; font-variant-numeric: tabular-nums; }
.expense { color: var(--bad); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warning { color: var(--warning); }
.muted { color: var(--muted); }
.source { color: var(--muted); font-size: 0.75rem; }
.note { color: var(--muted); font-size: 0.75rem; margin-top: 0.5rem; }

.total-row td {
    border-top: 2px solid var(--border);
    font-weight: 600;
    padding-top: 0.5rem;
}

.rate-display { text-align: center; margin-bottom: 1rem; }
.rate-compare { font-size: 0.875rem; }

.calc-input {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calc-input input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 1rem;
    width: 160px;
}

.toggle-btn {
    background: var(--bg);
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
}

.toggle-btn.done {
    background: var(--good);
    color: var(--bg);
    border-color: var(--good);
}

.toggle-btn:hover { opacity: 0.8; }

tr.done td { opacity: 0.5; text-decoration: line-through; }
tr.overdue td { color: var(--bad); }

.listing-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.listing-links a {
    background: var(--accent);
    color: var(--bg);
    padding: 0.4rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
}

.listing-links a:hover { opacity: 0.85; }

/* Rate Chart */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.chart-header h2 { margin-bottom: 0; }

.chart-controls {
    display: flex;
    gap: 0.25rem;
}

.period-btn {
    background: var(--bg);
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
}

.period-btn.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.period-btn:hover { opacity: 0.85; }

.chart-container {
    position: relative;
    height: 280px;
}

/* Listings */
.listings-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.listing-count {
    font-weight: 600;
    font-size: 1.1rem;
}

.listing-meta {
    color: var(--muted);
    font-size: 0.75rem;
    flex: 1;
}

.refresh-btn {
    background: var(--bg);
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
}

.refresh-btn:hover { background: var(--accent); color: var(--bg); }

.htmx-indicator { display: none; color: var(--muted); font-size: 0.75rem; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline; }

.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.listing-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}

.listing-card:hover {
    border-color: var(--accent);
}

.listing-photo {
    height: 160px;
    background-size: cover;
    background-position: center;
    background-color: var(--border);
}

.listing-photo.no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.8rem;
}

.listing-info {
    padding: 0.75rem;
}

.listing-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--good);
    margin-bottom: 0.25rem;
}

.listing-address {
    font-weight: 500;
    font-size: 0.9rem;
}

.listing-city {
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
}

.listing-details {
    font-size: 0.8rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.listing-meta-row {
    display: flex;
    gap: 0.75rem;
    font-size: 0.7rem;
    color: var(--muted);
}

.listing-style {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 0.25rem;
    text-transform: capitalize;
}

table.compact td {
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
}

/* Timeline */
.timeline-table { font-size: 0.85rem; }

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.timeline-header h2 { margin-bottom: 0; }

.timeline-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.cat-col { width: 12px; padding-right: 0; }
.date-col { white-space: nowrap; width: 100px; }
.note-col { color: var(--muted); font-size: 0.75rem; max-width: 300px; }
.days-col { white-space: nowrap; text-align: right; width: 80px; }

.cat-dot, .legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.house-dot { background: var(--accent); }
.legal-dot { background: #c084fc; }
.move-dot { background: var(--warning); }

.legal-heading { color: #c084fc; }
.move-heading { color: var(--warning); }

.tbd {
    color: var(--muted);
    font-style: italic;
    font-size: 0.8rem;
}

footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.75rem;
}
