/* ============================================
   MASTERFUL COACHING AI - Figma Design System
   Warm Light Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    /* Colors */
    --bg:            #f5f3f0;
    --surface:       #ffffff;
    --accent:        #3874FF;
    --accent-hover:  #225ce6;
    --accent-rgb:    56, 116, 255;
    --text-dark:     #2c2519;
    --text-mid:      #6b5e4f;
    --text-muted:    #897566;
    --border:        #e5e1db;
    --input-border:  #d4cfc7;
    --success:       #4caf50;
    --error:         #ef5350;
    --live-green:    #22c55e;

    /* Avatar gradient */
    --avatar-gradient: linear-gradient(135deg, #3874FF 0%, #1a56e8 100%);

    /* Logo gradient */
    --logo-gradient: linear-gradient(180deg, #9a6b2c 0%, #a8762e 50%, #c9a870 100%);

    /* Radii */
    --radius-lg: 16px;
    --radius:    12px;
    --radius-sm: 8px;

    /* Sidebar */
    --sidebar-w: 288px;

    /* Shadows */
    --shadow-sm:  0 1px 4px rgba(44,37,25,0.08);
    --shadow:     0 4px 24px rgba(44,37,25,0.10);
    --shadow-lg:  0 8px 40px rgba(44,37,25,0.16);

    --transition: all 0.2s ease;
}

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

html, body {
    height: 100%;
    font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-dark); }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; color: var(--text-dark); }
h3 { font-size: 1rem;    font-weight: 600; color: var(--text-dark); }

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px;
    border: none; border-radius: var(--radius);
    font-family: inherit; font-size: 0.875rem; font-weight: 500;
    cursor: pointer; transition: var(--transition);
    text-decoration: none; white-space: nowrap;
}
.btn-primary {
    background: var(--accent); color: #ffffff;
}
.btn-primary:hover { background: var(--accent-hover); color: #ffffff; }

.btn-outline {
    background: transparent; color: var(--text-mid);
    border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
    background: transparent; color: var(--text-muted);
    border: none;
}
.btn-ghost:hover { background: var(--bg); color: var(--text-dark); }

.btn-full  { width: 100%; }
.btn-sm    { padding: 6px 14px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg    { padding: 14px 28px; font-size: 1rem; }

.btn-icon {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 7px; border-radius: var(--radius-sm);
    transition: var(--transition); display: inline-flex; align-items: center;
}
.btn-icon:hover { color: var(--text-dark); background: var(--bg); }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; margin-bottom: 6px;
    font-size: 0.8rem; font-weight: 500; color: var(--text-mid);
    letter-spacing: 0.01em;
}
.form-input {
    width: 100%; padding: 11px 14px;
    background: var(--surface); color: var(--text-dark);
    border: 1px solid var(--input-border); border-radius: var(--radius);
    font-family: inherit; font-size: 0.9rem;
    transition: var(--transition); outline: none;
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.12);
}
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 12px 16px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: 0.875rem; font-weight: 500;
}
.alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
    background: var(--bg); color: var(--text-muted);
    border: 1px solid var(--border);
}
.badge-en      { background: rgba(var(--accent-rgb),0.1); color: var(--accent); border-color: transparent; }
.badge-ko      { background: rgba(var(--accent-rgb),0.1); color: var(--accent); border-color: transparent; }
.badge-active  { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.badge-closed  { background: var(--bg); color: var(--text-muted); }
.badge-book    { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.badge-article { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.badge-course  { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-other        { background: var(--bg); color: var(--text-muted); border-color: var(--border); }
.badge-session-lang { background: rgba(var(--accent-rgb),0.1); color: var(--accent); border-color: rgba(var(--accent-rgb),0.2); }
.badge-indexing     { background: #1e3a5f; color: #7dd3fc; border-color: #2563eb; gap: 6px; }
.badge-deleting     { background: #3a1e1e; color: #fca5a5; border-color: #dc2626; gap: 6px; }
.badge-deleting .indexing-spinner { border-color: #fca5a5; border-top-color: transparent; }
.indexing-spinner {
    display: inline-block; width: 10px; height: 10px;
    border: 2px solid #7dd3fc; border-top-color: transparent;
    border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.session-id-cell    { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.85rem; color: #4a5565; }
.td-topic           { font-weight: 500; color: #101828; }
.td-mid             { color: #4a5565; }
.td-muted           { color: var(--text-muted); }

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #2c2519 0%, #3d3128 50%, #2c2519 100%);
    display: flex; align-items: stretch;
}

/* Left hero panel */
.auth-hero {
    flex: 1; display: flex; flex-direction: column;
    justify-content: center; padding: 80px 64px;
    position: relative;
}
.auth-hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.12); color: #ffffff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px; padding: 6px 16px;
    font-size: 0.8rem; font-weight: 500; margin-bottom: 48px;
    width: fit-content;
}
.auth-hero h1 {
    font-size: 3.5rem; font-weight: 700; line-height: 1.1;
    letter-spacing: -0.03em; color: #ffffff; margin-bottom: 24px;
}
.auth-hero h1 .gradient-text {
    background: linear-gradient(90deg, #ffffff, var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-hero-sub {
    font-size: 1.05rem; color: rgba(255,255,255,0.65);
    line-height: 1.7; max-width: 480px;
}

/* Right card panel */
.auth-panel {
    width: 480px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 48px;
    background: rgba(255,255,255,0.04);
    border-left: 1px solid rgba(255,255,255,0.08);
}
.auth-card {
    background: var(--surface); border-radius: var(--radius-lg);
    padding: 40px; width: 100%;
    box-shadow: var(--shadow-lg);
}
.auth-card-header { margin-bottom: 28px; }
.auth-card-header h2 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-muted); font-size: 0.875rem; }

/* Language toggle in auth card */
.auth-lang-toggle {
    display: flex; gap: 4px; margin-bottom: 28px;
    background: var(--bg); border-radius: var(--radius);
    padding: 4px;
}
.auth-lang-btn {
    flex: 1; padding: 7px 12px;
    border: none; border-radius: var(--radius-sm);
    font-family: inherit; font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: var(--transition);
    color: var(--text-muted); background: transparent;
}
.auth-lang-btn.active {
    background: var(--accent); color: #ffffff;
    box-shadow: var(--shadow-sm);
}
.auth-lang-btn:hover:not(.active) { color: var(--text-dark); }

.auth-footer { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 0.85rem; }
.auth-footer a { color: var(--accent); font-weight: 500; }
.auth-footer a:hover { color: var(--accent-hover); }
.auth-admin-link {
    display: block; text-align: center; margin-top: 12px;
    font-size: 0.8rem; color: var(--text-muted);
}
.auth-admin-link:hover { color: var(--text-dark); }

/* Simpler centered auth (profile, signup) */
.auth-centered {
    min-height: 100vh; background: var(--bg);
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-center-card {
    background: var(--surface); border-radius: var(--radius-lg);
    padding: 40px; width: 100%; max-width: 500px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.auth-center-card .auth-logo {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 28px;
}
.auth-logo-icon {
    width: 44px; height: 44px; border-radius: var(--radius);
    background: var(--logo-gradient);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; color: #fff;
    flex-shrink: 0;
}
.auth-logo-text { font-weight: 700; font-size: 1rem; color: var(--text-dark); line-height: 1.2; }
.auth-logo-sub  { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }

/* ============================================
   COACHING INTERFACE
   ============================================ */
.coaching-page  { height: 100vh; overflow: hidden; background: var(--bg); }
.coaching-layout { display: flex; height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w); background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-logo { display: flex; align-items: center; gap: 12px; }
.sidebar-logo-icon {
    flex-shrink: 0;
}
.sidebar-logo-name { font-weight: 600; font-size: 22px; color: var(--text-dark); line-height: 1.2; letter-spacing: -0.025em; }
.sidebar-logo-sub  { font-size: 11px; color: #6b5e4f; font-weight: 400; }

.sidebar-actions {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px;
}
.btn-new-session {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 14px;
    background: var(--accent); color: #ffffff;
    border: none; border-radius: 16px;
    font-family: inherit; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: var(--transition); text-decoration: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.1);
}
.btn-new-session:hover { background: var(--accent-hover); color: #ffffff; }
.btn-delete-all {
    flex-shrink: 0;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 12px; cursor: pointer;
    color: var(--text-muted); transition: var(--transition);
}
.btn-delete-all:hover { background: rgba(239,83,80,0.08); border-color: var(--error); color: var(--error); }

.session-list {
    flex: 1; overflow-y: auto; padding: 4px 12px 8px;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.session-group-label {
    font-size: 11px; font-weight: 600; color: #897566;
    text-transform: uppercase; letter-spacing: 0.025em;
    padding: 24px 12px 4px;
}
.session-item {
    display: flex; align-items: center;
    border-radius: 16px; margin-bottom: 4px;
    color: #2c2519; transition: var(--transition);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.session-item.active {
    background: rgba(240,238,231,0.5);
    border: 1px solid #d4cfc7;
}
.session-link {
    flex: 1; min-width: 0;
    padding: 10px 12px;
    text-decoration: none; color: #2c2519;
    touch-action: manipulation;
}
.session-link:hover { color: #2c2519; }
.btn-del-session {
    flex-shrink: 0;
    opacity: 0; visibility: hidden;
    background: none; border: none; cursor: pointer;
    padding: 6px 8px; margin-right: 6px;
    color: var(--text-muted); border-radius: var(--radius-sm);
    transition: var(--transition); line-height: 1;
}
/* Hover effects only on real pointer devices — prevents iOS double-tap bug */
@media (hover: hover) {
    .session-item:hover { background: rgba(240,238,231,0.5); }
    .session-item:hover .btn-del-session { opacity: 1; visibility: visible; }
    .btn-del-session:hover { color: var(--error); background: rgba(239,83,80,0.1); }
}
.session-title {
    display: block; font-size: 14px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-meta { font-size: 12px; color: #6b5e4f; margin-top: 2px; font-weight: 500; }
.empty-state { color: var(--text-muted); font-size: 0.85rem; padding: 24px 8px; text-align: center; }
.session-load-more {
    display: flex; justify-content: center; padding: 12px 0;
}
.session-load-spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--border); border-top-color: var(--text-muted);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Confirmation modal */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35); backdrop-filter: blur(3px);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.visible { opacity: 1; pointer-events: all; }
.modal-box {
    background: var(--surface); border-radius: var(--radius-lg);
    padding: 28px 28px 24px; max-width: 380px; width: 90%;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95); transition: transform 0.2s;
}
.modal-overlay.visible .modal-box { transform: scale(1); }
.modal-title { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: var(--text-dark); }
.modal-desc { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 24px; line-height: 1.55; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-btn-danger { background: var(--error); color: #fff; border: none; }
.modal-btn-danger:hover { background: #d32f2f; color: #fff; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}
.user-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius);
    background: var(--bg); border: 1px solid var(--border);
}
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--avatar-gradient);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 0.85rem; font-weight: 600; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-sub   { font-size: 0.72rem; color: var(--text-muted); }
.user-actions { display: flex; gap: 2px; }

.btn-admin-link {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px; margin-bottom: 10px;
    background: rgba(var(--accent-rgb),0.08); color: var(--accent);
    border: 1px solid rgba(var(--accent-rgb),0.2); border-radius: var(--radius);
    font-size: 0.8rem; font-weight: 500; transition: var(--transition);
    text-decoration: none;
}
.btn-admin-link:hover { background: rgba(var(--accent-rgb),0.15); color: var(--accent); }

/* ---- Top header bar ---- */
.chat-header {
    padding: 14px 24px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
    background: var(--surface);
}
.header-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.chat-header h2 { font-size: 18px; font-weight: 700; color: #2c2519; letter-spacing: -0.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 8px; border-radius: 4px;
    font-size: 10px; font-weight: 700;
    background: #ecfdf5; color: #007a55; border: none;
    letter-spacing: 0.05em; text-transform: uppercase;
}
.live-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--live-green);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

.header-lang {
    display: flex; gap: 4px; margin-left: auto;
}
.header-lang-btn {
    padding: 5px 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: transparent;
    font-family: inherit; font-size: 0.78rem; font-weight: 500;
    color: var(--text-muted); cursor: pointer; transition: var(--transition);
}
.header-lang-btn.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
.header-lang-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

.sidebar-open { display: none; }

/* ---- Header user avatar + dropdown ---- */
.header-user-menu { position: relative; flex-shrink: 0; }
.header-avatar-btn {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--avatar-gradient); border: none;
    font-size: 0.72rem; font-weight: 700; color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.header-user-dropdown {
    display: none;
    position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); min-width: 180px;
    box-shadow: var(--shadow); z-index: 300;
    overflow: hidden;
}
.header-user-dropdown.open { display: block; }
.header-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; font-size: 0.875rem; font-weight: 500;
    color: var(--text-dark); text-decoration: none;
    transition: background 0.15s;
}
.header-dropdown-item:hover { background: var(--bg); color: var(--text-dark); }
.header-dropdown-item + .header-dropdown-item { border-top: 1px solid var(--border); }
.header-dropdown-logout { color: #b91c1c; }
.header-dropdown-logout:hover { background: #fef2f2; color: #b91c1c; }

/* ---- Chat Main ---- */
.chat-main {
    flex: 1; display: flex; flex-direction: column;
    min-width: 0; background: var(--bg);
}

/* ---- Messages ---- */
.chat-messages {
    flex: 1; overflow-y: auto; padding: 32px 40px;
    display: flex; flex-direction: column; gap: 20px;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.message {
    display: flex; gap: 14px;
    animation: fadeIn 0.25s ease;
}
.message-user      { align-self: flex-end; flex-direction: row-reverse; max-width: 75%; }
.message-assistant { align-self: flex-start; max-width: 80%; min-width: 220px; }

.message-avatar {
    width: 34px; height: 34px; border-radius: 16px;
    background: var(--logo-gradient);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.message-content { flex: 1; min-width: 0; }
.message-text {
    padding: 14px 18px; border-radius: var(--radius-lg);
    line-height: 1.7; font-size: 0.9rem;
    white-space: pre-wrap; word-wrap: break-word;
}
.message-user .message-text {
    background: #f0eee7; color: #2c2519;
    border: 1px solid #e5e1db;
    border-radius: 24px; padding: 12px 20px;
}
.message-assistant .message-text {
    background: transparent; border: none; padding: 0;
    color: #2c2519; font-size: 0.9375rem; line-height: 1.6;
}
.message-cap {
    display: inline-block; margin-top: 6px;
    font-size: 0.68rem; color: var(--text-muted);
    padding: 2px 8px; background: var(--bg);
    border: 1px solid var(--border); border-radius: 10px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Welcome Screen ---- */
.chat-messages-welcome {
    justify-content: center;
}
.welcome-screen {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 40px;
}
.welcome-content { text-align: center; max-width: 672px; width: 100%; }
.welcome-greeting {
    font-size: 2.625rem; font-weight: 600; color: #2c2519;
    margin-bottom: 8px; letter-spacing: -0.02em;
}
.welcome-help {
    font-size: 15px; color: #6b5e4f; margin-bottom: 24px;
}
.welcome-input-wrap { margin-bottom: 20px; }
.welcome-prompts {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.welcome-prompts .prompt-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    width: calc(50% - 6px);
    margin: 0 auto;
}
.prompt-card {
    background: white; border: 1px solid #e5e1db;
    border-radius: 16px; padding: 17px 18px;
    cursor: pointer; transition: var(--transition);
    text-align: left; font-family: inherit;
    color: var(--text-mid); font-size: 0.875rem;
    display: flex; flex-direction: row; align-items: flex-start; gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.06);
}
.prompt-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(var(--accent-rgb),0.15);
    transform: translateY(-1px);
}
.prompt-icon-wrap {
    width: 32px; height: 32px; border-radius: 12px; flex-shrink: 0;
    background: #f5f3f0;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
}
.prompt-text {
    display: flex; flex-direction: column; gap: 4px; padding-top: 2px;
}
.prompt-label {
    font-weight: 500; color: #2c2519; font-size: 14px;
}
.prompt-desc {
    font-size: 12px; color: #6b5e4f; line-height: 1.5; font-weight: 500;
}

/* ---- Chat Input ---- */
.chat-input-area {
    padding: 16px 40px 28px; background: var(--bg);
}
.chat-form { max-width: 760px; margin: 0 auto; }
.input-wrapper {
    position: relative;
    background: var(--surface); border: 1.5px solid #8ab4ff;
    border-radius: var(--radius-lg); padding: 10px 14px 42px 14px;
    transition: var(--transition); box-shadow: var(--shadow-sm);
    min-height: 72px;
}
.input-wrapper:focus-within {
    border-color: #6393ff;
    box-shadow: 0 0 0 3px rgba(99, 147, 255, 0.15);
}
.input-wrapper textarea {
    width: 100%; background: none; border: none; color: var(--text-dark);
    font-family: inherit; font-size: 0.9rem; line-height: 1.5;
    resize: none; outline: none; max-height: 160px;
    scrollbar-width: thin;
}
.input-wrapper textarea::placeholder { color: var(--text-muted); }
.btn-send {
    position: absolute; bottom: 12px; right: 12px;
    width: 36px; height: 36px; border-radius: 12px;
    background: #6393ff; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition);
}
.btn-send:hover   { background: #4a7eef; }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-send svg { stroke: #ffffff; }
.input-actions {
    position: absolute; bottom: 10px; right: 56px;
    display: flex; gap: 2px; align-items: center;
}
.input-below-row {
    max-width: 760px; margin: 6px auto 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 4px;
}
.input-icons { display: flex; gap: 4px; }
.input-hint { font-size: 0.75rem; color: var(--text-muted); }

/* ---- Web-Search pill toggle ---- */
.ws-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px 5px 8px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    user-select: none;
    transition: all 0.22s ease;
    font-family: inherit;
}
.ws-pill:hover {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.04);
}
.ws-pill.active {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.10);
}
.ws-pill-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: color 0.22s ease;
    flex-shrink: 0;
}
.ws-pill.active .ws-pill-icon {
    color: var(--accent);
}
.ws-pill-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.22s ease;
    white-space: nowrap;
}
.ws-pill.active .ws-pill-text {
    color: var(--accent);
    font-weight: 600;
}

/* ---- Typing / thinking indicator ---- */
.thinking-indicator {
    display: flex; align-items: flex-end; gap: 5px;
    padding: 10px 16px 10px 0;
}
.thinking-text {
    font-size: 0.85rem; color: var(--text-muted);
    font-style: italic; letter-spacing: 0.01em;
    transition: opacity 0.2s ease;
}
.thinking-dots {
    display: flex; gap: 4px; align-items: center;
}
.thinking-dots span {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--accent); opacity: 0.4;
    animation: thinking-bounce 1.4s infinite both;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.18s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes thinking-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30%            { transform: translateY(-5px); opacity: 1; }
}
/* pulse the bot avatar while thinking */
.message-thinking .message-avatar {
    animation: avatar-pulse 2s ease-in-out infinite;
}
@keyframes avatar-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.08); }
}

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-page   { background: var(--bg); }
.admin-layout { display: flex; min-height: 100vh; }

/* ---- Admin Sidebar ---- */
.admin-sidebar {
    width: var(--sidebar-w); background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; flex-shrink: 0;
}
.admin-sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
}
.admin-logo-title { font-weight: 700; font-size: 0.95rem; color: var(--text-dark); }
.admin-logo-sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.admin-nav {
    flex: 1; padding: 12px;
    list-style: none;
}
.admin-nav li + li { margin-top: 2px; }
.admin-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: var(--radius);
    color: var(--text-mid); font-size: 0.875rem; font-weight: 500;
    transition: var(--transition); text-decoration: none;
}
.admin-nav a:hover { background: var(--bg); color: var(--text-dark); }
.admin-nav a.active {
    background: var(--accent); color: #ffffff;
}
.admin-nav a.active svg { stroke: #ffffff; }
.admin-nav a:hover:not(.active) svg { stroke: var(--text-dark); }
.admin-nav-icon { display: flex; align-items: center; flex-shrink: 0; }

.admin-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}
.admin-logout-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; width: 100%;
    background: transparent; color: var(--text-muted);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-family: inherit; font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: var(--transition); text-decoration: none;
}
.admin-logout-btn:hover { border-color: #fca5a5; color: #b91c1c; background: #fef2f2; }

/* ---- Admin Main ---- */
.admin-main {
    flex: 1; overflow-y: auto; background: var(--bg);
}
.admin-content { padding: 36px 40px; max-width: 1200px; }

.admin-page-header { margin-bottom: 28px; }
.admin-page-header-row {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.admin-header-actions { display: flex; gap: 10px; flex-shrink: 0; align-items: flex-start; }
.admin-page-title  { font-size: 1.875rem; font-weight: 700; color: #101828; margin-bottom: 4px; }
.admin-page-sub    { font-size: 1rem; color: #4a5565; }

/* Admin search bar */
.admin-search-form { margin-bottom: 18px; }
.admin-search-row { display: flex; align-items: center; gap: 10px; max-width: 520px; }
.admin-search-wrap {
    position: relative; display: flex; align-items: center; flex: 1; min-width: 0;
}
.admin-search-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0; }
.admin-search-icon {
    position: absolute; left: 12px; color: #9aa5b4; pointer-events: none; flex-shrink: 0;
}
.admin-search-input {
    width: 100%; padding: 8px 36px 8px 36px;
    border: 1px solid #dde1e7; border-radius: 8px;
    font-size: 14px; color: #101828; background: #fff;
    outline: none; transition: border-color 0.15s;
}
.admin-search-input::placeholder { color: #9aa5b4; }
.admin-search-input:focus { border-color: var(--accent, #4f7cff); box-shadow: 0 0 0 3px rgba(79,124,255,0.1); }
.admin-search-clear {
    position: absolute; right: 10px; color: #9aa5b4; display: flex; align-items: center;
    text-decoration: none; transition: color 0.15s;
}
.admin-search-clear:hover { color: #4a5565; }

.admin-form-actions {
    display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 24px;
}
.admin-bottom-actions {
    display: flex; justify-content: center; gap: 12px; margin-top: 24px;
}

.admin-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; gap: 12px;
}

/* ---- Stats Cards ---- */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px; margin-bottom: 36px;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px 20px;
    box-shadow: var(--shadow-sm);
}
.stat-number {
    display: block; font-size: 2.2rem; font-weight: 700;
    color: var(--accent); letter-spacing: -0.02em;
}
.stat-label {
    font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; font-weight: 500;
}

/* ---- Admin Table ---- */
.table-wrap {
    background: rgba(255,255,255,0.8); border: 1px solid rgba(229,231,235,0.5);
    border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}
.admin-table {
    width: 100%; border-collapse: collapse;
}
.admin-table th {
    text-align: left; padding: 10px 8px;
    font-size: 14px; font-weight: 600; color: #101828;
    background: transparent;
    border-bottom: 1px solid rgba(229,231,235,0.5);
}
.admin-table td {
    padding: 16px 8px; border-top: 1px solid #f3f4f6;
    font-size: 14px; color: #101828;
    vertical-align: middle;
}
.admin-table tbody tr:hover td { background: #faf9f7; }
.admin-table .td-muted { color: #6a7282; }

.table-user-cell { display: flex; align-items: center; gap: 10px; }
.table-user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--avatar-gradient);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.65rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.table-user-name  { font-weight: 500; color: var(--text-dark); }
.table-user-email { font-size: 0.78rem; color: var(--text-muted); }

.table-actions { display: flex; gap: 8px; }
.table-icon-btn {
    width: 36px; height: 36px; border: none;
    border-radius: 12px; background: transparent;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition); text-decoration: none;
    color: var(--accent);
}
.table-icon-btn:hover { background: rgba(var(--accent-rgb),0.1); color: var(--accent); }
.table-icon-btn.danger:hover { background: #fef2f2; color: #b91c1c; }

/* Deactivate / reactivate button */
.deactivate-btn { color: var(--accent); }
.deactivate-btn:hover { background: rgba(239,68,68,0.08); color: #ef4444; }
.deactivate-btn.btn-reactivate { color: #16a34a; }
.deactivate-btn.btn-reactivate:hover { background: rgba(22,163,74,0.08); color: #15803d; }

/* Inactive user row */
.admin-table tbody tr.row-inactive td { opacity: 0.45; }
.admin-table tbody tr.row-inactive { background: #fafafa; }
.table-user-avatar.avatar-inactive { background: #d1d5dc; }

/* ---- Doc icon cell ---- */
.doc-name-cell { display: flex; align-items: center; gap: 10px; }
.doc-icon {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: rgba(var(--accent-rgb),0.10);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; color: var(--accent);
}

/* ---- Pagination ---- */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-top: 1px solid var(--border);
    background: var(--surface);
}
.pagination-info { font-size: 14px; color: #4a5565; }
.pagination-btns { display: flex; gap: 8px; }
.pagination-btn {
    padding: 6px 16px; border: 1px solid #d1d5dc;
    border-radius: 12px; background: #f5f3f0;
    font-family: inherit; font-size: 14px; font-weight: 500;
    color: #2c2519; cursor: pointer; transition: var(--transition);
    text-decoration: none; display: inline-flex; align-items: center;
}
.pagination-btn:hover { border-color: var(--accent); color: var(--accent); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-current { font-size: 13px; color: #6a7282; padding: 6px 4px; white-space: nowrap; }

/* ---- Upload Modal ---- */
.upload-modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 1000;
    align-items: center; justify-content: center;
}
.upload-modal-overlay.active { display: flex; }

.upload-modal {
    background: white; border: 1px solid rgba(229,231,235,0.5);
    border-radius: 16px; width: 100%; max-width: 500px;
    box-shadow: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.1);
    position: relative;
}
.upload-modal-close {
    position: absolute; top: 16px; right: 16px;
    background: none; border: none; cursor: pointer;
    color: #6a7282; opacity: 0.7; padding: 4px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px; transition: opacity 0.15s;
}
.upload-modal-close:hover { opacity: 1; }

.upload-modal-header {
    padding: 24px 24px 0;
    border-bottom: none;
}
.upload-modal-header h2 {
    font-size: 1.5rem; font-weight: 600; color: #101828;
    margin: 0 0 8px;
}
.upload-modal-header p {
    font-size: 0.9375rem; color: #4a5565; margin: 0;
}

.upload-modal-body {
    padding: 24px;
    display: flex; flex-direction: column; gap: 0;
}
.upload-modal-body .form-group { margin-bottom: 20px; }
.upload-modal-body .form-group:last-child { margin-bottom: 0; }
.upload-modal-body label {
    display: block; font-size: 0.9375rem; font-weight: 500;
    color: #101828; margin-bottom: 8px;
}
.upload-modal-input {
    border-radius: 16px !important; border-color: #e5e6ea !important;
    font-size: 0.875rem;
}
.upload-modal-file { padding: 10px 12px !important; cursor: pointer; }
.upload-modal-hint {
    font-size: 0.75rem; color: #6a7282; margin: 6px 0 0;
}

.upload-modal-footer {
    display: flex; gap: 12px; align-items: center;
    padding: 24px 24px 24px;
    border-top: 1px solid #f3f4f6;
}
.upload-modal-cancel {
    flex: 1; padding: 11px 17px; border-radius: 16px;
    background: #f5f3f0; border: 1px solid #d1d5dc;
    font-family: inherit; font-size: 0.875rem; font-weight: 500;
    color: #2c2519; cursor: pointer; text-align: center;
    transition: background 0.15s;
}
.upload-modal-cancel:hover { background: #ede9e3; }
.upload-modal-submit {
    flex: 1; padding: 11px 17px; border-radius: 16px;
    background: var(--accent); border: none;
    font-family: inherit; font-size: 0.875rem; font-weight: 500;
    color: white; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 10px 15px rgba(var(--accent-rgb),0.25), 0 4px 6px rgba(var(--accent-rgb),0.25);
    transition: background 0.15s;
}
.upload-modal-submit:hover { background: var(--accent-hover); }

.delete-modal-warning {
    background: #fef2f2; border: 1px solid #fecaca;
    color: #991b1b; border-radius: 12px;
    padding: 12px 14px; font-size: 0.875rem;
}
.delete-modal-submit {
    background: var(--accent);
    box-shadow: 0 10px 15px rgba(var(--accent-rgb),0.25), 0 4px 6px rgba(var(--accent-rgb),0.25);
}
.delete-modal-submit:hover { background: var(--accent-hover); }

/* ---- Detail grid ---- */
.detail-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px; margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}
.detail-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.detail-item { font-size: 0.875rem; }
.detail-item .di-label { font-size: 0.75rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.detail-item .di-value { color: var(--text-dark); font-weight: 500; }

/* ---- Session log messages ---- */
.session-messages-log { margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.log-message {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px 20px;
    border-left: 3px solid var(--border);
}
.log-message.log-user      { border-left-color: var(--accent); }
.log-message.log-assistant { border-left-color: var(--live-green); }
.log-meta {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 8px; font-size: 0.78rem; color: var(--text-muted);
}
.log-meta strong { color: var(--text-dark); font-weight: 600; }
.log-content { font-size: 0.875rem; line-height: 1.7; color: var(--text-dark); }

/* ---- Summary box ---- */
.summary-card {
    background: rgba(var(--accent-rgb),0.06); border: 1px solid rgba(var(--accent-rgb),0.2);
    border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 24px;
}
.summary-card h3 { margin-bottom: 10px; color: var(--accent); }
.summary-card p  { font-size: 0.875rem; color: var(--text-mid); margin-top: 6px; line-height: 1.6; }

/* ---- System prompt ---- */
.prompt-meta {
    display: flex; gap: 16px; flex-wrap: wrap;
    margin-bottom: 16px; font-size: 0.8rem; color: var(--text-muted);
}
.prompt-meta span {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.help-text { color: var(--text-muted); margin-bottom: 20px; font-size: 0.875rem; line-height: 1.6; }
.prompt-textarea {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
    font-size: 0.83rem; line-height: 1.65; min-height: 520px;
    background: #fafaf9;
}

/* ============================================
   PROFILE PAGE
   ============================================ */
.profile-header { margin-bottom: 28px; }
.profile-header h1 { margin-bottom: 4px; }
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.85rem; color: var(--text-muted); text-decoration: none;
    margin-bottom: 16px;
}
.back-link:hover { color: var(--text-dark); }

/* ============================================
   AUTH FULLPAGE (Figma Redesign - Login)
   ============================================ */
.auth-fullpage {
    min-height: 100vh;
    background:
        radial-gradient(circle at 28% 20%, rgba(56, 116, 255, 0.22), transparent 24rem),
        radial-gradient(circle at 72% 72%, rgba(56, 116, 255, 0.12), transparent 22rem),
        linear-gradient(180deg, #000000 0%, #0d0d0d 50%, #000000 100%);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    position: relative; overflow: hidden;
    padding: 40px 24px;
}
.auth-fullpage .auth-glow {
    position: absolute; width: 256px; height: 256px;
    border-radius: 50%; filter: blur(64px); pointer-events: none;
}
.auth-glow-1 { background: rgba(56, 116, 255, 0.20); top: 80px; left: 384px; }
.auth-glow-2 { background: rgba(56, 116, 255, 0.08); top: 520px; left: 80px; }
.auth-glow-3 { background: rgba(56, 116, 255, 0.20); top: -76px; right: -20px; }
.auth-glow-4 { background: rgba(56, 116, 255, 0.20); bottom: 0; left: 50%; transform: translateX(-50%); }
.auth-glow-5 { background: rgba(56, 116, 255, 0.20); top: 546px; right: 100px; }

.auth-top-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.07); color: #f0f0f0;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 999px; padding: 8px 16px;
    font-size: 0.875rem; font-weight: 400; margin-bottom: 32px;
}
.auth-top-badge svg { opacity: 0.8; }

.auth-headline {
    font-size: 3rem; font-weight: 700; color: #ffffff;
    text-align: center; margin-bottom: 16px; line-height: 1.25;
    letter-spacing: 0;
}
.auth-headline .gradient-text {
    background: linear-gradient(90deg, #8ab4ff 0%, var(--accent) 48%, var(--accent-hover) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-tagline {
    font-size: 1.25rem; color: rgba(255,255,255,0.65);
    text-align: center; margin-bottom: 48px; max-width: 660px;
    line-height: 1.6;
}

.auth-card-new {
    background: #f7f5f2; border: 1px solid #e0dcd6;
    border-radius: 16px; padding: 32px;
    width: 100%; max-width: 448px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.25);
}
.auth-card-new .auth-lang-toggle {
    display: flex; gap: 8px; justify-content: center; margin-bottom: 24px;
}
.auth-card-new .lang-pill {
    padding: 10px 24px; border-radius: 16px;
    font-family: inherit; font-size: 1rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
    border: 1px solid #d8d4ce; background: #ffffff; color: #111111;
}
.auth-card-new .lang-pill.active {
    background: var(--accent); color: #ffffff; border-color: var(--accent);
}
.auth-card-new .lang-pill:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

.auth-card-new .auth-title {
    font-size: 1.5rem; font-weight: 600; text-align: center;
    color: #111111; margin-bottom: 4px;
}
.auth-card-new .auth-desc {
    font-size: 16px; color: #555555; text-align: center;
    margin-bottom: 24px;
}

.auth-card-new .form-group label {
    color: #111111;
    font-size: 14px;
}
.auth-card-new .form-input {
    border-radius: 16px; padding: 12px 14px; border: 1px solid #d0ccc6;
    background: #ffffff; color: #111111;
}
.auth-card-new .form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
    outline: none;
}
.auth-card-new .form-input::placeholder {
    color: #999999;
}
.auth-card-new .btn-login {
    width: 100%; padding: 12px; border-radius: 16px;
    background: var(--accent); color: #ffffff; border: none;
    font-family: inherit; font-size: 0.875rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s ease;
    letter-spacing: 0.01em;
}
.auth-card-new .btn-login:hover { background: var(--accent-hover); }

.auth-below-card {
    margin-top: 24px; text-align: center;
}
.auth-below-card a {
    color: #ffffff; font-size: 0.875rem; font-weight: 500;
}
.auth-below-card a:hover { color: var(--accent); }

.auth-login-page {
    justify-content: flex-start;
    padding-top: 58px;
}
.auth-login-page .auth-top-badge {
    margin-bottom: 28px;
}
.auth-login-page .auth-headline {
    font-size: 3.1rem;
    margin-bottom: 14px;
}
.auth-login-page .auth-tagline {
    color: rgba(255,255,255,0.88);
    max-width: 730px;
    width: auto;
    padding: 0;
    margin-bottom: 32px;
}
.auth-login-page .auth-card-new {
    max-width: 470px;
    padding: 38px 34px 34px;
    border-radius: 15px;
}
.auth-login-page .auth-card-new .auth-lang-toggle {
    margin-bottom: 30px;
}
.auth-login-page .auth-card-new .lang-pill {
    border-radius: 15px;
    font-size: 0.875rem;
    padding: 10px 24px;
}
.auth-login-page .auth-card-new .auth-title {
    margin-bottom: 6px;
}
.auth-login-page .auth-card-new .auth-desc {
    margin-bottom: 28px;
}
.auth-login-page .auth-below-card {
    margin-top: 26px;
}

/* ============================================
   ADMIN LOGIN PAGE
   ============================================ */
.admin-login-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #000000 0%, #0d0d0d 50%, #000000 100%);
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden; padding: 24px;
}
.admin-login-page .admin-glow {
    position: absolute; width: 384px; height: 384px;
    border-radius: 50%; filter: blur(64px); pointer-events: none;
}
.admin-login-container {
    display: flex; flex-direction: column; align-items: center;
    gap: 40px; width: 100%; max-width: 448px;
}
.admin-login-header { text-align: center; }
.admin-login-icon {
    width: 64px; height: 64px; border-radius: 16px;
    background: var(--accent); display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 10px 20px rgba(var(--accent-rgb),0.35), 0 4px 6px rgba(0,0,0,0.2);
}
.admin-login-icon svg { color: #fff; }
.admin-login-header h1 {
    font-size: 1.875rem; font-weight: 600; color: #ffffff; margin-bottom: 4px;
}
.admin-login-header p { font-size: 1rem; color: rgba(255,255,255,0.6); }
 
.admin-login-card {
    background: #f7f5f2; border: 1px solid #e0dcd6;
    border-radius: 16px; padding: 32px; width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.25);
}
.admin-login-card .form-input {
    border-radius: 16px !important; border-color: #d0ccc6 !important;
    background: #ffffff; color: #111111;
}
.admin-login-card .form-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.15) !important;
    outline: none;
}
.admin-login-card .btn-login {
    width: 100%; padding: 12px; border-radius: 16px;
    background: var(--accent); color: #ffffff; border: none;
    font-family: inherit; font-size: 0.875rem; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 4px 12px rgba(var(--accent-rgb),0.4), 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease; letter-spacing: 0.01em;
}
.admin-login-card .btn-login:hover { background: var(--accent-hover); box-shadow: 0 6px 16px rgba(var(--accent-rgb),0.45); }
.admin-login-back {
    text-align: center; margin-top: 16px;
}
.admin-login-back a {
    color: rgba(255,255,255,0.5); font-size: 0.875rem; font-weight: 500;
}
.admin-login-back a:hover { color: #ffffff; }


/* ============================================
   SETTINGS / PROFILE PAGE
   ============================================ */
.settings-page {
    min-height: 100vh; background: #f5f3f0;
    padding: 32px 0;
}
.settings-container {
    max-width: 800px; margin: 0 auto; padding: 0 24px;
}
.settings-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 32px;
}
.settings-header .back-btn {
    width: 36px; height: 36px; border-radius: 16px;
    border: 1px solid transparent; background: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #2c2519; transition: all 0.2s ease;
}
.settings-header .back-btn:hover { background: #ffffff; border-color: #e5e1db; }
.settings-header h1 { font-size: 1.875rem; font-weight: 600; color: #2c2519; margin-bottom: 0; }
.settings-header p { font-size: 1rem; color: #6b5e4f; margin: 0; }

.settings-section {
    background: #ffffff; border: 1px solid #e5e1db;
    border-radius: 16px; padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}
.settings-section-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 24px;
}
.settings-section-icon {
    width: 36px; height: 36px; border-radius: 16px;
    background: rgba(var(--accent-rgb),0.1);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); flex-shrink: 0;
}
.settings-section-header h2 {
    font-size: 1.25rem; font-weight: 600; color: #2c2519; margin: 0;
}

.lang-radio-group { display: flex; flex-direction: column; gap: 12px; }
.lang-radio-item {
    display: flex; align-items: center; gap: 12px;
    padding: 20px; border-radius: 16px; border: 1px solid transparent;
    cursor: pointer; transition: all 0.2s ease;
}
.lang-radio-item:hover { background: #faf9f7; }
.lang-radio-item input[type="radio"] { accent-color: #2c2519; width: 16px; height: 16px; }
.lang-radio-item .lang-label { font-size: 1rem; font-weight: 500; color: #2c2519; }
.lang-radio-item .lang-desc { font-size: 0.875rem; color: #6b5e4f; }

.session-stat-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px; border-radius: 16px;
    background: linear-gradient(90deg, rgba(var(--accent-rgb),0.05), transparent);
    border: 1px solid rgba(var(--accent-rgb),0.2);
    margin-bottom: 20px;
}
.session-stat-bar .stat-info .stat-title { font-size: 1rem; font-weight: 500; color: #2c2519; }
.session-stat-bar .stat-info .stat-desc { font-size: 0.875rem; color: #6b5e4f; }
.btn-view-history {
    padding: 8px 18px; border-radius: 16px;
    background: #f5f3f0; border: 1px solid var(--accent);
    color: var(--accent); font-family: inherit; font-size: 0.875rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
}
.btn-view-history:hover { background: rgba(var(--accent-rgb),0.1); }

.memory-toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px; border-top: 1px solid #e5e1db;
}
.memory-toggle-info .toggle-title { font-size: 1rem; font-weight: 500; color: #2c2519; }
.memory-toggle-info .toggle-desc { font-size: 0.875rem; color: #6b5e4f; }
.toggle-switch {
    position: relative; width: 32px; height: 18px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #d4cfc7; border-radius: 999px; transition: 0.3s;
}
.toggle-slider::before {
    content: ""; position: absolute;
    width: 16px; height: 16px; border-radius: 50%;
    left: 1px; bottom: 1px; background: #ffffff;
    transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: #2c2519; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(14px); }

.memory-hint {
    padding: 0 20px; font-size: 0.75rem; color: #897566;
}

.settings-actions {
    display: flex; gap: 12px; justify-content: flex-end;
}
.btn-cancel {
    padding: 12px 24px; border-radius: 16px;
    background: #f5f3f0; border: 1px solid #d4cfc7;
    color: #2c2519; font-family: inherit; font-size: 0.875rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
}
.btn-cancel:hover { background: #ebe8e3; }
.btn-save {
    padding: 12px 32px; border-radius: 16px;
    background: var(--accent); border: none; color: #ffffff;
    font-family: inherit; font-size: 0.875rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
}
.btn-save:hover { background: var(--accent-hover); }

/* ============================================
   ADMIN INSTRUCTION MANUAL
   ============================================ */
.instruction-warning-banner {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 16px 20px; border-radius: 16px;
    background: linear-gradient(to right, #fffbeb, #fff7ed);
    border: 1px solid rgba(254,154,0,0.5);
    margin-bottom: 24px;
}
.instruction-warning-title { font-size: 0.875rem; font-weight: 600; color: #973c00; }
.instruction-warning-text { font-size: 0.875rem; color: #973c00; }

.instruction-editor-card {
    background: rgba(255,255,255,0.8); border: 1px solid rgba(229,231,235,0.5);
    border-radius: 16px; padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}
.instruction-editor-label {
    display: block; font-size: 0.875rem; font-weight: 500;
    color: #101828; margin-bottom: 8px;
}
.instruction-textarea {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
    font-size: 0.875rem; line-height: 2; min-height: 600px;
    border-radius: 16px !important; border-color: #e5e7eb !important;
    resize: vertical; color: #2c2519;
}
.instruction-editor-hint {
    font-size: 0.75rem; color: #6a7282; margin: 8px 0 0;
}
.instruction-actions {
    display: flex; gap: 12px; justify-content: flex-end;
    margin-top: 20px;
}
.btn-preview {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 16px;
    background: #ffffff; border: 1px solid #e5e1db;
    color: #2c2519; font-family: inherit; font-size: 0.875rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
}
.btn-preview:hover { border-color: var(--accent); color: var(--accent); }
.btn-update-prompt {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 16px;
    background: var(--accent); border: none; color: #ffffff;
    font-family: inherit; font-size: 0.875rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(var(--accent-rgb),0.2);
}
.btn-update-prompt:hover { background: var(--accent-hover); }

/* ============================================
   SESSION LOGS - TOOLBAR
   ============================================ */
.admin-toolbar-right {
    display: flex; gap: 12px; align-items: center;
}
.btn-filter, .btn-export {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: 12px;
    font-family: inherit; font-size: 0.875rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
}
.btn-filter {
    background: #ffffff; border: 1px solid #e5e1db; color: #2c2519;
}
.btn-filter:hover { border-color: var(--accent); }
.btn-export {
    background: #ffffff; border: 1px solid #e5e1db; color: #2c2519;
}
.btn-export:hover { border-color: var(--accent); }

/* ============================================
   CHAT MESSAGE STYLING (Figma Redesign)
   ============================================ */
.message-assistant {
    gap: 12px;
}
.message-assistant .message-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: #ede8df;
    box-shadow: 0 0 0 1.5px rgba(160, 110, 55, 0.28);
}
.message-assistant .msg-name {
    font-size: 0.8125rem; font-weight: 500; color: #2c2519;
    margin-bottom: 4px;
}

/* ============================================
   LANGUAGE TOGGLE - SEGMENTED CONTROL
   ============================================ */
.lang-toggle-segmented {
    display: flex; border: 1px solid #d4cfc7; border-radius: 12px;
    overflow: hidden; padding: 1px;
}
.lang-toggle-segmented .lang-seg {
    padding: 6px 16px; border: none; background: transparent;
    font-family: inherit; font-size: 0.75rem; font-weight: 500;
    color: #897566; cursor: pointer; transition: all 0.2s ease;
}
.lang-toggle-segmented .lang-seg.active {
    background: #ffffff; font-weight: 700; color: #2c2519;
}
.lang-toggle-segmented .lang-seg:not(.active) {
    background: #f5f3f0;
}
.lang-toggle-segmented .lang-divider {
    width: 1px; background: #d4cfc7;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .auth-hero { display: none; }
    .auth-panel { width: 100%; border-left: none; }
}

/* ============================================
   CHAT SIDEBAR OVERLAY (mobile)
   ============================================ */
.chat-sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.45); z-index: 99;
}
.chat-sidebar-overlay.active { display: block; }

/* ============================================
   ADMIN MOBILE TOPBAR
   ============================================ */
.admin-mobile-topbar {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; z-index: 200;
    height: 52px; padding: 0 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    align-items: center; justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.admin-hamburger {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    background: none; border: 1px solid var(--border); border-radius: 10px;
    cursor: pointer; color: #101828; transition: background 0.15s;
}
.admin-hamburger:hover { background: var(--bg); }

.admin-sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.45); z-index: 199;
}
.admin-sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
    /* ---- iOS input zoom fix (font-size < 16px triggers Safari auto-zoom) ---- */
    input, textarea, select { font-size: 16px !important; }

    /* ---- Coaching layout ---- */
    .coaching-layout { height: 100vh; }
    .sidebar { position: fixed; left: calc(-1 * var(--sidebar-w)); z-index: 100; height: 100vh; box-shadow: var(--shadow-lg); }
    .sidebar.open { left: 0; }
    .sidebar-open { display: flex; }
    .sidebar-toggle { display: none; }

    /* ---- Chat header ---- */
    .chat-header { padding: 10px 14px; gap: 8px; }
    .chat-header h2 { font-size: 15px; }
    .lang-toggle-segmented .lang-seg { padding: 5px 10px; font-size: 0.7rem; }

    /* ---- Messages ---- */
    .chat-messages { padding: 16px; gap: 14px; }
    .message-user      { max-width: 90%; }
    .message-assistant { max-width: 96%; }
    .message-text { padding: 11px 14px; font-size: 0.875rem; }
    .message-assistant .message-text { font-size: 0.9rem; }

    /* ---- Welcome screen ---- */
    .welcome-screen { padding: 24px 16px; align-items: flex-start; }
    .welcome-content { max-width: 100%; }
    .welcome-greeting { font-size: 1.875rem; }
    .welcome-help { font-size: 0.9rem; margin-bottom: 20px; }
    .welcome-input-wrap { margin-bottom: 16px; }
    .welcome-prompts { grid-template-columns: 1fr; }
    .welcome-prompts .prompt-card:last-child:nth-child(odd) { grid-column: auto; width: 100%; margin: 0; }

    /* ---- Keyboard-open state (welcome screen) ---- */
    /* When the virtual keyboard is open, hide greeting & prompts so the
       input box is always fully visible above the keyboard. */
    .coaching-layout.keyboard-open .welcome-greeting,
    .coaching-layout.keyboard-open .welcome-help,
    .coaching-layout.keyboard-open .welcome-prompts { display: none; }
    .coaching-layout.keyboard-open .chat-messages-welcome { justify-content: flex-end; }
    .coaching-layout.keyboard-open .welcome-screen { padding: 12px 16px; justify-content: flex-end; align-items: stretch; }
    .coaching-layout.keyboard-open .welcome-content { width: 100%; }
    .coaching-layout.keyboard-open .welcome-input-wrap { margin-bottom: 0; }

    /* ---- Chat input ---- */
    .chat-input-area { padding: 10px 14px 20px; }
    .chat-form { max-width: 100%; }
    .input-hint { display: none; }

    /* ---- Settings page ---- */
    .settings-page { padding: 20px 0; }
    .settings-section { padding: 24px 20px; }
    .settings-header h1 { font-size: 1.5rem; }
    .settings-header p { font-size: 0.875rem; }
    .settings-actions { gap: 10px; }
    .session-stat-bar { flex-direction: column; gap: 12px; align-items: flex-start; }

    /* Admin mobile nav */
    .admin-mobile-topbar { display: flex; }
    .admin-layout { padding-top: 52px; }
    .admin-sidebar {
        position: fixed; top: 0; left: calc(-1 * var(--sidebar-w));
        height: 100vh; z-index: 210;
        transition: left 0.25s ease;
        box-shadow: none;
    }
    .admin-sidebar.sidebar-open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    }

    /* Admin content */
    .admin-content { padding: 20px 16px; }
    .admin-page-title { font-size: 1.4rem; }
    .admin-page-sub { font-size: 0.875rem; }

    /* Page header — stack on mobile */
    .admin-page-header-row { flex-direction: column; align-items: stretch; gap: 12px; }
    .admin-header-actions { flex-direction: column; }
    .admin-header-actions .btn { width: 100%; justify-content: center; }
    .admin-form-actions { flex-direction: column; }
    .admin-form-actions .btn { width: 100%; justify-content: center; }
    .admin-bottom-actions { flex-direction: column; align-items: stretch; }
    .admin-bottom-actions .btn { width: 100%; justify-content: center; }

    /* Stats */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
    .stat-card { padding: 18px 14px; }
    .stat-number { font-size: 1.75rem; }

    /* Tables — horizontal scroll */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .admin-table { min-width: 600px; }

    /* Detail & form grids */
    .detail-grid { grid-template-columns: 1fr; }
    .upload-form .form-row { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }

    /* System prompt */
    .instruction-textarea { min-height: 300px !important; }

    /* Upload modal */
    .upload-modal { margin: 16px; max-width: calc(100vw - 32px) !important; }
    .upload-modal-header { padding: 20px 20px 0; }
    .upload-modal-body { padding: 20px; }
    .upload-modal-footer { padding: 16px 20px; }

    /* Session log bottom buttons */
    div[style*="justify-content:center"][style*="gap:12px"] { flex-direction: column; }
    div[style*="justify-content:center"][style*="gap:12px"] .btn { width: 100%; justify-content: center; }

    /* Auth pages */
    .auth-headline { font-size: 2.25rem; }
    .auth-tagline { font-size: 1.1rem; margin-bottom: 32px; }
    .auth-card-new { padding: 28px 20px; }
    .auth-login-page { padding-top: 36px; }
    .auth-login-page .auth-headline { font-size: 2.35rem; }
    .auth-login-page .auth-tagline {
        width: auto;
        padding: 0;
        margin-bottom: 28px;
    }
    .auth-login-page .auth-card-new { padding: 30px 22px 28px; }
    .admin-login-card { padding: 28px 20px; }
    .admin-login-container { gap: 28px; }
}

@media (max-width: 480px) {
    /* ---- Chat ---- */
    .chat-header { padding: 8px 12px; }
    .chat-messages { padding: 12px; gap: 12px; }
    .chat-input-area { padding: 8px 10px 14px; }
    .welcome-screen { padding: 20px 12px; }
    .welcome-greeting { font-size: 1.5rem; }
    .welcome-help { font-size: 0.85rem; }
    .prompt-card { padding: 13px 14px; }
    .prompt-label { font-size: 13px; }
    .prompt-desc { font-size: 11px; }

    /* ---- Settings ---- */
    .settings-container { padding: 0 12px; }
    .settings-section { padding: 18px 14px; margin-bottom: 16px; }
    .settings-header { margin-bottom: 20px; }
    .settings-header h1 { font-size: 1.3rem; }
    .settings-actions { flex-direction: column; }
    .btn-cancel, .btn-save { width: 100%; text-align: center; padding: 13px 24px; }
    .memory-toggle-row { padding: 14px; }
    .session-stat-bar { padding: 14px; }

    /* ---- Admin content ---- */
    .admin-content { padding: 16px 12px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px 12px; }
    .stat-number { font-size: 1.5rem; }
    .stat-label { font-size: 0.75rem; }
    .admin-page-title { font-size: 1.25rem; }
    .detail-card { padding: 16px; }
    .pagination { flex-direction: column; gap: 10px; align-items: flex-start; }

    /* ---- Auth pages – small phones ---- */
    .auth-fullpage { padding: 24px 16px; }
    .auth-top-badge { font-size: 0.75rem; padding: 6px 12px; margin-bottom: 20px; }
    .auth-headline { font-size: 1.75rem; letter-spacing: 0; }
    .auth-tagline { font-size: 0.95rem; margin-bottom: 28px; }
    .auth-card-new { padding: 24px 16px; border-radius: 14px; }
    .auth-card-new .lang-pill { padding: 8px 16px; font-size: 0.875rem; }
    .auth-login-page { padding-top: 28px; }
    .auth-login-page .auth-headline {
        font-size: 1.85rem;
        letter-spacing: 0;
        max-width: 340px;
    }
    .auth-login-page .auth-tagline {
        width: auto;
        padding: 0;
        font-size: 0.95rem;
        line-height: 1.5;
    }
    .auth-login-page .auth-card-new { padding: 26px 18px 24px; }
    .auth-login-page .auth-card-new .auth-lang-toggle { margin-bottom: 24px; }

    .admin-login-page { padding: 16px; }
    .admin-login-card { padding: 24px 16px; border-radius: 14px; }
    .admin-login-container { gap: 20px; }
    .admin-login-header h1 { font-size: 1.5rem; }
    .admin-login-icon { width: 52px; height: 52px; }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 300px;
    max-width: 420px;
    padding: 14px 16px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
    pointer-events: all;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-show {
    opacity: 1;
    transform: translateX(0);
}
.toast-hide {
    opacity: 0;
    transform: translateX(24px);
}

/* Types */
.toast-success { background: #0d2414; border-color: #166534; color: #bbf7d0; }
.toast-error   { background: #200d0d; border-color: #991b1b; color: #fecaca; }
.toast-warning { background: #201708; border-color: #92400e; color: #fde68a; }
.toast-info    { background: #0d1a2e; border-color: #1e40af; color: #bfdbfe; }

.toast-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}
.toast-success .toast-icon { background: rgba(22,101,52,0.4);  color: #4ade80; }
.toast-error   .toast-icon { background: rgba(153,27,27,0.4);  color: #f87171; }
.toast-warning .toast-icon { background: rgba(146,64,14,0.4);  color: #fbbf24; }
.toast-info    .toast-icon { background: rgba(30,64,175,0.4);  color: #60a5fa; }

.toast-body { flex: 1; min-width: 0; }
.toast-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 3px;
    opacity: 0.75;
}
.toast-text {
    font-size: 0.875rem;
    line-height: 1.45;
    opacity: 0.95;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    padding: 2px;
    color: inherit;
    line-height: 1;
    transition: opacity 0.15s;
    margin-top: 1px;
}
.toast-close:hover { opacity: 1; }

/* Progress bar */
.toast-progress {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: rgba(255,255,255,0.08);
}
.toast-progress-bar {
    height: 100%;
    width: 100%;
    border-radius: 0 0 12px 12px;
}
.toast-success .toast-progress-bar { background: #4ade80; }
.toast-error   .toast-progress-bar { background: #f87171; }
.toast-warning .toast-progress-bar { background: #fbbf24; }
.toast-info    .toast-progress-bar { background: #60a5fa; }

/* Message action buttons */
.msg-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 2px;
}

.btn-msg-action {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    background: #ffffff; border: 1px solid #e5e1db; color: var(--text-muted);
    border-radius: 8px; cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn-msg-action:hover {
    color: var(--accent); border-color: var(--accent); background: rgba(56, 116, 255, 0.04);
}
.btn-msg-action svg { stroke: currentColor; fill: none; flex-shrink: 0; }

/* ---- Markdown Tables inside Messages ---- */
.message-assistant table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 16px 0;
    font-size: 0.875rem;
    line-height: 1.5;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #ede9e1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.message-assistant th {
    background-color: #f7f5ef;
    color: #2c2519;
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid #ede9e1;
}
.message-assistant td {
    padding: 10px 14px;
    border-bottom: 1px solid #ede9e1;
    color: #4a3e30;
}
.message-assistant tr:last-child td {
    border-bottom: none;
}
.message-assistant tr:hover td {
    background-color: #fcfbfa;
}
.table-container {
    overflow-x: auto;
    width: 100%;
    margin: 12px 0;
}


