/* ===== LOADING INDICATOR ===== */
#app-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #F4F9FF;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app-loading .spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #E5E7EB;
    border-top-color: #67BDFB;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
#app-loading .text {
    margin-top: 16px;
    color: #6B7280;
    font-size: 14px;
}
#app-loading .error {
    color: #DC2626;
    margin-top: 8px;
    font-size: 12px;
    display: none;
}

/* ===== KEYFRAME ANIMATIONS ===== */
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}
@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}
@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.streaming-cursor {
    animation: blink 0.7s infinite;
    color: #10B981;
    font-weight: bold;
}

/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #F4F9FF;
    overflow: hidden;
}

/* ===== HEADER ===== */
.header {
    height: 60px;
    background: #FFFFFF;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding-bottom: 4px;
}

/* Subtle onboarding progress bar */
.header-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    transition: width 0.3s ease;
    background-color: #67BDFB;
}

.header-left {
    display: flex;
    align-items: center;
    margin-left: 24px;
}

.hamburger {
    font-size: 20px;
    color: #3D3D3D;
    cursor: pointer;
}

.logo {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 700;
    font-style: italic;
    background: linear-gradient(180deg, #DF3080 0%, #F9C300 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-img {
    height: 32px;
    width: auto;
    margin-right: 4px;
}

.charlie-info {
    display: flex;
    flex-direction: column;
    margin-left: 4px;
}

.charlie-name {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #3D3D3D;
}

.online-dot {
    width: 6px;
    height: 6px;
    background: #22C55E;
    border-radius: 50%;
}

.charlie-version {
    font-size: 11px;
    color: #9CA3AF;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 0px;
    padding: 6px 14px 6px 6px;
    background-color: #F4F9FF !important;
    border: 1px solid #DDF1FF !important;
    border-radius: 32px;
    cursor: pointer;
    transition: all 0.2s;
}
.header-center:hover {
    background-color: #F4F9FF !important;
    border: 1px solid #DDF1FF !important;
    box-shadow: 0 2px 8px rgba(103, 189, 251, 0.15);
}

.pet-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #F4F9FF;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
}

.pet-info {
    display: flex;
    flex-direction: column;
    margin-right: 12px;
    margin-left: 12px;
}

.pet-name {
    font-size: 14px;
    font-weight: 600;
    color: #3D3D3D;
}

.pet-breed {
    font-size: 11px;
    color: #6B7280;
}

.dropdown-btn {
    width: 32px;
    height: 32px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    transition: all 0.2s;
}
.dropdown-btn:hover {
    background: #F9FAFB;
    border-color: #67BDFB;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none !important;
    background: linear-gradient(135deg, #D1FAE5 0%, #6EE7B7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    overflow: hidden;
    position: relative;
}

/* Login status indicator - hidden for consistent header look */
.login-status-indicator {
    display: none;
}

.tool-icon {
    color: #6B7280;
    cursor: pointer;
}

/* ===== MAIN LAYOUT ===== */
.layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: calc(100vh - 60px);
    margin-top: 60px;
    position: relative;
    transition: grid-template-columns 0.3s ease, margin-right 0.3s ease;
}
.layout.sidebar-closed {
    grid-template-columns: 0px 1fr;
}
.layout.reports-open {
    margin-right: 340px;
}
.layout.sidebar-closed.reports-open {
    grid-template-columns: 0px 1fr;
    margin-right: 340px;
}

/* ===== LEFT SIDEBAR ===== */
.sidebar-left {
    position: relative;
    background: #FFFFFF;
    border-right: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}
.layout.sidebar-closed .sidebar-left {
    opacity: 0;
    pointer-events: none;
}

/* ===== WAGLEES MODAL ===== */
.waglees-modal {
    position: fixed;
    background-color: white;
    width: 244px;
    height: 81px;
    bottom: 5px;
    left: 5px;
    padding: 20px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    transition: all 0.3s ease;
    z-index: 100;
    border-radius: 8px;
}
.waglees-powered {
    font-size: 8px;
    color: #9CA3AF;
    letter-spacing: 0.5px;
    margin-bottom: -30px;
    margin-left: 11px;
    line-height: 1;
    transform: translateY(15px);
}
.waglees-logo {
    width: 100px;
    padding-top: 16px;
    height: auto;
    opacity: 0.9;
}
.layout.sidebar-closed .waglees-modal {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-100%);
}
@media (max-width: 767px) {
    .waglees-modal {
        display: none;
    }
}

/* Icon button (hamburger, etc) */
.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    transition: all 0.15s;
    opacity: 0.8;
}
.btn-icon:hover {
    background: rgba(103, 189, 251, 0.1);
    color: #3D3D3D;
    opacity: 1;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}

.sidebar-title {
    font-size: 15px;
    font-weight: 500;
    color: #3D3D3D;
}

.close-btn {
    color: #9CA3AF;
    cursor: pointer;
    font-size: 32px;
}

.new-chat-btn {
    margin: 0 16px 12px;
    padding: 10px 20px;
    background: #67BDFB;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.search-box {
    margin: 0 16px 12px;
    padding: 12px !important;
    background: #F8FBFF;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    color: #3D3D3D;
    outline: none;
}

.search-box input::placeholder {
    color: #9CA3AF;
}

.search-icon {
    color: #9CA3AF;
    font-size: 14px;
    margin-left: 12px;
    gap: 0px;
}

.conversations {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}

.conv-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    margin: 0px 12px 4px 12px;
}

.conv-item:hover {
    background: #F8FBFF;
}

.conv-item .delete-conv-btn {
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.conv-item:hover .delete-conv-btn {
    opacity: 1;
}

.conv-item .delete-conv-btn:hover {
    background: #FFFFFF !important;
    color: #DC2626 !important;
}

.conv-item.active {
    background: #F4F9FF;
    border: solid 1px #67BDFB;
    box-shadow: 0 5px 5px rgba(0,0,0,0.02);
}

.conv-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #FED7AA;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.conv-content {
    flex: 1;
    min-width: 0;
}

.conv-title {
    font-size: 14px;
    font-weight: 600;
    color: #585858;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.conv-subtitle {
    font-size: 12px;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-meta {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 2px;
}

.conv-meta.red {
    color: #EF4444;
}

/* ===== MAIN CHAT ===== */
.main-chat {
    display: flex;
    flex-direction: column;
    background: #F4F9FF;
    height: 100%;
    overflow: hidden;
}

.question-header {
    background-color: #F8FBFF;
    padding: 12px;
    margin: 20px;
    border: 1px solid #E5E7EB;
    display: flex;
    align-items: flex-start;
    border-radius: 12px;
    gap: 18px;
}

.question-icon {
    width: 28px;
    height: 28px;
    margin-top: 4px;
    background: #FFFFFF;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #6B7280;
}

.question-text h3 {
    font-size: 14px;
    font-weight: 300;
    line-height: 1.5;
    color: #3D3D3D;
    margin-bottom: 2px;
    height: auto;
    width: auto;
}

.question-text span {
    font-size: 12px;
    color: #9CA3AF;
}

.messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding: 20px;
    background: #F4F9FF;
}

.msg-row {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}
.msg-row.user-row {
    align-items: flex-end;
}
.msg-row.ai-row {
    align-items: flex-start;
}

.msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-left: 4px;
    padding-right: 4px;
}

.msg-meta.right {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Figma Design v3.0 - Charlie icon avatar */
.msg-avatar.ai {
    background: linear-gradient(135deg, #DDF1FF 0%, #67BDFB 100%);
    border: 1.5px solid #DDF1FF;
}

.msg-avatar.ai img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-avatar.user {
    background: linear-gradient(135deg, #FED7AA 0%, #FDBA74 100%);
    border: 1.5px solid #FED7AA;
}

.msg-avatar.user img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.msg-time {
    font-size: 11px;
    color: #9CA3AF;
}

.msg-bubble {
    max-width: 70%;
    width: fit-content;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Figma Design v3.0 - AI bubble: white background, blue border */
.msg-bubble.ai {
    background: #FFFFFF;
    border: 1px solid #DDF1FF;
    border-radius: 24px 24px 24px 0px;
    color: #3D3D3D;
    box-shadow: 0 5px 5px rgba(0,0,0,0.02) !important;
}

/* Figma Design v3.0 - User bubble: blue background */
.msg-bubble.user {
    background: #67BDFB;
    border-radius: 24px 24px 0px 24px;
    color: #FFFFFF;
    margin-left: auto;
    box-shadow: 0 5px 5px rgba(0,0,0,0.02) !important;
}

.msg-bubble h4 {
    font-size: 13px;
    font-weight: 600;
    margin: 12px 0 6px;
}

.msg-bubble h4:first-child {
    margin-top: 0;
}

.msg-bubble ul {
    margin: 16px 0px 0px 0px;
    padding-left: 0;
    list-style: none;
}

.msg-bubble li {
    margin-bottom: 4px;
    padding-left: 4px;
}

.msg-bubble li::before {
    content: "\2022";
    margin-right: 8px;
    color: #67BDFB;
}

.msg-bubble ol {
    margin: 0;
    padding-left: 20px;
}

.msg-bubble ol li {
    padding-left: 0;
}

.msg-bubble ol li::before {
    content: none;
}

.msg-bubble code {
    background: #F3F4F6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

.msg-bubble pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.msg-bubble pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.msg-bubble strong {
    font-weight: 600;
}

.msg-bubble em {
    font-style: italic;
}

/* ========== APPLE-STYLE TABLE ========== */
/* Table wrapper for horizontal scroll on mobile */
.msg-bubble .table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 12px 0;
    max-width: 100%;
    border-radius: 12px;
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.msg-bubble .chat-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    letter-spacing: -0.01em;
}

.msg-bubble .chat-table th,
.msg-bubble .chat-table td {
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.msg-bubble .chat-table th {
    background: linear-gradient(180deg, #FAFAFA 0%, #F5F5F7 100%);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #86868B;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* First row rounded corners */
.msg-bubble .chat-table thead tr:first-child th:first-child {
    border-top-left-radius: 12px;
}
.msg-bubble .chat-table thead tr:first-child th:last-child {
    border-top-right-radius: 12px;
}

/* Last row rounded corners */
.msg-bubble .chat-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}
.msg-bubble .chat-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}
.msg-bubble .chat-table tbody tr:last-child td {
    border-bottom: none;
}

/* Hover effect */
.msg-bubble .chat-table tbody tr {
    transition: background-color 0.15s ease;
}
.msg-bubble .chat-table tbody tr:hover {
    background-color: rgba(0, 122, 255, 0.04);
}

/* Alternating row colors (subtle) */
.msg-bubble .chat-table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.015);
}
.msg-bubble .chat-table tbody tr:nth-child(even):hover {
    background-color: rgba(0, 122, 255, 0.06);
}

/* Status badges in tables */
.msg-bubble .chat-table .status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.msg-bubble .chat-table .status-badge.success {
    background: rgba(52, 199, 89, 0.12);
    color: #248A3D;
}
.msg-bubble .chat-table .status-badge.warning {
    background: rgba(255, 159, 10, 0.12);
    color: #C93400;
}
.msg-bubble .chat-table .status-badge.info {
    background: rgba(0, 122, 255, 0.1);
    color: #0066CC;
}

/* Allow text wrapping in cells on wider screens */
@media (min-width: 600px) {
    .msg-bubble .chat-table th,
    .msg-bubble .chat-table td {
        white-space: normal;
        max-width: 280px;
    }
}

/* Compact table variant */
.msg-bubble .chat-table.compact th,
.msg-bubble .chat-table.compact td {
    padding: 8px 12px;
    font-size: 13px;
}

/* ===== CHAT INPUT ===== */
.chat-input {
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
    background: #FFFFFF;
}

.input-box {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 24px;
    padding: 6px 6px 6px 16px;
}

.input-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: #3D3D3D;
    outline: none;
}

.send-btn {
    width: 44px;
    height: 44px;
    background: #67BDFB;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
}

.photo-btn {
    width: 44px;
    height: 44px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6B7280;
    margin-right: 10px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.photo-btn:hover {
    background: #F0F6FA;
    color: #67BDFB;
    border-color: #67BDFB;
}

.input-box {
    display: flex;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    padding: 8px 10px 8px 8px;
}

.input-box:focus-within {
    border-color: #67BDFB;
    box-shadow: 0 0 0 3px rgba(103, 189, 251, 0.1);
}

#messageInput::-webkit-scrollbar {
    width: 4px;
}
#messageInput::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 2px;
}

/* ===== RESTART BUTTON ===== */
.restart-onboarding-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    margin: 12px 20px 12px auto;
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.2s ease;
}
.restart-onboarding-btn:hover {
    background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
    border-color: #FECACA;
    color: #DC2626;
}
.restart-onboarding-btn svg {
    transition: transform 0.3s ease;
}
.restart-onboarding-btn:hover svg {
    transform: rotate(180deg);
}

/* ===== RESTART CONFIRMATION MODAL ===== */
.restart-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.restart-modal {
    background: white;
    border-radius: 24px;
    padding: 32px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}
.restart-modal-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: #FEF2F2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.restart-modal-icon img {
    width: 48px;
    height: 48px;
}
.restart-modal h3 {
    color: #1F2937;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 12px;
}
.restart-modal p {
    color: #6B7280;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 24px;
}
.restart-modal-list {
    text-align: left;
    background: #F9FAFB;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}
.restart-modal-list li {
    color: #4B5563;
    font-size: 13px;
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.restart-modal-list li::before {
    content: '\2022';
    color: #EF4444;
    font-weight: bold;
}
.restart-modal-buttons {
    display: flex;
    gap: 12px;
}
.restart-modal-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}
.restart-modal-btn.cancel {
    background: #F3F4F6;
    color: #4B5563;
}
.restart-modal-btn.cancel:hover {
    background: #E5E7EB;
}
.restart-modal-btn.confirm {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
}
.restart-modal-btn.confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* ===== RIGHT SIDEBAR (push layout) ===== */
.sidebar-right {
    position: fixed;
    top: 60px;
    right: 0;
    bottom: 0;
    width: 340px;
    background: #FFFFFF;
    border-left: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 50;
}
.sidebar-right.open {
    transform: translateX(0);
}

/* Events panel layout shift */
.layout.events-open {
    margin-right: 340px;
}
.layout.reports-open {
    margin-right: 340px;
}
.layout.campaigns-open {
    margin-right: 480px;
}
@media (max-width: 767px) {
    .layout.events-open,
    .layout.reports-open {
        margin-right: 0 !important;
    }
    .layout.campaigns-open {
        margin-right: 0 !important;
    }
}

.reports-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 60px;
    min-height: 60px;
    border-bottom: 1px solid #E5E7EB;
    background: #F9FAFB;
}

.reports-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #3D3D3D;
    margin: 0;
    flex: 1;
}

.reports-header .close-btn {
    font-size: 20px;
    color: #9CA3AF;
    line-height: 1;
}

.reports-desc {
    padding: 16px;
    font-size: 12px;
    color: #6B7280;
    line-height: 1.5;
    border-bottom: 1px solid #E5E7EB;
    text-align: center;
}

.add-report-btn {
    margin: 16px;
    padding: 12px 20px;
    width: calc(100% - 32px);
    background: linear-gradient(90deg, #EF4444 0%, #F97316 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.add-photos-btn {
    margin: 0 16px 16px 16px;
    padding: 12px 20px;
    background: linear-gradient(90deg, #3B82F6 0%, #8B5CF6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 32px);
}

.add-photos-btn:hover {
    background: linear-gradient(90deg, #2563EB 0%, #7C3AED 100%);
}

.add-photos-btn:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

.add-photos-btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#photoFileInput {
    display: none;
}

.reports-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

.report-item {
    padding: 14px 0;
    border-bottom: 1px solid #F3F4F6;
}

.report-chips {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.chip {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

.chip.auto {
    background: #67BDFB;
    color: white;
}

.chip.medium {
    background: #F3F4F6;
    color: #3D3D3D;
    border: 1px solid #E5E7EB;
}

.chip.error {
    background: #EF4444;
    color: white;
}

.chip.high {
    background: #EF4444;
    color: white;
}

.chip.critical {
    background: #7C2D12;
    color: white;
}

.chip.low {
    background: #D1FAE5;
    color: #166534;
}

.chip.type {
    background: #EFF6FF;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
}

.report-title {
    font-size: 13px;
    font-weight: 600;
    color: #3D3D3D;
    margin-bottom: 4px;
}

.report-meta {
    font-size: 11px;
    color: #9CA3AF;
    line-height: 1.4;
}

.report-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: #6B7280;
}

/* ===== NAVIGATION MENU ===== */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.nav-overlay.open { opacity: 1; visibility: visible; }

.nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: #FFFFFF;
    z-index: 201;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
}
.nav-menu.open { transform: translateX(0); }

.nav-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-header img { height: 36px; }
.nav-header-text { font-size: 18px; font-weight: 600; color: #3D3D3D; }

.nav-items { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.2s;
    color: #3D3D3D;
    font-size: 15px;
    text-decoration: none;
}
.nav-item:hover { background: #F4F9FF; }
.nav-item.active { background: #EFF6FF; color: #67BDFB; font-weight: 500; }

.nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.nav-icon.blue { background: #F0F6FA; }
.nav-icon.green { background: #F2F7ED; }
.nav-icon.pink { background: #FDF2F8; }
.nav-icon.purple { background: #F8F6FE; }
.nav-icon.red { background: #FEF2F2; }

.nav-divider { height: 1px; background: #E5E7EB; margin: 8px 20px; }

.nav-footer {
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
    font-size: 12px;
    color: #9CA3AF;
}

/* Better close button style */
.sidebar-right .close-btn {
    cursor: pointer;
    font-size: 32px;
    color: #9CA3AF;
    transition: color 0.2s;
}
.sidebar-right .close-btn:hover {
    color: #3D3D3D;
}

/* ===== LOGIN STATUS INDICATOR - hidden for consistent header ===== */
/* Indicator removed - header looks same before and after login */

/* ===== QUICK REPLIES ===== */
.quick-reply-btn {
    background: #fff;
    border: 1px solid #67BDFB;
    color: #67BDFB;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.quick-reply-btn:hover {
    background: #67BDFB;
    color: #fff;
}
.quick-reply-btn:active {
    transform: scale(0.98);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 767px) {
    /* Hide sidebar on mobile by default */
    .sidebar, .sidebar-left {
        position: fixed !important;
        left: 0 !important;
        transform: translateX(-100%);
        -webkit-transform: translateX(-100%);
        top: 60px !important;
        width: calc(100vw) !important;
        max-width: none !important;
        height: calc(100vh - 60px) !important;
        z-index: 5001 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        -webkit-transition: -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        will-change: transform;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        background: #fff !important;
        /* Prevent Safari iOS rendering glitches */
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        -webkit-perspective: 1000;
        perspective: 1000;
    }
    .sidebar.mobile-open, .sidebar-left.mobile-open {
        transform: translateX(0) !important;
        -webkit-transform: translateX(0) !important;
        left: 0 !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        visibility: visible !important;
    }

    .search-box {
        padding: 0px !important;
    }

    .header-right {
        margin-right: 0px;
        gap: 20px !important;
    }

    /* Layout - full width chat on mobile */
    .layout {
        grid-template-columns: 1fr !important;
    }
    .layout.sidebar-closed {
        grid-template-columns: 1fr !important;
    }

    /* Chat area full width */
    .chat-area {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Messages - better mobile sizing */
    .msg-row {
        max-width: 100% !important;
    }
    .msg-bubble {
        max-width: 100% !important;
        font-size: 15px !important;
    }

    /* Input area - mobile friendly */
    .input-area {
        padding: 8px 12px !important;
        padding-bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px)) !important;
    }
    .input-container {
        padding: 8px 12px !important;
    }

    /* Header adjustments for mobile */
    .header {
        height: 66px !important;
        padding-bottom: 4px !important;
    }
    /* Hide logo on mobile */
    #charlieLogoContainer {
        display: none !important;
    }
    .header-left {
        margin-left: 0px;
    }
    .header-center {
        position: absolute !important;
        left: 40% !important;
        transform: translateX(-50%) !important;
        max-width: 55% !important;
        padding: 1px 10px 1px 1px !important;
    }
    .pet-avatar {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        flex-shrink: 0 !important;
        aspect-ratio: 1/1 !important;
        font-size: 28px !important;
        margin-left: 5px !important;
    }
    .pet-info {
        margin-left: 12px !important;
    }
    .pet-name {
        font-size: 12px !important;
    }
    .pet-breed {
        font-size: 9px !important;
    }
    /* User avatar always visible */
    .user-avatar {
        display: flex !important;
        margin-right: -10px !important;
    }
    /* Header-right adjustments for mobile */
    .header-right {
        gap: 12px !important;
    }
    /* Hide language selector on mobile - use sidebar instead */
    #headerLangSelector {
        display: none !important;
    }
    /* Pet menu dropdown - fix positioning on mobile (displays below header) */
    #petMenu {
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: calc(100vw - 40px) !important;
        max-width: 280px !important;
        top: 100% !important;
        bottom: auto !important;
        margin-top: 8px !important;
        margin-bottom: 0 !important;
    }
}

/* Samsung Galaxy S8 (360px) - extra 7px right shift */
@media (max-width: 360px) {
    .user-avatar {
        margin-right: -17px !important;
    }
}

/* iPhone 12 Pro (390px) optimization - pet selector reduced by 12% */
@media (min-width: 385px) and (max-width: 395px) {
    .header {
        padding: 0 16px !important;
        height: 56px !important;
    }
    /* Header center - keep modal centered */
    .header-center {
        position: absolute !important;
        left: 40% !important;
        transform: translateX(-50%) !important;
    }
    .pet-name {
        font-size: 9px !important;
    }
    .pet-breed {
        font-size: 8px !important;
    }
    .pet-avatar {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: 18px !important;
    }
    .user-avatar {
        width: 40px !important;
        height: 40px !important;
        margin-right: -6px !important;
    }
    /* Pet menu - centered below header-center */
    #petMenu {
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 280px !important;
        max-width: calc(100vw - 40px) !important;
    }
    /* User menu - right aligned */
    #userMenu {
        width: 240px !important;
        right: -8px !important;
    }
    /* Chat input safe area */
    .chat-input {
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 20px)) !important;
    }
    /* Messages padding for notch + selector space */
    .messages-container {
        padding-bottom: 180px !important;
    }
    /* Quick replies spacing */
    .quick-replies {
        padding: 0 12px !important;
    }
    .quick-reply-btn {
        font-size: 15px !important;
        padding: 12px 18px !important;
        min-height: 46px !important;
    }
    /* Input box */
    .input-box {
        padding: 10px 14px !important;
    }
    .input-box textarea {
        font-size: 16px !important;  /* Prevents iOS zoom on focus */
    }
    /* eDID panel for iPhone 12 Pro */
    #edidSlidePanel {
        width: calc(100% - 24px) !important;
        left: 12px !important;
        right: 12px !important;
    }
    #edidSlidePanel .edid-photo {
        width: 70px !important;
        height: 70px !important;
    }
    #edidSlidePanel .edid-qr {
        width: 90px !important;
        height: 90px !important;
    }
}

/* Show language selector only on tablet+ */
@media (min-width: 768px) {
    #headerLangSelector {
        display: block !important;
    }
}

@media (max-width: 767px) {
    /* PROMPTER - always visible at bottom */
    .chat-input {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: #fff !important;
        z-index: 100 !important;
        padding: 8px 12px 0 12px !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
        border-top: 1px solid #E5E7EB !important;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05) !important;
    }
    .input-box {
        margin: 0 !important;
    }
    /* Add padding to chat messages so they don't hide behind fixed input + selector */
    .messages-container {
        padding-bottom: 180px !important;
    }

    /* Sidebar right (reports) - full screen on mobile */
    .sidebar-right {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Welcome screen mobile */
    .welcome-card {
        margin: 12px !important;
        padding: 20px !important;
        max-width: calc(100% - 24px) !important;
    }

    /* Quick replies - wrap on mobile */
    .quick-replies {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .quick-reply-btn {
        font-size: 14px !important;
        padding: 10px 16px !important;
    }
}

/* Sidebar backdrop for mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 5000;
    cursor: pointer;
}
@media (max-width: 767px) {
    .header {
        padding: 0px 12px 0px 20px;
    }
    .sidebar-backdrop.active {
        display: block !important;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar {
        width: 260px !important;
    }
}

/* ===== QUICK REPLIES - expand upward ===== */
.chat-input {
    position: relative;
    overflow: visible !important;
}
#quickRepliesContainer {
    position: absolute !important;
    bottom: calc(100% + 4px) !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    background: #fff !important;
    border-radius: 12px 12px 0 0 !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05) !important;
    z-index: 101 !important;
    padding: 12px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: center !important;
}
#quickRepliesContainer.breed-selector-mode {
    max-height: 350px !important;
    overflow: hidden;
    flex-direction: column !important;
    z-index: 5002 !important;
}
#miniBreedsList {
    position: relative;
    max-height: 250px;
    overflow-y: auto;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap-reverse;
    align-content: flex-end;
    gap: 8px;
}

@media (max-width: 768px) {
    /* All quick replies open UPWARD on mobile - flush with screen edges, 1px above prompt */
    #quickRepliesContainer {
        position: fixed !important;
        bottom: 82px !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        background: #fff !important;
        border-radius: 0 !important;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.2) !important;
        z-index: 5001 !important;
        max-height: 45vh !important;
        overflow-y: auto !important;
        padding: 16px !important;
    }
    #quickRepliesContainer.breed-selector-mode {
        max-height: 55vh !important;
        z-index: 5002 !important;
        bottom: 82px !important;
    }
    #quickRepliesContainer.breed-selector-mode #miniBreedsList {
        max-height: 50vh;
    }
    /* React breed selector - same positioning as quick replies */
    #breedSearchContainer {
        position: fixed !important;
        bottom: 82px !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 5002 !important;
        border-radius: 0 !important;
    }
}

/* ========================================
   DEVICE-SPECIFIC MEDIA QUERIES REFERENCE
   ========================================

   Copy & uncomment needed device block:

   --- APPLE ---
   iPhone SE (375px):
   @media (min-width: 370px) and (max-width: 379px) { }

   iPhone 12/13/14 (390px):
   @media (min-width: 385px) and (max-width: 395px) { }

   iPhone 12/13/14 Plus (428px):
   @media (min-width: 425px) and (max-width: 435px) { }

   iPhone 15 Pro (393px):
   @media (min-width: 390px) and (max-width: 396px) { }

   iPhone 15 Pro Max (430px):
   @media (min-width: 428px) and (max-width: 432px) { }

   --- SAMSUNG ---
   Galaxy S8/S9 (360px):
   @media (max-width: 360px) { }

   Galaxy S21/S22 (384px):
   @media (min-width: 380px) and (max-width: 389px) { }

   Galaxy S23 (360px):
   @media (min-width: 358px) and (max-width: 365px) { }

   Galaxy S23 Ultra (412px):
   @media (min-width: 408px) and (max-width: 416px) { }

   --- GOOGLE ---
   Pixel 6/7 (412px):
   @media (min-width: 410px) and (max-width: 414px) { }

   Pixel 7 Pro (480px):
   @media (min-width: 476px) and (max-width: 484px) { }

   --- PRECISE DEVICE TARGETING ---
   iPhone 12 Pro exact:
   @media only screen and (device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) { }

   iPhone 14 Pro Max exact:
   @media only screen and (device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) { }

======================================== */

/* ===== eDID PANEL - mobile optimized ===== */
#edidSlidePanel {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* Mobile eDID panel adjustments - reduced by 10% */
@media (max-width: 480px) {
    #edidSlidePanel {
        width: calc(100% - 32px) !important;
        max-width: none !important;
        left: 16px !important;
        right: 16px !important;
        transform: translateY(-100%) !important;
        padding: 10px !important;
    }
    #edidSlidePanel.edid-visible {
        transform: translateY(0) !important;
    }
    #edidSlidePanel .edid-photo {
        width: 65px !important;
        height: 65px !important;
        min-width: 65px !important;
        min-height: 65px !important;
        border-radius: 8px !important;
    }
    #edidSlidePanel .edid-qr {
        width: 85px !important;
        height: 85px !important;
    }
    #edidSlidePanel .edid-header {
        padding: 6px 10px !important;
        margin-bottom: 8px !important;
    }
    #edidSlidePanel .edid-header-title {
        font-size: 14px !important;
    }
    #edidSlidePanel .edid-title {
        font-size: 16px !important;
    }
    #edidSlidePanel .edid-drc-code {
        font-size: 11px !important;
        letter-spacing: 0.3px !important;
    }
    #edidSlidePanel .edid-pet-info {
        gap: 8px !important;
        margin-bottom: 8px !important;
    }
    #edidSlidePanel .edid-validity {
        gap: 12px !important;
        margin-bottom: 8px !important;
    }
}

/* Very small screens - reduced by 10% */
@media (max-width: 360px) {
    #edidSlidePanel {
        padding: 8px !important;
    }
    #edidSlidePanel .edid-photo {
        width: 55px !important;
        height: 55px !important;
        min-width: 55px !important;
        min-height: 55px !important;
    }
    #edidSlidePanel .edid-qr {
        width: 75px !important;
        height: 75px !important;
    }
    #edidSlidePanel .edid-drc-code {
        font-size: 10px !important;
    }
}

/* ===== TOUCH TARGETS - minimum 44px on mobile ===== */
@media (max-width: 768px) {
    .quick-reply-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }
    .btn-icon, .nav-btn, .menu-btn, .close-btn {
        min-width: 44px;
        min-height: 44px;
        text-align: right;
    }
    .chat-input {
        padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    }

    /* ========== CLAUDE-STYLE MOBILE UI ========== */
    /* Clean, spacious, readable - inspired by Claude app */

    /* Base - prevent horizontal scroll */
    body, html {
        font-size: 17px !important;
        -webkit-font-smoothing: antialiased;
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    /* Main layout - prevent overflow */
    #mainLayout, .app-container, .main-content, .chat-panel {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Messages area - full width, smooth scroll like reports panel */
    .messages {
        background: #F4F9FF !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
    }

    /* Message rows - more space between */
    .msg-row {
        margin-bottom: 20px !important;
        width: 100% !important;
    }

    /* Chat bubbles - wider on mobile */
    .msg-bubble {
        font-size: 15px !important;
        line-height: 1.6 !important;
        padding: 14px 16px !important;
        max-width: 92% !important;
        border-radius: 18px !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }
    .msg-bubble.ai {
        background: #FFFFFF !important;
        border: none !important;
        box-shadow: 0 5px 5px rgba(0,0,0,0.02) !important;
        border-radius: 24px 24px 24px 0px !important;
    }
    .msg-bubble.user {
        background: #67BDFB !important;
        border-radius: 24px 24px 0px 24px !important;
        box-shadow: 0 5px 5px rgba(0,0,0,0.06) !important;
    }
    .msg-bubble p, .msg-bubble li, .msg-bubble span {
        font-size: 15px !important;
        line-height: 1.6 !important;
    }
    .msg-bubble h3, .msg-bubble h4 {
        font-size: 18px !important;
        font-weight: 600 !important;
        margin-top: 16px !important;
        margin-bottom: 8px !important;
    }
    .msg-bubble h3:first-child, .msg-bubble h4:first-child {
        margin-top: 0 !important;
    }
    .msg-bubble ul, .msg-bubble ol {
        margin: 16px 0px 0px 0px !important;
        padding-left: 0px !important;
    }
    .msg-bubble li {
        margin-bottom: 8px !important;
    }

    /* Avatars - slightly larger */
    .msg-avatar {
        width: 28px !important;
        height: 28px !important;
    }

    /* Time - subtle */
    .msg-time {
        font-size: 12px !important;
        color: #9CA3AF !important;
    }

    /* Input area */
    #messageInput, .message-input, input, textarea {
        font-size: 15px !important;
        padding: 14px 16px !important;
    }
    .chat-input {
        padding: 12px 16px !important;
        background: #FFFFFF !important;
        border-top: 1px solid #E5E7EB !important;
    }

    /* Send button */
    .send-btn, #sendBtn {
        width: 44px !important;
        height: 44px !important;
    }

    /* Quick replies - pill style */
    .quick-reply-btn {
        font-size: 15px !important;
        padding: 12px 20px !important;
        border-radius: 12px !important;
        background: #ffffff !important;
        border: solid 1px #67BDFB !important;
        color: #67BDFB !important;
    }

    /* Navigation */
    .nav-header-text, .sidebar-title {
        font-size: 18px !important;
        font-weight: 600 !important;
    }
    .pet-name, #petNameDisplay {
        font-size: 14px !important;
    }
    .pet-breed, #petBreedDisplay {
        font-size: 12px !important;
        color: #6B7280 !important;
    }
}
/* iPhone 12 Pro override for pet selector fonts */
@media (min-width: 385px) and (max-width: 395px) {
    .pet-name, #petNameDisplay {
        font-size: 10px !important;
    }
    .pet-breed, #petBreedDisplay {
        font-size: 9px !important;
    }
    /* Quick replies - 1px above prompt on iPhone 12 Pro, flush with edges */
    #quickRepliesContainer {
        position: fixed !important;
        bottom: 85px !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        z-index: 5001 !important;
        border-radius: 0 !important;
    }
    #quickRepliesContainer.breed-selector-mode {
        position: fixed !important;
        bottom: 85px !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        z-index: 5002 !important;
        border-radius: 0 !important;
    }
    #breedSearchContainer {
        bottom: 85px !important;
        left: 0 !important;
        right: 0 !important;
        border-radius: 0 !important;
    }
}

@media (max-width: 768px) {
    /* Sidebar */
    .conversation-title, .conv-title {
        font-size: 16px !important;
    }
    .conversation-date, .conv-date, .conv-preview {
        font-size: 14px !important;
    }

    /* Reports */
    .report-title, .error-title {
        font-size: 16px !important;
    }
    .report-desc, .error-desc, .report-meta {
        font-size: 15px !important;
    }

    /* Modals */
    .modal-title, .dialog-title {
        font-size: 20px !important;
        font-weight: 600 !important;
    }
    .modal-body, .dialog-body {
        font-size: 16px !important;
    }

    /* Onboarding */
    .onboarding-header, .step-title {
        font-size: 20px !important;
    }
    .onboarding-subtitle, .step-desc {
        font-size: 16px !important;
    }

    /* Labels */
    label, .label, .hint, .helper-text {
        font-size: 15px !important;
    }

    /* Badges */
    .badge, .chip, .tag, .status-badge {
        font-size: 13px !important;
        padding: 6px 12px !important;
        border-radius: 16px !important;
    }

    /* Welcome */
    .welcome-title {
        font-size: 24px !important;
        font-weight: 600 !important;
    }
    .welcome-subtitle {
        font-size: 17px !important;
    }

    /* ===== TEXT FORMATTING ===== */
    .msg-bubble strong, .msg-bubble b {
        font-weight: 600 !important;
    }
    .msg-bubble em, .msg-bubble i {
        font-style: italic !important;
    }
    .msg-bubble code {
        font-size: 15px !important;
        padding: 3px 8px !important;
        background: #F3F4F6 !important;
        border-radius: 6px !important;
        font-family: ui-monospace, monospace !important;
    }
    .msg-bubble pre {
        font-size: 14px !important;
        padding: 14px !important;
        border-radius: 12px !important;
        margin: 12px 0 !important;
        overflow-x: auto !important;
    }
    .msg-bubble pre code {
        font-size: 14px !important;
        padding: 0 !important;
        background: transparent !important;
    }
    .msg-bubble blockquote {
        border-left: 4px solid #67BDFB !important;
        padding-left: 16px !important;
        margin: 12px 0 !important;
        color: #4B5563 !important;
    }

    /* ===== APPLE-STYLE TABLES (MOBILE) ===== */
    .msg-bubble .table-scroll-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin: 16px 0 !important;
        border-radius: 16px !important;
        background: #FFFFFF !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    }
    .msg-bubble table,
    .msg-bubble .chat-table {
        font-size: 15px !important;
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
        width: 100% !important;
    }
    .msg-bubble th,
    .msg-bubble td,
    .msg-bubble .chat-table th,
    .msg-bubble .chat-table td {
        padding: 14px 16px !important;
        border: none !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
        text-align: left !important;
        font-size: 15px !important;
    }
    .msg-bubble th,
    .msg-bubble .chat-table th {
        background: linear-gradient(180deg, #FAFAFA 0%, #F5F5F7 100%) !important;
        font-weight: 600 !important;
        font-size: 13px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.02em !important;
        color: #86868B !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    }
    .msg-bubble .chat-table tbody tr:last-child td {
        border-bottom: none !important;
    }
    .msg-bubble a {
        color: #2563EB !important;
        text-decoration: underline !important;
    }

    /* Buttons general */
    button, .btn {
        font-size: 16px !important;
        font-weight: 500 !important;
    }
}

/* ===== MINI CHOICES (onboarding inline forms) ===== */
.mini-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}
.mini-choice-btn {
    padding: 14px 20px;
    background: #F9FAFB;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    color: #3D3D3D;
    cursor: pointer;
    transition: all 0.2s ease;
}
.mini-choice-btn:hover {
    background: #EFF6FF;
    border-color: #67BDFB;
}
.mini-text-input, .mini-age-input, .mini-photo-input {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}
.mini-input {
    padding: 14px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}
.mini-input:focus {
    border-color: #67BDFB;
}
.mini-select {
    padding: 12px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-size: 15px;
    background: #fff;
    cursor: pointer;
}
.mini-submit-btn {
    padding: 14px 24px;
    background: linear-gradient(135deg, #67BDFB 0%, #4FA8E8 100%);
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.mini-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(103, 189, 251, 0.4);
}
.mini-photo-btn {
    padding: 16px 24px;
    background: #F0F9FF;
    border: 2px dashed #67BDFB;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    color: #67BDFB;
    cursor: pointer;
}
.mini-skip-btn {
    padding: 12px;
    background: transparent;
    border: none;
    font-size: 14px;
    color: #9CA3AF;
    cursor: pointer;
}
.mini-complete {
    text-align: center;
    padding: 20px;
}
.mini-complete p {
    margin: 0 0 16px;
    font-size: 16px;
    color: #3D3D3D;
}
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #E5E7EB;
    border-top-color: #67BDFB;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== REFERRAL MODAL ===== */
.referral-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.referral-modal {
    position: relative;
    background: #fff;
    border-radius: 20px;
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.referral-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #F3F4F6;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: #6B7280;
    z-index: 1;
}
.referral-modal-close:hover {
    background: #E5E7EB;
}
.referral-step {
    padding: 32px 24px;
    text-align: center;
}
.referral-step h3 {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 600;
    color: #1F2937;
}
.referral-step p {
    margin: 0 0 24px;
    font-size: 14px;
    color: #6B7280;
    line-height: 1.5;
}
.referral-points-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}
.points-bubble {
    padding: 16px 20px;
    border-radius: 16px;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: bounceIn 0.5s ease;
}
.points-bubble.referrer {
    background: linear-gradient(135deg, #67BDFB 0%, #3B82F6 100%);
    color: #fff;
}
.points-bubble.referred {
    background: linear-gradient(135deg, #A4D477 0%, #22C55E 100%);
    color: #fff;
}
.points-bubble span {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
}
.points-connector {
    font-size: 32px;
    animation: pulse 1.5s infinite;
}
@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}
.referral-btn {
    width: 100%;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}
.referral-btn.primary {
    background: linear-gradient(135deg, #67BDFB 0%, #3B82F6 100%);
    border: none;
    color: #fff;
}
.referral-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(103, 189, 251, 0.4);
}
.referral-btn.primary:disabled {
    background: #E5E7EB;
    color: #9CA3AF;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.referral-btn.secondary {
    background: #F0F9FF;
    border: 2px solid #67BDFB;
    color: #3B82F6;
}
.referral-btn.secondary:hover {
    background: #E0F2FE;
}
.referral-btn.ghost {
    background: transparent;
    border: none;
    color: #6B7280;
}
.referral-btn.ghost:hover {
    background: #F3F4F6;
}
.share-method-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.share-method-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    color: #374151;
}
.share-method-btn:hover {
    border-color: #67BDFB;
    background: rgba(103, 189, 251, 0.05);
}
.share-method-btn .share-icon {
    font-size: 24px;
}
.share-divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
    color: #9CA3AF;
    font-size: 12px;
}
.share-divider::before,
.share-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #E5E7EB;
}
.share-divider span {
    padding: 0 12px;
}
.contact-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.contact-tab {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #E5E7EB;
    background: #fff;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: #6B7280;
}
.contact-tab:hover {
    border-color: #67BDFB;
}
.contact-tab.active {
    background: #67BDFB;
    border-color: #67BDFB;
    color: #fff;
    font-weight: 600;
}
.contact-textarea,
.message-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
}
.contact-textarea:focus,
.message-textarea:focus {
    outline: none;
    border-color: #67BDFB;
}
.contact-counter {
    text-align: right;
    font-size: 12px;
    color: #6B7280;
    margin-top: 8px;
}
.referral-step-footer {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}
.referral-step-footer .referral-btn {
    margin-bottom: 0;
}
.referral-back-btn {
    background: none;
    border: none;
    color: #6B7280;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 0;
}
.referral-back-btn:hover {
    color: #374151;
}
.success-animation {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bounceIn 0.5s ease;
}
.sent-invites-list {
    text-align: left;
    background: #F9FAFB;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    max-height: 150px;
    overflow-y: auto;
}
.sent-invite-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #E5E7EB;
    font-size: 14px;
}
.sent-invite-item:last-child {
    border-bottom: none;
}
.sent-invite-status {
    color: #F59E0B;
}
.message-preview {
    margin-top: 16px;
    padding: 16px;
    background: #F9FAFB;
    border-radius: 12px;
    text-align: left;
    font-size: 13px;
    color: #374151;
    white-space: pre-wrap;
}
/* Selected contacts from picker */
.selected-contacts-list {
    margin-top: 16px;
    max-height: 200px;
    overflow-y: auto;
}
.selected-contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #F9FAFB;
    border-radius: 8px;
    margin-bottom: 8px;
}
.selected-contact-item .contact-name {
    font-weight: 500;
    color: #1F2937;
    flex: 1;
}
.selected-contact-item .contact-value {
    font-size: 12px;
    color: #6B7280;
}
.selected-contact-item .remove-contact {
    width: 24px;
    height: 24px;
    border: none;
    background: #E5E7EB;
    border-radius: 50%;
    color: #6B7280;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.selected-contact-item .remove-contact:hover {
    background: #EF4444;
    color: #fff;
}
/* Referral floating button (for sidebar) */
.referral-fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #67BDFB 0%, #3B82F6 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(103, 189, 251, 0.4);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: all 0.3s;
}
.referral-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(103, 189, 251, 0.5);
}
.referral-fab-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #1F2937;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.referral-fab:hover .referral-fab-tooltip {
    opacity: 1;
}