/* ── Reset & Variables ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --ink: #0a0f1a;
    --warm: #f7f4ef;
    --accent: #c8956c;
    --accent-light: #e8d5c0;
    --accent-hover: #b5825c;
    --muted: #6b7280;
    --card: #ffffff;
    --border: rgba(0,0,0,0.06);
    --sidebar-bg: #0a0f1a;
    --sidebar-text: rgba(255,255,255,0.6);
    --sidebar-active: rgba(255,255,255,0.95);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --info: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 20px rgba(0,0,0,0.03);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
}

body {
    font-family: 'DM Sans', sans-serif;
    color: var(--ink);
    background: var(--warm);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ── Auth Screen ── */
#auth-screen {
    display: flex;
}
.auth-container {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--warm);
    padding: 24px;
}
.auth-card {
    background: var(--card);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.auth-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 32px;
    letter-spacing: -0.5px;
    text-align: center;
    margin-bottom: 4px;
}
.logo-accent {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    margin-left: 2px;
    vertical-align: super;
}
.auth-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 15px;
    margin-bottom: 32px;
}
.auth-toggle {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-top: 20px;
}
.auth-toggle a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}
.auth-toggle a:hover { text-decoration: underline; }

/* ── Form Elements ── */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}
.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--warm);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200,149,108,0.15);
}
.form-input::placeholder {
    color: rgba(107,114,128,0.5);
}
textarea.form-input {
    resize: vertical;
    min-height: 80px;
}
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
    background: rgba(0,0,0,0.04);
    color: var(--ink);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(0,0,0,0.08); }
.btn-danger {
    background: rgba(239,68,68,0.08);
    color: var(--danger);
}
.btn-danger:hover { background: rgba(239,68,68,0.15); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    width: 100%;
    justify-content: center;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-ghost {
    background: none;
    color: var(--muted);
    padding: 6px 10px;
}
.btn-ghost:hover { color: var(--ink); background: rgba(0,0,0,0.04); }

/* ── App Layout ── */
#app {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
}
.sidebar-header {
    padding: 24px 24px 20px;
}
.sidebar-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: white;
    text-decoration: none;
}
.sidebar-nav {
    flex: 1;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    cursor: pointer;
}
.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.85);
}
.nav-item.active {
    background: rgba(200,149,108,0.15);
    color: var(--accent-light);
}
.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.user-info {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.btn-logout {
    width: 100%;
    padding: 8px;
    background: rgba(255,255,255,0.06);
    border: none;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.5);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-logout:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.top-bar {
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--warm);
    position: sticky;
    top: 0;
    z-index: 10;
}
.top-bar h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
}
.top-bar-actions {
    display: flex;
    gap: 8px;
}
.content-area {
    padding: 28px 32px;
    flex: 1;
}

/* ── Cards ── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.2px;
}
.card-body { padding: 22px; }

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 22px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.stat-label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}

/* ── Grid Layouts ── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* ── Property Cards ── */
.property-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 24px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.property-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.property-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}
.property-card .address {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 16px;
}
.property-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.property-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}
.property-stat .stat-icon {
    font-size: 14px;
}

/* ── Tables ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(0,0,0,0.01); }

/* ── Status Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: rgba(34,197,94,0.1); color: #16a34a; }
.badge-warning { background: rgba(245,158,11,0.1); color: #d97706; }
.badge-info { background: rgba(59,130,246,0.1); color: #2563eb; }
.badge-danger { background: rgba(239,68,68,0.1); color: #dc2626; }
.badge-muted { background: rgba(107,114,128,0.1); color: var(--muted); }

/* ── Activity Feed ── */
.activity-item {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.activity-content {
    flex: 1;
    min-width: 0;
}
.activity-action {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}
.activity-details {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.activity-time {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    margin-left: 8px;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

/* ── Chat / Messages ── */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 400px;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
}
.message-guest {
    align-self: flex-start;
    background: rgba(0,0,0,0.04);
    border-bottom-left-radius: 4px;
}
.message-ai {
    align-self: flex-end;
    background: var(--accent-light);
    color: var(--ink);
    border-bottom-right-radius: 4px;
}
.message-owner {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}
.message-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    opacity: 0.7;
}
.message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.6;
}
.chat-input {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    background: var(--card);
}
.chat-input input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    outline: none;
    background: var(--warm);
}
.chat-input input:focus {
    border-color: var(--accent);
}
.chat-input-actions {
    display: flex;
    gap: 6px;
}

/* ── Modals ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,15,26,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
}
.modal {
    background: var(--card);
    border-radius: 16px;
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-header {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 600;
}
.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0,0,0,0.04);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--muted);
}
.modal-close:hover { background: rgba(0,0,0,0.08); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Section Headers ── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.section-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent);
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-state h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
}
.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* ── Cleaning Email Preview ── */
.email-preview {
    background: var(--warm);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink);
    white-space: pre-wrap;
    border: 1px solid var(--border);
    max-height: 300px;
    overflow-y: auto;
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.tab {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: 'DM Sans', sans-serif;
}
.tab:hover { color: var(--ink); }
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--ink);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    z-index: 200;
    transition: transform 0.3s ease;
    pointer-events: none;
}
.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ── Loading Spinner ── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(200,149,108,0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Back Link ── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 16px;
    cursor: pointer;
}
.back-link:hover { color: var(--ink); }

/* ── Detail Grid ── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.detail-item label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 4px;
}
.detail-item span {
    font-size: 15px;
    color: var(--ink);
}

/* ── Inline Form ── */
.inline-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    padding: 16px;
    background: var(--warm);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

/* ── Subscription Badges ── */
.sub-badge {
    margin-top: 8px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
}
.sub-badge-trial {
    background: rgba(59,130,246,0.15);
    color: #2563eb;
}
.sub-badge-active {
    background: rgba(34,197,94,0.15);
    color: #16a34a;
}
.sub-badge-expired {
    background: rgba(239,68,68,0.15);
    color: #dc2626;
}

/* ── Subscription Banners ── */
.sub-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.sub-banner-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sub-banner-content strong {
    font-size: 14px;
    font-weight: 600;
}
.sub-banner-content span {
    font-size: 13px;
    opacity: 0.8;
}
.sub-banner-info {
    background: rgba(59,130,246,0.06);
    border: 1px solid rgba(59,130,246,0.15);
    color: var(--ink);
}
.sub-banner-trial {
    background: rgba(200,149,108,0.06);
    border: 1px solid rgba(200,149,108,0.2);
    color: var(--ink);
}
.sub-banner-expired {
    background: rgba(239,68,68,0.04);
    border: 1px solid rgba(239,68,68,0.15);
    color: var(--ink);
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .top-bar { padding: 16px 20px; }
    .content-area { padding: 20px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .chat-container { height: calc(100vh - 160px); }
    .message { max-width: 90%; }
    .inline-form { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .modal { max-width: 100%; margin: 16px; }
}
