:root {
    color-scheme: light;
    --bg: #f4f5f7;
    --ink: #1c1f26;
    --accent: #1b6ef3;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

a { color: var(--accent); }

button {
    font: inherit;
    cursor: pointer;
}

/* ==========================================================
   APP SHELL
========================================================== */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 20px;
    background: #111827;
    color: white;
}

    .topbar .brand {
        color: white;
        font-weight: 700;
        text-decoration: none;
        margin-right: auto;
    }

    .topbar nav {
        display: flex;
        gap: 16px;
    }

        .topbar nav a {
            color: #cbd5e1;
            text-decoration: none;
            padding: 6px 4px;
        }

            .topbar nav a.active {
                color: white;
                border-bottom: 2px solid var(--accent);
            }

.logout-form button {
    background: transparent;
    border: 1px solid #475569;
    color: #cbd5e1;
    border-radius: 6px;
    padding: 6px 12px;
}

.working-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fef3c7;
    color: #78350f;
    padding: 8px 20px;
    font-size: 13px;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #78350f;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.app-content {
    flex: 1;
    padding: 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================
   LOGIN
========================================================== */
.login-page {
    max-width: 360px;
    margin: 80px auto;
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

    .login-page label {
        display: block;
        margin-top: 12px;
        font-size: 13px;
        color: #555;
    }

    .login-page input {
        display: block;
        width: 100%;
        padding: 8px;
        margin-top: 4px;
        border: 1px solid #ccc;
        border-radius: 6px;
    }

    .login-page button {
        margin-top: 18px;
        width: 100%;
        padding: 10px;
        background: var(--accent);
        color: white;
        border: none;
        border-radius: 6px;
    }

.login-error {
    color: #b91c1c;
    font-size: 13px;
    margin-top: 10px;
}

/* ==========================================================
   DASHBOARD TABLE
========================================================== */
table.property-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

    table.property-table th, table.property-table td {
        text-align: left;
        padding: 10px 12px;
        border-bottom: 1px solid #eee;
    }

    table.property-table th {
        background: #f8fafc;
        cursor: pointer;
        user-select: none;
    }

    table.property-table tbody tr:hover {
        background: #f8fafc;
    }

.thumb {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: #e5e7eb;
}

.link-button {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0;
    text-decoration: underline;
}

/* ==========================================================
   CARDS / GRID (ported from the embedded RealEstate site)
========================================================== */
.layout {
    display: flex;
    gap: 20px;
}

.sidebar {
    width: 250px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    height: fit-content;
}

    .sidebar label {
        display: block;
        margin-top: 10px;
        font-size: 13px;
        color: #555;
    }

    .sidebar select, .sidebar input[type="range"] {
        width: 100%;
    }

.main { flex: 1; }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.card {
    position: relative;
    background: white;
    padding: 0;
    border-radius: 12px;
    border: 1px solid #ddd;
    transition: 0.2s;
    overflow: hidden;
}

    .card:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    }

.card-image {
    position: relative;
    height: 160px;
    background: #e5e7eb;
}

    .card-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.community {
    color: #777;
    font-size: 13px;
    margin: 10px 0 15px;
}

.comparison {
    margin-top: 30px;
    background: white;
    padding: 15px;
    border-radius: 8px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.comparison-card {
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 6px;
    background: #fafafa;
}

.comparison-empty {
    margin-top: 20px;
    color: #777;
}

.yes { color: green; }
.no { color: red; }
.unknown { color: gray; }

/* TOP ROW / DETAIL */
.top-row {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.price { font-size: 24px; font-weight: bold; }

.score-box {
    background: #111;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.section h3 {
    margin-top: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
}

.kv, .score-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.score-total {
    margin-top: 10px;
    font-weight: bold;
    font-size: 18px;
}

.modal-footer {
    margin-top: 20px;
    text-align: center;
}

.zillow-link {
    display: inline-block;
    padding: 10px 16px;
    background: #006aff;
    color: white;
    border-radius: 6px;
    text-decoration: none;
}

.badge-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 999px;
    color: white;
    font-weight: 600;
}

.badge.dream { background: #9333ea; }
.badge.buy { background: #16a34a; }
.badge.lake { background: #0284c7; }
.badge.family { background: #f59e0b; }
.badge.safe { background: #0ea5e9; }
.badge.waterfront { background: #2563eb; }
.badge.hartwell { background: #1d4ed8; }

.favorite {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 18px;
}

.card-body { padding: 12px 14px; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.score {
    background: #111;
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 13px;
}

.meta-row {
    display: flex;
    gap: 10px;
    font-size: 13px;
    color: #555;
    margin-top: 4px;
}

.description {
    font-size: 12px;
    color: #777;
    margin-top: 6px;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 0 14px 14px;
}

.actions-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.details-btn, button.primary {
    background: #111;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
}

    .details-btn:hover, button.primary:hover {
        background: #333;
    }

.property-card {
    display: flex;
    gap: 18px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 18px;
}

.property-image {
    width: 260px;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    background: #e5e7eb;
}

.property-body { flex: 1; }

.ai-score {
    margin-top: 10px;
    font-weight: bold;
    color: #1b6ef3;
}

textarea, input[type="text"] {
    font: inherit;
}

.field-row {
    margin-bottom: 16px;
}

    .field-row textarea {
        display: block;
        width: 100%;
        min-height: 120px;
        margin-top: 8px;
        padding: 8px;
        border: 1px solid #ccc;
        border-radius: 6px;
    }

.button-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.error-banner {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.empty-state {
    color: #777;
    padding: 40px 0;
    text-align: center;
}

.image-upload img {
    display: block;
    width: 100%;
    max-width: 320px;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
}
/* Workshop catalog */
.workshop-summary { display:flex; flex-wrap:wrap; align-items:center; gap:1.3rem; margin:1rem 0; }
.workshop-filters { display:flex; flex-wrap:wrap; gap:1rem; padding:1.2rem; background:#eef3f0; border-radius:10px; align-items:end; }
.workshop-filters label, .workshop-field { display:flex; flex-direction:column; gap:.35rem; }
.workshop-filters input, .workshop-filters select, .workshop-field select, .workshop-field textarea { padding:.6rem; border:1px solid #b5c7bd; border-radius:5px; font:inherit; }
.workshop-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr)); gap:1.2rem; }
.workshop-card { background:white; border:1px solid #d6e0da; border-radius:12px; padding:1.4rem; }
.workshop-card h2 { font-size:1.2rem; margin:.5rem 0; }
.workshop-card a { color:#225e48; }
.workshop-price { font-size:1.5rem; color:#225e48; }
.workshop-card dl, .section dl { display:grid; grid-template-columns:1fr 1fr; gap:.5rem; }
.workshop-card dd, .section dd { margin:0; }
.workshop-note { display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden; color:#43554b; }
.badge { padding:.25rem .6rem; background:#e8f0ea; border-radius:20px; }
.muted { color:#617067; font-size:.9rem; }
.workshop-field { margin:1rem 0; }
.workshop-history { border-top:1px solid #dde4df; padding:.7rem 0; }
.preserve-lines { white-space:pre-wrap; overflow-wrap:anywhere; }
.section a { overflow-wrap:anywhere; }
