/* -- Reset & Base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f8fafc;        /* Slate 50 */
    --surface: #ffffff;
    --border: #e2e8f0;    /* Slate 200 */
    --text: #334155;      /* Slate 700 */
    --text-heading: #0f172a; /* Slate 900 */
    --text-muted: #64748b; /* Slate 500 */
    --primary: #0f172a;   /* Slate 900 */
    --primary-hover: #1e293b;
    --danger: #ef4444;    /* Red 500 */
    --radius: 8px;
    --shadow-sm: 0 2px 8px 0 rgb(0 0 0 / 0.10);
    --shadow-md: 0 4px 16px 0 rgb(0 0 0 / 0.14);
}

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

/* -- Layout ----------------------------------------------- */
.admin-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 24px;
}

/* -- Nav Bar ---------------------------------------------- */
.admin-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.nav-brand {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-heading);
    text-decoration: none;
    letter-spacing: -0.025em;
    margin-right: 8px;
    white-space: nowrap;
}
.nav-brand:hover {
    color: var(--primary-hover);
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover {
    background: #f1f5f9;
    color: var(--text-heading);
}
.nav-link-active {
    background: #f1f5f9;
    color: var(--text-heading);
    font-weight: 600;
}

/* -- Header ----------------------------------------------- */
.admin-header {
    margin-bottom: 32px;
}
.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: -0.025em;
    margin-bottom: 4px;
}
.btn-logout {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: var(--radius);
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.btn-logout:hover {
    color: var(--danger);
    border-color: var(--danger);
}
.admin-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* -- Login Page ------------------------------------------- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 40px 32px;
}
.login-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-heading);
    text-align: center;
    margin-bottom: 24px;
}
.login-error {
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.875rem;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    text-align: center;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.login-field label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.login-field input {
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-field input:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgb(148 163 184 / 0.40);
}
.btn-login {
    margin-top: 4px;
    padding: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}
.btn-login:hover {
    background: var(--primary-hover);
}

/* -- Search Bar ------------------------------------------- */
.search-bar {
    margin-top: 20px;
}
.search-bar input[type="search"] {
    width: 100%;
    max-width: 480px;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar input[type="search"]:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgb(148 163 184 / 0.40);
}
.search-bar input[type="search"]::placeholder {
    color: var(--text-muted);
}

/* -- Minimalist Table ------------------------------------- */
.room-table {
    width: 100%;
    border-collapse: separate; 
    border-spacing: 0;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden; 
}

/* Header */
.room-table thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

/* Body Rows */
.room-table tbody tr {
    transition: background-color 0.2s ease;
    cursor: pointer;
}
.room-table tbody tr:hover {
    background-color: #f1f5f9; /* Slate 100 */
}
.room-table tbody tr:active {
    background-color: #e2e8f0; /* Slate 200 */
}

/* Cells */
.room-table td {
    padding: 16px 24px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 0.9rem;
}
.room-table tbody tr:last-child td {
    border-bottom: none;
}

/* Typography in cells */
.col-name {
    font-weight: 600;
    color: var(--text-heading);
    font-size: 0.95rem;
}
.col-desc {
    color: var(--text-muted);
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.col-num {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.not-set {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

/* Code Badge */
.room-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--primary);
    background-color: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-weight: 600;
}

/* Status Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}
.badge-success {
    background-color: #dcfce7; /* Green 100 */
    color: #166534;           /* Green 700 */
}
.badge-warning {
    background-color: #fef9c3; /* Yellow 100 */
    color: #854d0e;           /* Yellow 700 */
}

/* -- Empty State ------------------------------------------ */
.empty-state {
    text-align: center;
    padding: 64px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    color: var(--text-muted);
}

/* -- Detail View (Dashboard) ------------------------------ */
.room-dashboard {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 32px;
    align-items: start;
    margin-top: 24px;
}
.room-dashboard-sidebar,
.room-dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 32px;
}
@media (max-width: 1024px) {
    .room-dashboard {
        grid-template-columns: 1fr;
    }
}

.detail-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}
.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    color: var(--primary);
    border-radius: 8px;
}
.card-icon svg {
    width: 20px;
    height: 20px;
}
.detail-card h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-heading);
    margin: 0;
}
.card-header-actions {
    margin-left: auto;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); /* slightly wider */
    gap: 32px 32px;
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
.detail-value {
    font-size: 1rem;
    color: var(--text-heading);
}

.room-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.room-header h1 {
    margin: 0;
}
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    background: transparent;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 6px 12px 6px 6px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: fit-content;
    transition: background 0.2s, color 0.2s;
}
.back-btn:hover {
    background: var(--surface);
    color: var(--text-heading);
}

/* -- Custom Overrides Card -------------------------------- */
.custom-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 4px;
    padding: 2px 6px;
    vertical-align: middle;
    margin-left: 8px;
}
.custom-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.custom-current {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.875rem;
}
.custom-current .detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.custom-current-row {
    color: var(--text-main);
    line-height: 1.5;
}
.custom-current-label {
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 4px;
}
.custom-current-empty {
    color: var(--text-muted);
    font-style: italic;
}
.custom-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.custom-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.custom-input,
.custom-textarea {
    width: 100%;
    max-width: 640px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
}
.custom-input:focus,
.custom-textarea:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgb(148 163 184 / 0.40);
}
.custom-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.btn-save {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}
.btn-save:hover { background: var(--primary-hover); }
.btn-save:disabled { opacity: 0.5; cursor: default; }
.btn-clear {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 9px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}
.btn-clear:hover { border-color: var(--text-muted); color: var(--text); }
.btn-clear:disabled { opacity: 0.5; cursor: default; }
.custom-status {
    font-size: 0.875rem;
}
.custom-status-ok { color: #166534; }
.custom-status-err { color: var(--danger); }

/* -- Upload Area ------------------------------------------ */
.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px;
    text-align: center;
    background-color: #fafafa;
    transition: all 0.2s;
    cursor: pointer;
}
.upload-dropzone:hover {
    border-color: var(--text-muted);
    background-color: #f1f5f9;
}
.upload-dropzone p {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}
.upload-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* -- Gallery ---------------------------------------------- */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    gap: 24px;
    margin-top: 24px;
}
.image-item {
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    aspect-ratio: 16/10;
    background: #f1f5f9;
}
.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.image-item:hover img {
    transform: scale(1.05);
}
.image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.image-item:hover .image-overlay {
    opacity: 1;
}

/* -- Buttons ---------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-sm {
    padding: 4px 12px;
    font-size: 0.8rem;
}
.btn-primary {
    background-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}
.btn-danger {
    background-color: #fff;
    color: var(--danger);
    border: 1px solid #fecaca;
}
.btn-danger:hover {
    background-color: #fef2f2;
    border-color: var(--danger);
}
.btn-secondary {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

@media (max-width: 768px) {
    .room-table { display: block; overflow-x: auto; }
}

/* Additional Utilities */
.badge-opera {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.detail-full {
    grid-column: 1 / -1;
}

/* -- Drag & Drop ------------------------------------------ */
.upload-dropzone.drag-over {
    border-color: var(--primary);
    background-color: #f1f5f9;
}

/* -- Image Info ------------------------------------------- */
.image-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.2s;
}
.image-item:hover .image-info {
    opacity: 1;
}

/* -- Primary Image Highlight ------------------------------ */
.image-item.primary {
    outline: 3px solid #3b82f6;
    outline-offset: -3px;
}

/* -- Upload Placeholder ----------------------------------- */
.upload-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
}
.upload-spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.upload-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.upload-placeholder-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* -- Primary Badge ---------------------------------------- */
.badge-primary {
    background-color: #dbeafe;
    color: #1d4ed8;
}

/* -- Set Primary Button ----------------------------------- */
.btn-primary-action {
    background-color: #fff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    margin-right: 8px;
}
.btn-primary-action:hover {
    background-color: #eff6ff;
    border-color: #93c5fd;
}

/* -- Toast Notification ----------------------------------- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    color: #f8fafc;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 9999;
    max-width: 320px;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast.error {
    background: var(--danger);
}

/* -- Conversations Page ----------------------------------- */
.conv-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.conv-tab {
    padding: 7px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.conv-tab:hover {
    background: #f1f5f9;
    color: var(--text-heading);
}
.conv-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.conv-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    height: calc(100vh - 280px);
    min-height: 480px;
}
.conv-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.conv-search {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}
.conv-search input[type="search"] {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.conv-search input:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgb(148 163 184 / 0.3);
}
.conv-search input::placeholder { color: var(--text-muted); }
#conv-list {
    flex: 1;
    overflow-y: auto;
}
.user-lookup-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 20px;
    margin-bottom: 20px;
}
.user-lookup-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 12px;
}
.user-lookup-fields {
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    gap: 12px;
    align-items: end;
}
.user-lookup-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.user-lookup-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.user-lookup-field input {
    padding: 8px 12px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.user-lookup-field input:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgb(148 163 184 / 0.3);
}
.user-lookup-field input::placeholder { color: var(--text-muted); }
.btn-lookup {
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.btn-lookup:hover { opacity: 0.88; }
.btn-lookup:disabled { opacity: 0.5; cursor: not-allowed; }
#user-lookup-result,
#widget-search-result {
    margin-top: 12px;
    font-size: 0.875rem;
}
#user-lookup-result .search-hit,
#widget-search-result .search-hit {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: calc(var(--radius) - 2px);
    background: #f1f5f9;
    cursor: pointer;
    transition: background 0.1s;
}
#user-lookup-result .search-hit:hover,
#widget-search-result .search-hit:hover { background: #e2e8f0; }
#user-lookup-result .search-hit-name,
#widget-search-result .search-hit-name {
    font-weight: 600;
    color: var(--text-heading);
}
#user-lookup-result .search-hit-sub,
#widget-search-result .search-hit-sub {
    color: var(--text-muted);
    font-size: 0.8rem;
}
#user-lookup-result .lookup-not-found,
#widget-search-result .lookup-not-found {
    color: var(--text-muted);
    font-size: 0.875rem;
}
.conv-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}
.conv-item:last-child { border-bottom: none; }
.conv-item:hover { background: #f8fafc; }
.conv-item-active { background: #f1f5f9 !important; }
.conv-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conv-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.775rem;
    color: var(--text-muted);
}
.conv-main {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.conv-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 12px;
    padding: 32px;
}
.conv-empty svg { opacity: 0.35; }
.conv-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.conv-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    display: inline-block;
}
.conv-chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}
.conv-chat-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 2px;
}
.conv-chat-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.conv-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.msg-row {
    display: flex;
    max-width: 72%;
}
.bubble-user { align-self: flex-end; justify-content: flex-end; margin-left: auto; }
.bubble-bot  { align-self: flex-start; }
.msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.5;
    max-width: 100%;
    word-break: break-word;
}
.bubble-user .msg-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.bubble-bot .msg-bubble {
    background: #f1f5f9;
    color: var(--text);
    border-bottom-left-radius: 4px;
}
.msg-content { white-space: pre-wrap; }
.msg-img-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,.08);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.85rem;
    font-style: italic;
    opacity: 0.85;
}
.msg-photo {
    display: block;
    max-width: 240px;
    max-height: 320px;
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: zoom-in;
    object-fit: cover;
    transition: opacity 0.15s;
}
.msg-photo:hover { opacity: 0.88; }
.msg-photo:not(:last-of-type) { margin-bottom: 6px; }

/* Lightbox */
.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,.85);
    display: flex;
    align-items: center;
    justify-content: center;
}
.photo-lightbox[hidden] { display: none; }
.photo-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    object-fit: contain;
}
.photo-lightbox-close {
    position: absolute;
    top: 18px;
    right: 24px;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.photo-lightbox-close:hover { background: rgba(255,255,255,.3); }
.msg-img-caption {
    font-size: 0.9rem;
}
.msg-time {
    font-size: 0.7rem;
    margin-top: 4px;
    opacity: 0.6;
    text-align: right;
}
.load-older-btn {
    display: block;
    width: 100%;
    padding: 8px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.load-older-btn:hover:not(:disabled) {
    background: #f1f5f9;
    color: var(--text-heading);
}
.load-older-btn:disabled { opacity: 0.5; cursor: default; }
@media (max-width: 768px) {
    .conv-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 260px 1fr;
    }
}

/* -- Amenities Card -------------------------------- */
.amenity-section {
    margin-top: 1.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--border);
}
.amenity-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.amenity-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.amenity-section-count {
    font-size: 0.7rem;
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}
.amenity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px 14px;
}
.amenity-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 4px 0;
}
.amenity-checkbox input {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}
.amenity-checkbox span {
    line-height: 1.3;
}
