/* === Leadership Pocket AI — Main CSS === */
/* Font: Plus Jakarta Sans | Style: Apple-inspired, Clean, Modern */

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

:root {
    --font: 'Plus Jakarta Sans', sans-serif;

    /* Colors */
    --navy: #0A2540;
    --navy-80: rgba(10,37,64,0.8);
    --blue: #1D6EF5;
    --blue-light: #4F8EF7;
    --blue-xlight: #EBF2FF;
    --cyan: #00B4D8;
    --green: #22C55E;
    --green-bg: #F0FDF4;
    --yellow: #F59E0B;
    --yellow-bg: #FFFBEB;
    --red: #EF4444;
    --red-bg: #FEF2F2;
    --white: #FFFFFF;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    /* Radius */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-2xl: 24px;

    /* Shadow */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(10,37,64,0.08), 0 2px 4px rgba(10,37,64,0.04);
    --shadow-lg: 0 8px 32px rgba(10,37,64,0.12), 0 4px 8px rgba(10,37,64,0.06);

    /* Sidebar */
    --sidebar-w: 260px;
    --header-h: 60px;
    --bottomnav-h: 64px;

    /* Transition */
    --t: 0.2s ease;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-800); line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: var(--font); }

/* ---- HIDDEN ---- */
.hidden { display: none !important; }

/* ---- SPINNER ---- */
.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}
.spinner-dark {
    border-color: rgba(10,37,64,0.15);
    border-top-color: var(--navy);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 20px;
    font-size: 15px; font-weight: 600; border-radius: var(--r-md);
    transition: all var(--t); white-space: nowrap;
}
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: #0d2f50; box-shadow: var(--shadow-md); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }
.btn-blue { background: var(--blue); color: white; }
.btn-blue:hover { background: #1558d6; box-shadow: var(--shadow-md); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid #FECACA; }
.btn-danger:hover { background: #FEE2E2; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: var(--r-sm); }
.btn-xs { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 6px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--r-sm); }

/* ---- AUTH PAGE ---- */
.auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #F0F4FF 0%, #E8F4FD 50%, #F5F0FF 100%);
    padding: 24px;
}
.auth-container { width: 100%; max-width: 420px; }
.auth-card {
    background: white;
    border-radius: var(--r-2xl);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 20px; }
.auth-title {
    font-size: 22px; font-weight: 800;
    color: var(--navy); text-align: center; margin-bottom: 8px;
}
.auth-subtitle {
    font-size: 13px; color: var(--gray-500);
    text-align: center; line-height: 1.6;
    margin-bottom: 28px;
}
.auth-hint {
    font-size: 12px; color: var(--gray-400);
    text-align: center; margin-top: 20px;
}
.auth-hint code {
    background: var(--gray-100);
    padding: 2px 6px; border-radius: 4px;
    font-family: monospace; color: var(--gray-700);
}

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 13px; font-weight: 600; color: var(--gray-700);
    margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
    display: block; width: 100%;
    height: 44px; padding: 0 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--r-md);
    font-size: 14px; color: var(--gray-800);
    background: white;
    transition: border-color var(--t), box-shadow var(--t);
    outline: none;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--gray-400); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(29,110,245,0.12);
}
.form-input.error, .form-select.error, .form-textarea.error {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.10);
}
.form-textarea { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.form-select { cursor: pointer; appearance: none; padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 5px; }
.input-password-wrap { position: relative; }
.input-password-wrap .form-input { padding-right: 44px; }
.btn-show-pass {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    color: var(--gray-400); padding: 0; background: none;
    display: flex; align-items: center;
}
.btn-show-pass:hover { color: var(--gray-600); }

/* ---- MESSAGE BOX ---- */
.msg-box {
    padding: 12px 14px;
    border-radius: var(--r-md);
    font-size: 13px; font-weight: 500;
    margin-bottom: 18px; line-height: 1.5;
    display: flex; align-items: flex-start; gap: 10px;
    animation: fadeIn 0.2s ease;
}
.msg-box.success { background: var(--green-bg); color: #166534; border: 1px solid #BBF7D0; }
.msg-box.error { background: var(--red-bg); color: #991B1B; border: 1px solid #FECACA; }
.msg-box.warning { background: var(--yellow-bg); color: #92400E; border: 1px solid #FDE68A; }
.msg-box.info { background: var(--blue-xlight); color: #1E40AF; border: 1px solid #BFDBFE; }
.msg-box-icon { flex-shrink: 0; margin-top: 1px; }
@keyframes fadeIn { from { opacity:0; transform: translateY(-6px); } to { opacity:1; transform: translateY(0); } }

/* ---- APP LAYOUT ---- */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    color: white;
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--t);
}
.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-logo {
    width: 36px; height: 36px; flex-shrink: 0;
}
.sidebar-brand { flex: 1; min-width: 0; }
.sidebar-brand-name {
    font-size: 14px; font-weight: 700; color: white; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-brand-sub {
    font-size: 10px; color: rgba(255,255,255,0.5); font-weight: 400;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-section { padding: 0 12px; margin-bottom: 6px; }
.sidebar-section-label {
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35); text-transform: uppercase;
    padding: 10px 8px 4px;
}
.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--r-sm);
    color: rgba(255,255,255,0.7);
    font-size: 14px; font-weight: 500;
    transition: all var(--t); cursor: pointer;
    text-decoration: none;
}
.sidebar-link:hover { background: rgba(255,255,255,0.08); color: white; }
.sidebar-link.active { background: rgba(79,142,247,0.2); color: white; }
.sidebar-link.active svg { color: var(--blue-light); }
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link-text { flex: 1; }
.sidebar-badge {
    background: var(--blue); color: white;
    font-size: 10px; font-weight: 700;
    padding: 1px 7px; border-radius: 20px;
}
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--r-sm);
    cursor: pointer;
}
.sidebar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--blue); display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: white; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: 13px; font-weight: 600; color: white;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.45); }
.sidebar-logout {
    color: rgba(255,255,255,0.4); flex-shrink: 0;
    padding: 4px; border-radius: 6px;
    display: flex; transition: color var(--t), background var(--t);
}
.sidebar-logout:hover { color: #FCA5A5; background: rgba(239,68,68,0.15); }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
    min-height: 100vh;
}
.topbar {
    height: var(--header-h);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center;
    padding: 0 24px; gap: 16px;
    position: sticky; top: 0; z-index: 50;
}
.topbar-toggle {
    display: none;
    color: var(--gray-600); padding: 6px; border-radius: var(--r-sm);
}
.topbar-toggle:hover { background: var(--gray-100); }
.topbar-title { font-size: 17px; font-weight: 700; color: var(--navy); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.page-content { flex: 1; padding: 28px 24px; max-width: 1200px; width: 100%; }

/* ---- CARDS ---- */
.card {
    background: white;
    border-radius: var(--r-xl);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}
.card-header {
    padding: 18px 20px 0;
    font-size: 16px; font-weight: 700; color: var(--navy);
}
.card-body { padding: 20px; }
.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--gray-100);
}

/* ---- DASHBOARD ---- */
.dashboard-welcome {
    margin-bottom: 28px;
}
.welcome-text { font-size: 24px; font-weight: 800; color: var(--navy); }
.welcome-sub { font-size: 14px; color: var(--gray-500); margin-top: 4px; }
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.quick-action-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    padding: 20px 16px;
    background: white;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--r-xl);
    font-size: 13px; font-weight: 600; color: var(--gray-700);
    cursor: pointer; transition: all var(--t);
    text-align: center;
    text-decoration: none;
}
.quick-action-btn:hover {
    border-color: var(--blue); color: var(--blue);
    box-shadow: var(--shadow-md); transform: translateY(-2px);
}
.quick-action-btn svg { color: var(--blue); }
.quick-action-btn.primary {
    background: var(--navy); border-color: var(--navy); color: white;
}
.quick-action-btn.primary svg { color: var(--blue-light); }
.quick-action-btn.primary:hover { background: #0d2f50; transform: translateY(-2px); }

/* Mode Cards Grid */
.section-title {
    font-size: 16px; font-weight: 700; color: var(--navy);
    margin-bottom: 14px;
}
.modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.mode-card {
    background: white;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--r-lg);
    padding: 16px;
    cursor: pointer;
    transition: all var(--t);
    display: flex; flex-direction: column; gap: 10px;
    text-decoration: none;
}
.mode-card:hover {
    border-color: var(--blue); box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.mode-card-icon {
    width: 40px; height: 40px; border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
}
.mode-card-name { font-size: 13px; font-weight: 700; color: var(--navy); line-height: 1.3; }
.mode-card-desc { font-size: 12px; color: var(--gray-500); line-height: 1.5; }

/* ---- CHAT PAGE ---- */
.chat-layout {
    display: flex; gap: 0;
    height: calc(100vh - var(--header-h));
    margin: -28px -24px;
}
.chat-panel {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
    background: white;
    border-right: 1px solid var(--gray-200);
}
.chat-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; gap: 12px;
}
.chat-mode-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--blue-xlight); color: var(--blue);
    padding: 5px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.chat-messages {
    flex: 1; overflow-y: auto;
    padding: 20px;
    display: flex; flex-direction: column; gap: 16px;
}
.chat-bubble { display: flex; gap: 10px; max-width: 80%; }
.chat-bubble.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-bubble.ai { align-self: flex-start; }
.bubble-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.bubble-avatar.ai-av { background: var(--navy); color: white; }
.bubble-avatar.user-av { background: var(--blue); color: white; }
.bubble-body { min-width: 0; }
.bubble-text {
    padding: 12px 16px;
    border-radius: var(--r-lg);
    font-size: 14px; line-height: 1.65;
    word-break: break-word;
}
.chat-bubble.ai .bubble-text {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-top-left-radius: 4px;
    color: var(--gray-800);
}
.chat-bubble.user .bubble-text {
    background: var(--navy); color: white;
    border-top-right-radius: 4px;
}
.bubble-time { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.chat-bubble.user .bubble-time { text-align: right; }
.bubble-actions {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-top: 8px;
}
.bubble-actions .btn-xs { font-size: 11px; }
/* AI response markdown */
.ai-response h2 { font-size: 13px; font-weight: 700; color: var(--navy); margin: 14px 0 6px; }
.ai-response h2:first-child { margin-top: 0; }
.ai-response p { font-size: 14px; color: var(--gray-700); margin-bottom: 8px; }
.ai-response ul { padding-left: 18px; margin-bottom: 8px; }
.ai-response li { font-size: 13px; color: var(--gray-600); margin-bottom: 4px; line-height: 1.5; }
.ai-response strong { color: var(--navy); }

.chat-input-area {
    padding: 14px 16px;
    border-top: 1px solid var(--gray-200);
    background: white;
}
.chat-input-row {
    display: flex; gap: 10px; align-items: flex-end;
}
.chat-textarea {
    flex: 1;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--r-lg);
    padding: 10px 14px;
    font-size: 14px; color: var(--gray-800);
    resize: none; min-height: 44px; max-height: 160px;
    overflow-y: auto;
    line-height: 1.5;
    outline: none;
    transition: border-color var(--t), box-shadow var(--t);
    font-family: var(--font);
}
.chat-textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(29,110,245,0.12);
}
.chat-send-btn {
    width: 44px; height: 44px;
    background: var(--navy); color: white;
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all var(--t);
}
.chat-send-btn:hover { background: #0d2f50; }
.chat-send-btn:disabled { opacity: 0.5; }
.chat-status {
    font-size: 12px; color: var(--gray-400); margin-top: 6px;
    display: flex; align-items: center; gap: 6px;
}

/* Context Panel */
.context-panel {
    width: 320px; flex-shrink: 0;
    display: flex; flex-direction: column;
    background: var(--gray-50);
    border-left: 1px solid var(--gray-200);
}
.context-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px; font-weight: 700; color: var(--navy);
    display: flex; align-items: center; gap: 8px;
}
.context-panel-body { flex: 1; overflow-y: auto; padding: 16px; }
.context-panel-actions { padding: 14px 16px; border-top: 1px solid var(--gray-200); }
.context-close-btn { display: none; }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--gray-400);
    animation: typing 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; } 40% { transform: scale(1.1); opacity: 1; } }

/* Empty State */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 48px 24px; text-align: center;
}
.empty-state-icon {
    width: 64px; height: 64px;
    background: var(--gray-100); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px; color: var(--gray-400);
}
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.empty-state-text { font-size: 14px; color: var(--gray-500); max-width: 280px; line-height: 1.6; }

/* ---- MODE FORM PANEL ---- */
.mode-select-page { max-width: 860px; }
.modes-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 12px; }
.mode-item {
    background: white; border: 1.5px solid var(--gray-200); border-radius: var(--r-lg);
    padding: 16px; cursor: pointer; transition: all var(--t);
    display: flex; align-items: flex-start; gap: 12px;
}
.mode-item:hover { border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.mode-item.selected { border-color: var(--blue); background: var(--blue-xlight); }
.mode-item-icon {
    width: 38px; height: 38px; border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.mode-item-info { flex: 1; min-width: 0; }
.mode-item-name { font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 3px; }
.mode-item-desc { font-size: 12px; color: var(--gray-500); line-height: 1.4; }

/* ---- HISTORY ---- */
.history-filters {
    display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px;
    align-items: center;
}
.history-filters .form-input { max-width: 240px; }
.history-filters .form-select { max-width: 180px; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
    background: white; border: 1px solid var(--gray-200); border-radius: var(--r-lg);
    padding: 16px 18px; cursor: pointer; transition: all var(--t);
}
.history-item:hover { box-shadow: var(--shadow-md); border-color: var(--gray-300); }
.history-item-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.history-badge {
    display: inline-flex; align-items: center;
    background: var(--blue-xlight); color: var(--blue);
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.history-time { font-size: 12px; color: var(--gray-400); margin-left: auto; }
.history-preview { font-size: 13px; color: var(--gray-600); line-height: 1.5; }
.history-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ---- FAVORITES ---- */
.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.fav-card {
    background: white; border: 1px solid var(--gray-200);
    border-radius: var(--r-lg); padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
}
.fav-card-header { display: flex; align-items: flex-start; gap: 10px; }
.fav-card-title { flex: 1; font-size: 14px; font-weight: 700; color: var(--navy); }
.fav-card-mode {
    background: var(--gray-100); color: var(--gray-600);
    padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500;
    white-space: nowrap;
}
.fav-card-content {
    font-size: 13px; color: var(--gray-600); line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
    overflow: hidden;
}
.fav-card-footer { display: flex; align-items: center; gap: 8px; }
.fav-card-date { font-size: 11px; color: var(--gray-400); flex: 1; }
.fav-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.fav-tag {
    background: var(--gray-100); color: var(--gray-500);
    padding: 2px 8px; border-radius: 20px; font-size: 11px;
}

/* ---- ADMIN PANEL ---- */
.admin-tabs {
    display: flex; gap: 4px; border-bottom: 1px solid var(--gray-200);
    margin-bottom: 24px; overflow-x: auto;
}
.admin-tab {
    padding: 10px 18px; font-size: 14px; font-weight: 600;
    color: var(--gray-500); border-bottom: 2.5px solid transparent;
    cursor: pointer; transition: all var(--t); white-space: nowrap;
    background: none;
}
.admin-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.admin-tab:hover:not(.active) { color: var(--gray-800); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    background: var(--gray-50); padding: 11px 14px;
    font-size: 12px; font-weight: 700; color: var(--gray-600);
    text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 1px solid var(--gray-200);
    text-align: left;
}
.data-table td {
    padding: 13px 14px;
    font-size: 13px; color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }
.table-wrap { overflow-x: auto; }

.role-badge {
    display: inline-block; padding: 2px 10px;
    border-radius: 20px; font-size: 11px; font-weight: 600;
}
.role-superadmin { background: #FEF3C7; color: #92400E; }
.role-admin { background: var(--blue-xlight); color: var(--blue); }
.role-leader { background: #F0FDF4; color: #166534; }
.role-viewer { background: var(--gray-100); color: var(--gray-600); }

.status-active { color: var(--green); font-weight: 600; }
.status-inactive { color: var(--gray-400); }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.stat-card {
    background: white; border: 1px solid var(--gray-200);
    border-radius: var(--r-lg); padding: 18px;
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--gray-500); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* ---- MODAL ---- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(10,37,64,0.4); backdrop-filter: blur(4px);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    animation: fadeIn 0.18s ease;
}
.modal {
    background: white; border-radius: var(--r-2xl);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto;
    animation: slideUp 0.22s ease;
}
@keyframes slideUp { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }
.modal-header {
    padding: 22px 24px 16px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
}
.modal-title { font-size: 17px; font-weight: 800; color: var(--navy); }
.modal-close {
    width: 32px; height: 32px; border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-400); background: none;
    transition: all var(--t);
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ---- SETTINGS ---- */
.settings-section { margin-bottom: 32px; }
.settings-section-title {
    font-size: 15px; font-weight: 700; color: var(--navy);
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-200);
}
.settings-row {
    display: flex; align-items: center;
    padding: 14px 0; border-bottom: 1px solid var(--gray-100);
    gap: 16px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info { flex: 1; }
.settings-row-label { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.settings-row-desc { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* ---- BOTTOM NAV (mobile) ---- */
.bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--bottomnav-h);
    background: white;
    border-top: 1px solid var(--gray-200);
    z-index: 100;
    align-items: center; justify-content: space-around;
    padding: 0 4px;
    box-shadow: 0 -4px 20px rgba(10,37,64,0.08);
}
.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 12px; border-radius: var(--r-sm);
    color: var(--gray-400); font-size: 10px; font-weight: 600;
    cursor: pointer; transition: color var(--t);
    text-decoration: none; flex: 1; justify-content: center;
}
.bottom-nav-item:hover, .bottom-nav-item.active { color: var(--blue); }
.bottom-nav-item svg { width: 22px; height: 22px; }

/* Mobile sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10,37,64,0.4);
    z-index: 99;
}

/* ---- QUICK MODE ---- */
.quick-mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px; margin-bottom: 20px;
}
.quick-mode-btn {
    background: white; border: 1.5px solid var(--gray-200); border-radius: var(--r-lg);
    padding: 14px 12px; font-size: 13px; font-weight: 600; color: var(--gray-700);
    cursor: pointer; transition: all var(--t); text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.quick-mode-btn:hover { border-color: var(--blue); color: var(--blue); }
.quick-mode-btn.selected { border-color: var(--blue); background: var(--blue-xlight); color: var(--blue); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.visible { display: block; }
    .main-content { margin-left: 0; }
    .topbar-toggle { display: flex; }
    .bottom-nav { display: flex; }
    .main-content { padding-bottom: var(--bottomnav-h); }
    .page-content { padding: 20px 16px; }
    .context-panel {
        position: fixed; bottom: 0; right: 0; left: 0; top: auto;
        width: 100%; height: 70vh;
        border-radius: var(--r-2xl) var(--r-2xl) 0 0;
        border: none; border-top: 1px solid var(--gray-200);
        z-index: 150;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        box-shadow: 0 -8px 40px rgba(10,37,64,0.15);
    }
    .context-panel.open { transform: translateY(0); }
    .context-close-btn { display: flex; }
    .chat-layout { margin: -20px -16px; height: calc(100vh - var(--header-h) - var(--bottomnav-h)); }
    .modes-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .favorites-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .auth-card { padding: 28px 20px; }
    .welcome-text { font-size: 20px; }
    .modes-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .data-table th, .data-table td { padding: 10px 10px; font-size: 12px; }
    .topbar { padding: 0 14px; }
    .topbar-title { font-size: 15px; }
    .modal { margin: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 95vh;
        position: fixed; bottom: 0; left: 0; right: 0; max-width: 100%; }
    .modal-overlay { padding: 0; align-items: flex-end; }
}

/* ---- UTILITY ---- */
.text-navy { color: var(--navy); }
.text-blue { color: var(--blue); }
.text-muted { color: var(--gray-500); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.w-full { width: 100%; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Copy feedback */
.copy-feedback {
    position: fixed; bottom: calc(var(--bottomnav-h) + 16px); left: 50%; transform: translateX(-50%);
    background: var(--navy); color: white;
    padding: 10px 20px; border-radius: 30px;
    font-size: 13px; font-weight: 600;
    box-shadow: var(--shadow-lg); z-index: 300;
    animation: toastIn 0.2s ease, toastOut 0.2s ease 1.8s forwards;
    pointer-events: none;
}
@keyframes toastIn { from { opacity:0; transform: translate(-50%, 12px); } to { opacity:1; transform: translate(-50%, 0); } }
@keyframes toastOut { to { opacity:0; transform: translate(-50%, 12px); } }

/* Loading overlay */
.loading-overlay {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.85);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 10; gap: 12px; border-radius: inherit;
}
.loading-text { font-size: 14px; color: var(--gray-500); font-weight: 500; }

/* Tag input */
.tag-input-wrap { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border: 1.5px solid var(--gray-200); border-radius: var(--r-md); min-height: 44px; align-items: center; cursor: text; }
.tag-input-wrap:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29,110,245,0.12); }
.tag-pill { background: var(--blue-xlight); color: var(--blue); padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.tag-pill button { background: none; color: currentColor; font-size: 14px; line-height: 1; padding: 0; cursor: pointer; }
.tag-input { border: none; outline: none; font-family: var(--font); font-size: 13px; flex: 1; min-width: 100px; }

/* Prompt editor */
.prompt-editor {
    background: var(--gray-900); color: #A3D977;
    border-radius: var(--r-md);
    padding: 16px; font-family: 'Courier New', monospace;
    font-size: 13px; line-height: 1.7;
    resize: vertical; min-height: 200px;
    width: 100%; border: none; outline: none;
}

/* Char counter */
.char-counter { font-size: 11px; color: var(--gray-400); text-align: right; margin-top: 4px; }
.char-counter.warn { color: var(--yellow); }
.char-counter.danger { color: var(--red); }
