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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
    background: #fafafa;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

header h1 { font-size: 1.5rem; }

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

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #6b7280;
}

tr:hover { background: #f3f4f6; }

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

.card h2 { margin-bottom: 1rem; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.detail-item label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #6b7280;
    font-weight: 600;
}

.detail-item span {
    font-size: 1.1rem;
}

.rating-form { display: flex; gap: 0.5rem; align-items: center; }

.rating-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s;
}

.rating-btn:hover { border-color: #2563eb; background: #eff6ff; }
.rating-btn.active { border-color: #2563eb; background: #2563eb; color: #fff; }

.comment {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.comment:last-child { border-bottom: none; }

.comment .meta {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.comment-form { margin-top: 1rem; }

.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 80px;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

.btn:hover { background: #1d4ed8; }

.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }

.empty { color: #9ca3af; font-style: italic; padding: 2rem; text-align: center; }

.realtor-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    background: #dcfce7;
    color: #166534;
}

.back-link { margin-bottom: 1rem; display: inline-block; }

td.price { font-weight: 600; }
td.rating { font-size: 1.1rem; }

/* Dark mode */
[data-theme="dark"], [data-theme="dark"] body {
    background: #111827; color: #e5e7eb;
}
[data-theme="dark"] a { color: #60a5fa; }
[data-theme="dark"] header { border-bottom-color: #374151; }
[data-theme="dark"] table { background: #1f2937; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
[data-theme="dark"] th { background: #1a2332; color: #9ca3af; border-bottom-color: #374151; }
[data-theme="dark"] td { border-bottom-color: #374151; }
[data-theme="dark"] tr:hover { background: #263040; }
[data-theme="dark"] .card { background: #1f2937; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
[data-theme="dark"] .detail-item label { color: #9ca3af; }
[data-theme="dark"] .rating-btn { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }
[data-theme="dark"] .rating-btn:hover { border-color: #60a5fa; background: #1e3a5f; }
[data-theme="dark"] .rating-btn.active { border-color: #60a5fa; background: #2563eb; color: #fff; }
[data-theme="dark"] .comment { border-bottom-color: #374151; }
[data-theme="dark"] .comment .meta { color: #9ca3af; }
[data-theme="dark"] .comment-form textarea { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }
[data-theme="dark"] .comment-form textarea:focus { border-color: #60a5fa; box-shadow: 0 0 0 2px rgba(96,165,250,0.2); }
[data-theme="dark"] .empty { color: #6b7280; }
[data-theme="dark"] .flash { background: #064e3b; color: #6ee7b7; }

.theme-toggle {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}
[data-theme="dark"] .theme-toggle { border-color: #4b5563; }

/* Login page */
.login-card { max-width: 400px; margin: 4rem auto; }
.login-info { color: #6b7280; margin-bottom: 1rem; font-size: 0.95rem; }
.login-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.login-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}
.login-btn { width: 100%; text-align: center; }
.flash-error { background: #fef2f2; color: #991b1b; }
[data-theme="dark"] .login-input { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }
[data-theme="dark"] .login-input:focus { border-color: #60a5fa; box-shadow: 0 0 0 2px rgba(96,165,250,0.2); }
[data-theme="dark"] .login-info { color: #9ca3af; }
[data-theme="dark"] .flash-error { background: #451a1a; color: #fca5a5; }

/* Header nav */
.header-nav { display: flex; gap: 1rem; align-items: center; }
.nav-link { font-size: 0.9rem; text-decoration: none; }
.nav-link.active { font-weight: 600; }
header { display: flex; justify-content: space-between; align-items: center; }

/* Settings page */
.settings-info { color: #6b7280; margin-bottom: 1rem; font-size: 0.95rem; }
.passkey-table { margin-bottom: 1rem; }
.passkey-table th, .passkey-table td { padding: 0.5rem 1rem; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.passkey-register { margin-top: 1rem; }
.passkey-status { margin-top: 0.5rem; font-size: 0.9rem; }
.passkey-success { color: #16a34a; }
.passkey-error { color: #dc2626; }
[data-theme="dark"] .settings-info { color: #9ca3af; }
[data-theme="dark"] .passkey-success { color: #4ade80; }
[data-theme="dark"] .passkey-error { color: #f87171; }

/* API key reveal */
.apikey-reveal { margin-top: 1rem; padding: 1rem; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; }
.apikey-warning { color: #b45309; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.9rem; }
.apikey-value { display: block; padding: 0.5rem; background: #f9fafb; border: 1px solid #d1d5db; border-radius: 4px; font-size: 0.85rem; word-break: break-all; margin-bottom: 0.5rem; }
.apikey-create { margin-top: 1rem; }
[data-theme="dark"] .apikey-reveal { background: #064e3b; border-color: #065f46; }
[data-theme="dark"] .apikey-warning { color: #fbbf24; }
[data-theme="dark"] .apikey-value { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }

/* CLI auth */
.cli-auth-success { text-align: left; }
.cli-auth-instruction { font-weight: 600; color: #16a34a; margin-bottom: 0.75rem; }
.cli-auth-hint { color: #6b7280; font-size: 0.9rem; margin-top: 0.5rem; }
[data-theme="dark"] .cli-auth-instruction { color: #4ade80; }
[data-theme="dark"] .cli-auth-hint { color: #9ca3af; }

/* Login divider */
.login-section { margin-bottom: 0.5rem; }
.login-divider { display: flex; align-items: center; margin: 1rem 0; color: #9ca3af; font-size: 0.9rem; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: #d1d5db; }
.login-divider span { padding: 0 1rem; }
.passkey-btn { background: #059669; margin-bottom: 0; }
.passkey-btn:hover { background: #047857; }
[data-theme="dark"] .login-divider::before, [data-theme="dark"] .login-divider::after { background: #4b5563; }
[data-theme="dark"] .login-divider { color: #6b7280; }

/* Add property form */
.add-property-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; }
.add-property-form input[type="text"] { flex: 1; min-width: 200px; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.95rem; background: #fff; color: #1f2937; }
.add-property-form button { padding: 0.5rem 1.2rem; background: #3b82f6; color: #fff; border: none; border-radius: 6px; font-size: 0.95rem; cursor: pointer; white-space: nowrap; }
.add-property-form button:hover { background: #2563eb; }
.add-property-form button:disabled { background: #93c5fd; cursor: wait; }
.add-status { width: 100%; font-size: 0.85rem; min-height: 1.2em; }
.add-status.error { color: #ef4444; }
[data-theme="dark"] .add-property-form input[type="text"] { background: #1e293b; color: #e5e7eb; border-color: #374151; }
[data-theme="dark"] .add-property-form button:disabled { background: #1e40af; }

/* Tabs */
.tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 2px solid #e5e7eb; }
.tab { padding: 0.6rem 1.2rem; text-decoration: none; color: #6b7280; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab:hover { color: #374151; }
.tab.active { color: #3b82f6; border-bottom-color: #3b82f6; }
[data-theme="dark"] .tabs { border-bottom-color: #374151; }
[data-theme="dark"] .tab { color: #9ca3af; }
[data-theme="dark"] .tab:hover { color: #e5e7eb; }
[data-theme="dark"] .tab.active { color: #60a5fa; border-bottom-color: #60a5fa; }

/* Admin user management */
.user-form { margin-top: 1rem; }
.form-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; flex-wrap: wrap; }
.form-row .login-input { flex: 1; min-width: 150px; }
.form-value { color: #6b7280; }
.checkbox-label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; white-space: nowrap; }
.checkbox-label input[type="checkbox"] { width: 1.1rem; height: 1.1rem; cursor: pointer; }
.action-buttons { white-space: nowrap; }
.btn-secondary { background: #6b7280; }
.btn-secondary:hover { background: #4b5563; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-content { width: 90%; max-width: 500px; margin: 0; }
.modal-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
[data-theme="dark"] .form-value { color: #9ca3af; }
[data-theme="dark"] .btn-secondary { background: #4b5563; }
[data-theme="dark"] .btn-secondary:hover { background: #374151; }
