/* =========
   Theme tokens
   ========= */
:root {
    --bg-body: #020617;
    --bg-elevated: #02081f;
    --bg-elevated-soft: #020a27;
    --bg-glass: rgba(15, 23, 42, 0.8);
    --bg-pill: rgba(37, 99, 235, 0.18);

    --border-subtle: rgba(148, 163, 184, 0.2);

    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.15);
    --accent-strong: #38bdf8;

    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-invert: #020617;
    --text-highlight: #f97316;

    --danger: #f97373;
    --success: #4ade80;
    --warning: #facc15;

    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-pill: 999px;

    --shadow-soft: 0 18px 70px rgba(15, 23, 42, 0.8);
    --shadow-subtle: 0 10px 40px rgba(15, 23, 42, 0.6);

    --font-base: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

/* =========
   App body & background
   ========= */
body.app-body {
    min-height: 100vh;
    font-family: var(--font-base);
    color: var(--text-primary);
    background:
        radial-gradient(circle at top left, #172554 0, #020617 55%, #020617 100%),
        linear-gradient(135deg, #0b1120, #020617);
}

.app-gradient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.09), transparent 65%),
        radial-gradient(circle at 0% 80%, rgba(37, 99, 235, 0.22), transparent 70%);
    z-index: -1;
}

/* =========
   Header
   ========= */
.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(
        to right,
        rgba(15, 23, 42, 0.96),
        rgba(15, 23, 42, 0.98)
    );
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    backdrop-filter: blur(18px);
}

.app-header-inner {
   padding: 4px 32px;   /* reduced top/bottom padding */
    height: 72px;        /* hard-lock header height */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* =========
   BRAND GROUP
   ========= */
.brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ================================
   FINAL FIX — ENLARGED HRIA LOGO
   ================================ */
/* ================================
   FIX — Enlarge HRIA logo ONLY in chat header
   ================================ */
.app-header .brand-logo {
    width: 40px !important;
    height: 40px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 40px;
    background: none !important;
    object-fit: contain;
    transition: 0.25s ease;
}

.app-header .brand-logo:hover {
    transform: scale(1.07);
}

/* Scale the actual image ONLY in the header */
.app-header .brand-logo img {
    width: 40px !important;
    height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    object-fit: contain !important;
    background: none !important;
}

/* Tone down text ONLY in header */
.app-header .brand-title {
    font-size: 1.1rem;
    opacity: 0.85;
}

.app-header .brand-subtitle {
    font-size: 0.75rem;
    opacity: 0.6;
}

/* =========
   USER INFO
   ========= */
.user-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 500;
}

.user-role {
    font-size: 0.75rem;
    color: var(--accent-strong);
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
}

/* Logout button */
.logout-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.65);
    background: rgba(15, 23, 42, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.16s ease-out;
}

.logout-btn:hover {
    background: rgba(37, 99, 235, 0.16);
    border-color: var(--accent);
    color: var(--accent-strong);
    transform: translateY(-0.5px);
}

/* =========
   SHELL
   ========= */
.app-shell {
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px 40px;
}

/* (ALL REMAINING SECTIONS BELOW ARE UNCHANGED) */
/* ... AUTH PAGE STYLES ... */
/* ... CHAT WRAPPER ... */
/* ... TABLES ... */
/* ... DOWNLOAD BUTTONS ... */
/* ... EMPTY STATES ... */
/* ... RESPONSIVE RULES ... */

/* Restore normal logo size on login page */
/* ===========================================
   FIX LOGIN PAGE LOGO SIZE (highest priority)
   =========================================== */

body.login-page .brand-logo,
body.login-page .brand-logo img {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    filter: none !important;
    transform: none !important;
    background: none !important;
}

/* =========
   AUTH PAGES (Login/Signup)
   ========= */
.auth-wrapper {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-soft);
}

.auth-header {
    margin-bottom: 32px;
    text-align: center;
}

.auth-kicker {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-strong);
    margin: 0 0 12px;
}

.auth-title {
    font-size: 1.85rem;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--text-primary);
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.field-input {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    font-family: var(--font-base);
}

.field-input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.field-input::placeholder {
    color: var(--text-muted);
}

.auth-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -8px;
}

.remember-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.remember-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.remember-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.link-inline {
    color: var(--accent-strong);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.link-inline:hover {
    color: var(--accent);
}

.auth-submit-btn {
    margin-top: 8px;
    padding: 14px;
    font-size: 0.95rem;
    font-weight: 600;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer span {
    margin-right: 6px;
}

/* =========
   BUTTONS
   ========= */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-base);
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-full {
    width: 100%;
}

/* =========
   UTILITIES
   ========= */
.small-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =========================================
   Send Button & Icon - Larger Size Without Expanding Bar
   ========================================= */
.send-btn {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 58px;
    width: 58px;
    cursor: pointer;
    line-height: 0;
}

.send-icon {
    width: 58px;
    height: 58px;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
    display: block;
}

.send-icon:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.send-icon:active {
    transform: scale(0.95);
}
/* =========================================
   PROFILE DROPDOWN - Replace Logout Button
   ========================================= */

/* Profile dropdown container */
.profile-dropdown {
    position: relative;
}

/* Profile button with avatar */
.profile-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.95);
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-btn:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.profile-btn:active {
    transform: translateY(0);
}

/* Avatar inside button */
.profile-avatar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 18px;
    text-transform: uppercase;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Dropdown menu */
.profile-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.profile-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown arrow */
.profile-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: var(--bg-elevated);
    border-left: 1px solid var(--border-subtle);
    border-top: 1px solid var(--border-subtle);
    transform: rotate(45deg);
}

/* Menu items */
.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
}

.profile-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-strong);
}

.profile-menu-item:active {
    transform: scale(0.98);
}

.menu-icon {
    font-size: 18px;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Menu divider */
.profile-menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 8px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .profile-btn {
        width: 42px;
        height: 42px;
    }
    
    .profile-avatar {
        font-size: 16px;
    }
}
