/* PGK Ana - Extracted styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

        :root {
            --white: #152621;
            --gray-50: #1a3029;
            --gray-100: #1f3a32;
            --gray-200: #2a4a3f;
            --gray-300: #3d6355;
            --gray-400: #7a9e90;
            --gray-500: #a3bfb3;
            --gray-600: #c5d8cf;
            --gray-700: #dce8e2;
            --gray-800: #ffffff;
            --gray-900: #ffffff;
            --blue-500: #dccbb3;
            --blue-600: #dccbb3;
            --blue-50: #1f3a32;
            --green-500: #7ebc89;
            --green-50: #1a3029;
            --red-500: #e07070;
            --red-50: #2a1a1a;
            --amber-500: #dccbb3;
            --gold: #dccbb3;
            --font-heading: 'Cormorant Garamond', Georgia, serif;
            --font-body: 'Jost', Arial, Helvetica, sans-serif;
            --bg-primary: var(--white);
            --bg-secondary: var(--gray-50);
            --bg-input: var(--gray-50);
            --border-primary: var(--gray-200);
            --text-primary: var(--gray-800);
            --text-secondary: var(--gray-500);
            --bubble-user-bg: var(--blue-600);
            --bubble-user-text: #152621;
            --bubble-bot-bg: var(--gray-50);
            --bubble-bot-border: var(--gray-200);
        }

        html.dark {
            --white: #0e1f1a;
            --gray-50: #142a23;
            --gray-100: #1a342c;
            --gray-200: #244038;
            --gray-300: #35594d;
            --gray-400: #6d9585;
            --gray-500: #96b8aa;
            --gray-600: #bdd1c7;
            --gray-700: #d8e6df;
            --gray-800: #ffffff;
            --gray-900: #ffffff;
            --blue-50: #142a23;
            --green-50: #142a23;
            --red-50: #241515;
            --bg-primary: #0e1f1a;
            --bg-secondary: #142a23;
            --bg-input: #142a23;
            --border-primary: #244038;
            --text-primary: #f2f1ed;
            --text-secondary: #96b8aa;
            --bubble-user-bg: #dccbb3;
            --bubble-user-text: #152621;
            --bubble-bot-bg: #142a23;
            --bubble-bot-border: #244038;
        }

        html.dark .login-overlay {
            background: linear-gradient(135deg, #0e1f1a 0%, #1a3029 100%);
        }
        html.dark .bubble pre { background: #0e1f1a; }
        html.dark .bubble pre code { color: #d8e6df; }
        html.dark .copy-btn { background: #244038; color: #d8e6df; }
        html.dark .copy-btn:hover { background: #35594d; }

        body {
            font-family: var(--font-body), 'Jost', system-ui, -apple-system, sans-serif;
            background: var(--white);
            color: var(--gray-800);
            height: 100dvh;
            display: flex;
            overflow: hidden;
        }

        /* -- LOGIN SCREEN -- */
        .login-overlay {
            position: fixed;
            inset: 0;
            background: linear-gradient(135deg, #0e1f1a 0%, #1a3029 100%);
            z-index: 200;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .login-overlay.hidden { display: none; }

        .login-card {
            background: var(--white);
            border-radius: 20px;
            padding: 40px 36px;
            width: 100%;
            max-width: 420px;
            box-shadow: 0 20px 60px rgba(0,0,0,.25);
        }

        .login-logo {
            width: 56px; height: 56px;
            background: var(--gold);
            border-radius: 14px;
            display: flex; align-items: center; justify-content: center;
            margin: 0 auto 20px;
        }

        .login-logo svg { width: 28px; height: 28px; color: #152621; }

        .login-card h1 {
            text-align: center;
            font-size: 26px;
            font-weight: 400;
            font-family: var(--font-heading);
            color: var(--gray-900);
            margin-bottom: 4px;
        }

        .login-card .login-subtitle {
            text-align: center;
            font-size: 14px;
            color: var(--gray-500);
            margin-bottom: 28px;
        }

        .login-field { margin-bottom: 16px; }

        .login-field label {
            display: block;
            font-size: 13px;
            font-weight: 600;
            color: var(--gray-700);
            margin-bottom: 6px;
        }

        .login-field select,
        .login-field input {
            width: 100%;
            padding: 12px 14px;
            background: var(--gray-50);
            border: 1px solid var(--gray-200);
            border-radius: 10px;
            font-family: inherit;
            font-size: 15px;
            color: var(--gray-800);
            outline: none;
            transition: border-color .15s;
            -webkit-appearance: none;
        }

        .login-field select { cursor: pointer; }
        .login-field select:focus, .login-field input:focus { border-color: var(--gold); background: var(--white); }

        .login-error {
            display: none;
            background: var(--red-50);
            color: var(--red-500);
            border-radius: 8px;
            padding: 10px 14px;
            font-size: 13px;
            margin-bottom: 16px;
        }
        .login-error.visible { display: block; }

        .login-btn {
            width: 100%; padding: 13px;
            background: var(--gold); color: #152621; border: none;
            border-radius: 10px; font-family: inherit; font-size: 15px; font-weight: 600;
            cursor: pointer; transition: background .15s;
        }
        .login-btn:hover { background: #c9b89e; }
        .login-btn:disabled { opacity: .5; cursor: default; }

        .login-divider {
            display: flex; align-items: center; gap: 12px;
            margin: 20px 0; color: var(--gray-400); font-size: 12px;
        }
        .login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }

        .login-guest {
            width: 100%; padding: 12px;
            background: var(--white); color: var(--gray-600);
            border: 1px solid var(--gray-200); border-radius: 10px;
            font-family: inherit; font-size: 14px; font-weight: 500;
            cursor: pointer; transition: background .15s, border-color .15s;
        }
        .login-guest:hover { background: var(--gray-50); border-color: var(--gray-300); }


        /* -- SIDEBAR -- */
        .sidebar {
            width: 260px; background: var(--gray-50);
            border-right: 1px solid var(--gray-200);
            display: flex; flex-direction: column; flex-shrink: 0;
        }

        .sidebar-head { padding: 16px; border-bottom: 1px solid var(--gray-200); }

        .sidebar-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

        .sidebar-brand .logo {
            width: 32px; height: 32px; background: var(--gold);
            border-radius: 8px; display: flex; align-items: center; justify-content: center;
        }
        .sidebar-brand .logo svg { width: 18px; height: 18px; color: #152621; }
        .sidebar-brand h2 { font-size: 16px; font-weight: 400; font-family: var(--font-heading); color: var(--gray-800); }
        .sidebar-brand small { display: block; font-size: 11px; color: var(--gray-500); font-weight: 400; }

        .new-chat-btn {
            width: 100%; padding: 8px 12px;
            background: var(--white); border: 1px solid var(--gray-200); border-radius: 8px;
            color: var(--gray-700); font-family: inherit; font-size: 13px; font-weight: 500;
            cursor: pointer; display: flex; align-items: center; gap: 6px;
            transition: background 0.15s;
        }
        .new-chat-btn:hover { background: var(--gray-100); }
        .new-chat-btn svg { width: 14px; height: 14px; color: var(--gray-500); }

        .sidebar-nav { flex: 1; overflow-y: auto; padding: 8px; }
        .sidebar-nav::-webkit-scrollbar { width: 3px; }
        .sidebar-nav::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

        .nav-label {
            font-size: 11px; font-weight: 600; color: var(--gray-400);
            text-transform: uppercase; letter-spacing: 0.5px; padding: 12px 8px 4px;
        }

        .nav-item {
            width: 100%; padding: 7px 10px;
            background: none; border: none; border-radius: 6px;
            color: var(--gray-600); text-align: left;
            font-family: inherit; font-size: 13px;
            cursor: pointer; transition: background 0.1s;
            display: block; margin-bottom: 1px;
        }
        .nav-item:hover { background: var(--gray-200); color: var(--gray-800); }

        .history-list { max-height: 180px; overflow-y: auto; }
        .history-list::-webkit-scrollbar { width: 3px; }
        .history-list::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

        .history-item {
            display: flex; align-items: center; gap: 6px;
            padding: 6px 10px; border-radius: 6px;
            cursor: pointer; font-size: 12px; color: var(--gray-600);
            transition: background 0.1s;
        }
        .history-item:hover { background: var(--gray-200); }
        .history-item.active { background: var(--blue-50); color: var(--gold); }
        .history-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .history-date { font-size: 10px; color: var(--gray-400); }
        .history-del { opacity: 0; background: none; border: none; color: var(--gray-400); cursor: pointer; font-size: 11px; padding: 2px; }
        .history-item:hover .history-del { opacity: 1; }
        .history-del:hover { color: var(--red-500); }

        .sidebar-foot {
            padding: 12px 16px; border-top: 1px solid var(--gray-200);
            font-size: 11px; color: var(--gray-400); text-align: center; line-height: 1.5;
        }

        .sidebar-user {
            display: none; align-items: center; gap: 8px;
            padding: 10px 16px; border-top: 1px solid var(--gray-200);
            font-size: 12px; color: var(--gray-600);
        }
        .sidebar-user.visible { display: flex; }
        .sidebar-user-dot { width: 8px; height: 8px; background: var(--green-500); border-radius: 50%; flex-shrink: 0; }
        .sidebar-user-info { flex: 1; min-width: 0; }
        .sidebar-user-name { font-weight: 600; color: var(--gray-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .sidebar-user-email { font-size: 11px; color: var(--gray-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .sidebar-logout {
            background: none; border: none; color: var(--gray-400); cursor: pointer;
            font-size: 11px; padding: 4px 8px; border-radius: 4px;
            transition: color .15s, background .15s;
        }
        .sidebar-logout:hover { color: var(--red-500); background: var(--red-50); }

        /* -- MAIN -- */
        .main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--white); }

        .header {
            padding: 12px 24px; border-bottom: 1px solid var(--gray-200);
            display: flex; align-items: center; justify-content: space-between; background: var(--white);
        }
        .header-left { display: flex; align-items: center; gap: 10px; }

        .hamburger {
            display: none; background: none; border: none;
            color: var(--gray-600); cursor: pointer; padding: 4px; border-radius: 6px;
        }
        .hamburger:hover { background: var(--gray-100); }
        .hamburger svg { width: 20px; height: 20px; }

        .header-dot { width: 7px; height: 7px; background: var(--green-500); border-radius: 50%; }
        .header h3 { font-size: 15px; font-weight: 500; font-family: var(--font-heading); color: var(--gray-800); }
        .header-sub { font-size: 12px; color: var(--gray-400); }

        .conn-badge {
            display: none; align-items: center; gap: 5px;
            padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 500;
        }
        .conn-badge.disconnected { display: flex; background: #fef2f2; color: var(--red-500); }
        .conn-badge.reconnecting { display: flex; background: #fffbeb; color: var(--amber-500); animation: blink 1.5s infinite; }
        @keyframes blink { 0%,100%{opacity:1} 50%{opacity:.5} }
        .conn-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

        .identity-pill {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 6px 10px; background: var(--blue-50); color: var(--gold);
            border-radius: 999px; font-size: 11px; font-weight: 600;
        }
        .identity-pill.dim { background: var(--gray-100); color: var(--gray-500); }

        /* -- CLOCK BADGE (time tracking indicator) -- */
        .clock-badge {
            display: none; align-items: center; gap: 6px;
            padding: 5px 12px; border-radius: 999px; font-size: 11px; font-weight: 500;
            background: var(--gray-100); color: var(--gray-500);
            transition: all .3s ease; cursor: default;
            font-variant-numeric: tabular-nums;
        }
        .clock-badge.visible { display: inline-flex; }
        .clock-badge.fichado {
            background: rgba(126, 188, 137, .12); color: var(--green-500);
            border: 1px solid rgba(126, 188, 137, .25);
        }
        .clock-badge.no-fichado {
            background: var(--gray-100); color: var(--gray-400);
            border: 1px solid var(--gray-200);
        }
        .clock-dot {
            width: 6px; height: 6px; border-radius: 50%;
            background: var(--gray-400); flex-shrink: 0;
            transition: background .3s ease;
        }
        .clock-badge.fichado .clock-dot {
            background: var(--green-500);
            animation: clock-pulse 2s ease-in-out infinite;
        }
        @keyframes clock-pulse {
            0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(126, 188, 137, .4); }
            50% { opacity: .7; box-shadow: 0 0 0 4px rgba(126, 188, 137, 0); }
        }
        .clock-text { white-space: nowrap; letter-spacing: .01em; }

        /* -- MESSAGES -- */
        .messages { flex: 1; overflow-y: auto; padding: 20px 0; }
        .messages::-webkit-scrollbar { width: 5px; }
        .messages::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 5px; }
        .msg-wrap { max-width: 1188px; margin: 0 auto; padding: 0 24px; }
        .msg { margin-bottom: 16px; animation: fadeUp .2s ease-out; }
        @keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

        .msg-user { display: flex; justify-content: flex-end; }
        .msg-user .bubble {
            background: var(--gold); color: #152621;
            border-radius: 16px 16px 4px 16px;
            padding: 10px 14px; max-width: 85%;
            font-size: 16px; line-height: 1.5; word-break: break-word;
        }

        .msg-assistant { display: flex; gap: 10px; align-items: flex-start; min-width: 0; flex-wrap: wrap; }
        .msg-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
        .msg-avatar {
            width: 28px; height: 28px; background: var(--gold); border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; margin-top: 2px;
        }
        .msg-avatar svg { width: 14px; height: 14px; color: #152621; }
        .msg-assistant .bubble {
            background: var(--gray-50); border: 1px solid var(--gray-200);
            border-radius: 4px 16px 16px 16px;
            padding: 12px 16px; max-width: 95%;
            font-size: 16px; line-height: 1.65; color: var(--gray-800);
            min-width: 0; overflow-wrap: break-word; word-break: break-word;
        }

        .bubble p { margin-bottom: 8px; }
        .bubble p:last-child { margin-bottom: 0; }
        .bubble strong { color: var(--gray-900); font-weight: 600; }
        .bubble ul, .bubble ol { margin: 6px 0 6px 18px; }
        .bubble li { margin-bottom: 3px; }
        .bubble h2 { font-size: 19px; font-weight: 500; font-family: var(--font-heading); margin: 14px 0 6px; color: var(--gray-900); }
        .bubble h3 { font-size: 17px; font-weight: 500; font-family: var(--font-heading); margin: 12px 0 4px; color: var(--gray-800); }
        .bubble h4 { font-size: 16px; font-weight: 500; font-family: var(--font-heading); margin: 10px 0 4px; color: var(--gray-700); }
        .bubble a { color: var(--gold); text-decoration: none; }
        .bubble a:hover { text-decoration: underline; }
        .bubble img { max-width: 100%; border-radius: 10px; margin: 8px 0; display: block; box-shadow: 0 2px 12px rgba(0,0,0,.15); }
        .bubble hr { border: none; border-top: 1px solid var(--gray-200); margin: 12px 0; }
        .bubble table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
        .bubble th, .bubble td { border: 1px solid var(--gray-200); padding: 6px 10px; text-align: left; }
        .bubble th { background: var(--gray-100); font-weight: 600; color: var(--gray-800); }
        .bubble tr:nth-child(even) { background: var(--gray-50); }
        .bubble blockquote { border-left: 3px solid var(--gold); margin: 10px 0; padding: 6px 12px; color: var(--gray-600); background: var(--blue-50); border-radius: 0 6px 6px 0; }
        .bubble code { background: var(--gray-100); padding: 2px 5px; border-radius: 4px; font-size: 13px; color: var(--gray-700); }
        .bubble pre { background: var(--gray-900); border-radius: 8px; padding: 14px; margin: 10px 0; overflow-x: auto; position: relative; }
        .bubble pre code { background: none; padding: 0; color: var(--gray-100); font-size: 12px; line-height: 1.6; }

        .copy-btn {
            position: absolute; top: 6px; right: 6px;
            background: var(--gray-700); border: none; border-radius: 4px;
            color: var(--gray-300); padding: 3px 8px;
            font-size: 11px; font-family: inherit;
            cursor: pointer; opacity: 0; transition: opacity .15s;
        }
        .bubble pre:hover .copy-btn { opacity: 1; }
        .copy-btn:hover { background: var(--gray-600); color: #fff; }

        .msg-actions {
            display: flex; gap: 4px; margin-top: 6px;
            opacity: 1; transition: opacity .15s;
        }

        /* Follow-up suggestion chips (Perplexity-style) */
        .follow-up-suggestions {
            display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
            animation: fadeUp .3s ease-out;
        }
        .follow-up-chip {
            background: none; border: 1px solid var(--gray-200); border-radius: 20px;
            color: var(--text-secondary); padding: 6px 14px;
            font-size: 12.5px; font-family: var(--font-body); cursor: pointer;
            transition: all .2s ease; line-height: 1.4;
            max-width: 100%;
        }
        .follow-up-chip:hover {
            background: var(--gray-100); color: var(--text-primary);
            border-color: var(--gray-300);
        }

        /* Auto-TTS toggle in header */
        .auto-tts-toggle {
            background: none; border: 1px solid var(--gray-300); border-radius: 8px;
            color: var(--gray-400); padding: 4px 10px;
            font-size: 12px; font-family: var(--font-body); cursor: pointer;
            display: flex; align-items: center; gap: 5px;
            transition: all .2s;
        }
        .auto-tts-toggle:hover { background: var(--gray-100); color: var(--gray-600); }
        .auto-tts-toggle.active { background: var(--gold); color: #152621; border-color: var(--gold); }
        .auto-tts-toggle svg { width: 14px; height: 14px; }

        .feedback-btn {
            background: none; border: 1px solid var(--gray-200); border-radius: 6px;
            color: var(--gray-400); padding: 3px 6px;
            font-size: 13px; cursor: pointer;
            display: flex; align-items: center; gap: 2px;
            transition: all .15s;
        }
        .feedback-btn:hover { background: var(--gray-100); color: var(--gray-700); }
        .feedback-btn.active-up { background: var(--green-50); color: var(--green-500); border-color: var(--green-500); }
        .feedback-btn.active-down { background: var(--red-50); color: var(--red-500); border-color: var(--red-500); }

        .act-btn {
            background: none; border: 1px solid var(--gray-200); border-radius: 6px;
            color: var(--gray-500); padding: 3px 8px;
            font-size: 11px; font-family: inherit; cursor: pointer;
            display: flex; align-items: center; gap: 3px;
        }
        .act-btn:hover { background: var(--gray-100); color: var(--gray-700); }
        .tts-btn.tts-loading { opacity: .5; pointer-events: none; }
        .tts-btn.tts-playing { background: var(--gold); color: #152621; border-color: var(--gold); }
        @keyframes tts-pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
        .tts-btn.tts-loading svg { animation: tts-pulse 1s infinite; }

        /* Email draft send button */
        .draft-actions {
            display: flex; gap: 8px; margin-top: 12px; padding-top: 10px;
            border-top: 1px solid var(--gray-200);
        }
        .draft-send-btn {
            background: var(--gold); color: #152621; border: none; border-radius: 8px;
            padding: 8px 20px; font-size: 14px; font-weight: 600;
            font-family: var(--font-body); cursor: pointer;
            transition: all .2s; display: flex; align-items: center; gap: 6px;
        }
        .draft-send-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
        .draft-send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
        .draft-send-btn.sent { background: var(--green-500); color: #fff; }
        .draft-send-btn.error { background: var(--red-500); color: #fff; }

        .typing-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; animation: fadeUp .2s ease-out; }
        .typing-card {
            display: flex; flex-direction: column; gap: 8px;
            padding: 14px 18px; min-width: 220px; max-width: 340px;
            background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 4px 16px 16px 16px;
        }
        .typing-top { display: flex; align-items: center; gap: 8px; }
        .typing-sparkle {
            width: 18px; height: 18px; color: var(--gold); flex-shrink: 0;
            animation: sparkle-pulse 1.8s ease-in-out infinite;
        }
        @keyframes sparkle-pulse {
            0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
            50% { opacity: .6; transform: scale(.85) rotate(15deg); }
        }
        .typing-status {
            font-size: 13px; font-weight: 500; color: var(--gray-700);
            flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .typing-timer {
            font-size: 11px; color: var(--gray-400); font-variant-numeric: tabular-nums;
            white-space: nowrap; flex-shrink: 0;
        }
        .typing-progress-wrap {
            width: 100%; height: 3px; background: var(--gray-200); border-radius: 3px; overflow: hidden;
        }
        .typing-progress-bar {
            height: 100%; width: 0%; border-radius: 3px;
            background: linear-gradient(90deg, var(--gold), #e8d9c0);
            transition: width .4s cubic-bezier(.4, 0, .2, 1);
        }
        .typing-estimate {
            font-size: 11px; color: var(--gray-400); text-align: right;
            font-variant-numeric: tabular-nums;
        }

        /* -- WELCOME -- */
        .welcome { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }
        .welcome-inner { text-align: center; max-width: 640px; }
        .welcome-inner h1 { font-size: 28px; font-weight: 400; font-family: var(--font-heading); color: var(--gray-800); margin-bottom: 6px; }
        .welcome-inner p { font-size: 14px; color: var(--gray-500); margin-bottom: 28px; line-height: 1.5; }

        .welcome-status {
            display: inline-flex; align-items: center; gap: 8px;
            padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 500; margin-bottom: 24px;
        }
        .welcome-status.logged-in { background: var(--green-50); color: var(--green-500); border: 1px solid var(--green-500); }
        .welcome-status.guest { background: var(--gray-100); color: var(--gray-500); border: 1px solid var(--gray-200); }
        .welcome-status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

        .suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }
        .sug {
            background: var(--white); border: 1px solid var(--gray-200);
            border-radius: 10px; padding: 12px 14px;
            cursor: pointer; transition: border-color .15s, background .15s;
        }
        .sug:hover { border-color: var(--gold); background: var(--blue-50); }
        .sug strong { display: block; font-size: 13px; font-weight: 600; color: var(--gray-800); margin-bottom: 2px; }
        .sug span { font-size: 12px; color: var(--gray-500); line-height: 1.4; }

        .report-dl {
            display: flex; align-items: center; gap: 8px;
            background: var(--blue-50); border: 1px solid var(--gray-200);
            border-radius: 8px; padding: 10px 14px; margin-top: 8px;
        }
        .report-dl a { color: var(--gold); text-decoration: none; font-weight: 500; font-size: 13px; }
        .report-dl a:hover { text-decoration: underline; }
        .report-dl .r-size { font-size: 11px; color: var(--gray-400); margin-left: auto; }

        /* -- INPUT AREA -- */
        .input-area { padding: 12px 24px 20px; background: var(--white); border-top: 1px solid var(--gray-200); }
        .input-wrap { max-width: 1188px; margin: 0 auto; }
        .input-box {
            display: flex; align-items: flex-end; gap: 8px;
            background: var(--gray-50); border: 1px solid var(--gray-200);
            border-radius: 12px; padding: 4px 4px 4px 16px; transition: border-color .15s;
        }
        .input-box:focus-within { border-color: var(--gold); }
        .input-box textarea {
            flex: 1; background: none; border: none; color: var(--gray-800);
            font-family: inherit; font-size: 14px; line-height: 1.5;
            resize: none; outline: none; padding: 8px 0; max-height: 120px;
        }
        .input-box textarea::placeholder { color: var(--gray-400); }
        .send-btn {
            width: 36px; height: 36px; background: var(--gold); border: none; border-radius: 10px;
            color: #152621; cursor: pointer; display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; transition: background .15s;
        }
        .send-btn:hover { background: #c9b89e; }
        .send-btn:disabled { opacity: .25; cursor: default; }
        .send-btn svg { width: 16px; height: 16px; }

        .stop-btn {
            width: 36px; height: 36px; background: var(--red-500); border: none; border-radius: 10px;
            color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; transition: background .15s; animation: fadeUp .2s ease-out;
        }
        .stop-btn:hover { background: #dc2626; }
        .stop-btn svg { width: 14px; height: 14px; }

        /* -- VOICE INPUT BUTTON -- */
        .voice-btn {
            width: 36px; height: 36px; background: none; border: 1px solid var(--gray-200); border-radius: 10px;
            color: var(--gray-400); cursor: pointer; display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; transition: all .2s; position: relative;
        }
        .voice-btn:hover { background: var(--gray-100); color: var(--gray-600); border-color: var(--gray-300); }
        .voice-btn.recording { background: var(--red-500); color: #fff; border-color: var(--red-500); animation: pulse-voice 1.5s infinite; }
        .voice-btn svg { width: 16px; height: 16px; }
        @keyframes pulse-voice { 0%,100% { box-shadow: 0 0 0 0 rgba(224,112,112,.4); } 50% { box-shadow: 0 0 0 8px rgba(224,112,112,0); } }
        .voice-lang-menu {
            display: none; position: absolute; bottom: 44px; right: 0;
            background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,.15); overflow: hidden; z-index: 10;
            min-width: 120px;
        }
        .voice-lang-menu.open { display: block; }
        .voice-lang-option {
            display: block; width: 100%; padding: 8px 14px; background: none; border: none;
            color: var(--gray-600); font-family: inherit; font-size: 13px; text-align: left;
            cursor: pointer; transition: background .1s;
        }
        .voice-lang-option:hover { background: var(--gray-200); color: var(--gray-800); }
        .voice-lang-option.active { color: var(--gold); font-weight: 600; }
        .voice-status {
            display: none; font-size: 11px; color: var(--red-500); font-weight: 500;
            animation: fadeUp .2s ease-out;
        }
        .voice-status.active { display: inline; }

        /* -- ADMIN PANEL -- */
        .admin-overlay {
            display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
            z-index: 300; align-items: center; justify-content: center; padding: 20px;
        }
        .admin-overlay.open { display: flex; }
        .admin-card {
            background: var(--white); border-radius: 16px; padding: 28px;
            width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
            max-height: 80vh; overflow-y: auto;
        }
        .admin-card h2 {
            font-family: var(--font-heading); font-size: 22px; font-weight: 400;
            color: var(--gray-800); margin-bottom: 4px;
        }
        .admin-card .admin-sub { font-size: 13px; color: var(--gray-400); margin-bottom: 20px; }
        .admin-rules-list { margin-bottom: 16px; }
        .admin-rule-item {
            display: flex; align-items: flex-start; gap: 10px;
            padding: 10px 12px; background: var(--gray-50); border: 1px solid var(--gray-200);
            border-radius: 8px; margin-bottom: 6px; font-size: 13px; color: var(--gray-700); line-height: 1.5;
        }
        .admin-rule-text { flex: 1; }
        .admin-rule-date { font-size: 11px; color: var(--gray-400); white-space: nowrap; }
        .admin-rule-del {
            background: none; border: none; color: var(--gray-400); cursor: pointer;
            font-size: 16px; padding: 0 4px; transition: color .15s;
        }
        .admin-rule-del:hover { color: var(--red-500); }
        .admin-input-row { display: flex; gap: 8px; margin-bottom: 12px; }
        .admin-input {
            flex: 1; padding: 10px 14px; background: var(--gray-50); border: 1px solid var(--gray-200);
            border-radius: 8px; font-family: inherit; font-size: 14px; color: var(--gray-800);
            outline: none; resize: vertical; min-height: 40px;
        }
        .admin-input:focus { border-color: var(--gold); }
        .admin-input::placeholder { color: var(--gray-400); }
        .admin-add-btn {
            padding: 10px 20px; background: var(--gold); color: #152621; border: none;
            border-radius: 8px; font-family: inherit; font-size: 14px; font-weight: 600;
            cursor: pointer; transition: background .15s; white-space: nowrap;
        }
        .admin-add-btn:hover { background: #c9b89e; }
        .admin-add-btn:disabled { opacity: .5; cursor: default; }
        .admin-close-btn {
            width: 100%; padding: 10px; background: var(--gray-50); border: 1px solid var(--gray-200);
            border-radius: 8px; color: var(--gray-600); font-family: inherit; font-size: 14px;
            cursor: pointer; transition: background .15s;
        }
        .admin-close-btn:hover { background: var(--gray-100); }
        .admin-empty { text-align: center; padding: 20px; color: var(--gray-400); font-size: 13px; }

        .input-hint { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--gray-400); }

        .input-hint kbd { font-family: inherit; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 3px; padding: 0 4px; font-size: 10px; }

        .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 99; }
        .overlay.active { display: block; }

        /* -- MOBILE RESPONSIVE -- */
        @media (max-width: 768px) {
            .hamburger { display: flex; }
            .sidebar {
                position: fixed; left: -280px; top: 0; bottom: 0;
                z-index: 100; width: 260px; transition: left .25s ease;
            }
            .sidebar.open { left: 0; }
            .suggestions { grid-template-columns: 1fr; }
            .header { padding: 10px 12px; gap: 6px; }
            .msg-wrap { padding: 0 10px; }
            .input-area { padding: 8px 10px 12px; }
            .input-hint { display: none; }
            .welcome { padding: 20px 16px; }
            .welcome-inner h1 { font-size: 20px; }
            .welcome-inner p { font-size: 13px; margin-bottom: 20px; }
            .msg-user .bubble { max-width: 82%; font-size: 14px; }
            .msg-assistant { gap: 6px; }
            .msg-assistant .bubble { max-width: calc(100% - 30px); font-size: 14px; padding: 10px 12px; overflow-wrap: break-word; word-break: break-word; }
            .msg-avatar { width: 22px; height: 22px; flex-shrink: 0; }
            .msg-avatar svg { width: 11px; height: 11px; }
            .msg-actions { gap: 3px; flex-wrap: wrap; }
            .msg-actions .act-btn { padding: 2px 6px; font-size: 10px; }
            .msg-actions .act-btn svg { width: 12px; height: 12px; }
            .msg-actions .feedback-btn { padding: 2px 5px; font-size: 12px; }
            .identity-pill { font-size: 10px; padding: 4px 8px; display: none; }
            .typing-card { min-width: 180px; max-width: 260px; padding: 10px 14px; }
            .typing-status { font-size: 12px; }
            .typing-estimate { font-size: 10px; }
            .header-sub { font-size: 10px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
            .auto-tts-toggle { padding: 3px 8px; font-size: 11px; gap: 3px; }
            .auto-tts-toggle svg { width: 12px; height: 12px; }
            .auto-tts-toggle span { display: none; }
            .voice-btn { width: 40px; height: 40px; }
            .voice-btn svg { width: 18px; height: 18px; }
            .bubble h2 { font-size: 16px; }
            .bubble h3 { font-size: 15px; }
            .bubble table { font-size: 12px; display: block; overflow-x: auto; }
            .bubble pre { padding: 10px; margin: 8px 0; }
            .login-card { padding: 32px 24px; }
            .login-card h1 { font-size: 20px; }
        }

        @media (max-width: 480px) {
            .header h3 { font-size: 13px; }
            .header-dot { width: 6px; height: 6px; }
            .header-left { gap: 4px; }
            .header-sub { display: none; }
            .sug { padding: 10px 12px; }
            .sug strong { font-size: 12px; }
            .sug span { font-size: 11px; }
            .msg-wrap { padding: 0 8px; }
            .msg-assistant .bubble { padding: 8px 10px; }
            .msg-user .bubble { max-width: 80%; font-size: 14px; }
            .input-area { padding: 6px 8px 10px; }
            .voice-btn { width: 42px; height: 42px; }
            .voice-btn svg { width: 20px; height: 20px; }
            .login-card { padding: 28px 20px; border-radius: 16px; }
            .login-logo { width: 48px; height: 48px; margin-bottom: 16px; }
            .login-logo svg { width: 24px; height: 24px; }
            .login-card h1 { font-size: 18px; }
            .login-card .login-subtitle { font-size: 13px; margin-bottom: 24px; }
            .login-field input, .login-field select { font-size: 16px; padding: 11px 12px; }
            .login-btn { font-size: 16px; padding: 14px; }
        }

        /* -- MOBILE LANDSCAPE -- */
        @media (max-height: 500px) and (orientation: landscape) {
            .sidebar { width: 200px; }
            .header { padding: 6px 14px; }
            .messages { padding: 8px 0; }
            .msg-wrap { padding: 0 14px; }
            .input-area { padding: 6px 10px 8px; }
            .welcome { padding: 12px 16px; }
            .welcome-inner h1 { font-size: 18px; margin-bottom: 4px; }
            .welcome-inner p { font-size: 12px; margin-bottom: 12px; }
            .suggestions { grid-template-columns: 1fr 1fr; gap: 6px; }
            .sug { padding: 8px 10px; }
            .sug strong { font-size: 12px; }
            .sug span { font-size: 11px; }
            .main { min-width: 0; flex: 1; }
        }

        /* -- TOUCH DEVICES -- */
        @media (hover: none) and (pointer: coarse) {
            .voice-btn { width: 44px; height: 44px; -webkit-tap-highlight-color: transparent; }
            .voice-btn svg { width: 20px; height: 20px; }
            .voice-btn.recording { animation: pulse-voice 1s infinite; }
            .send-btn { width: 40px; height: 40px; }
            .act-btn { padding: 4px 10px; min-height: 32px; }
            .feedback-btn { min-height: 32px; padding: 4px 8px; }
        }

        /* -- SAFE AREA (notch phones) -- */
        @supports (padding: env(safe-area-inset-bottom)) {
            .input-area { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
            .login-overlay { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
        }

/* -- HITL APPROVAL CARDS -- */
.approval-card {
    border: 1px solid rgba(220, 203, 179, .55);
    background: rgba(220, 203, 179, .08);
    border-radius: 12px;
    padding: 12px;
    margin-top: 12px;
}
.approval-title {
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 4px;
}
.approval-tool {
    color: var(--gray-600);
    font-size: 13px;
    margin-bottom: 8px;
}
.approval-summary {
    white-space: pre-wrap;
    font-size: 12px;
    max-height: 180px;
    overflow: auto;
    background: rgba(0, 0, 0, .14);
    border-radius: 8px;
    padding: 8px;
    margin: 0 0 10px;
}
.approval-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.approval-btn {
    border: 0;
    border-radius: 8px;
    padding: 8px 12px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.approval-btn.approve { background: var(--gold); color: #152621; }
.approval-btn.reject { background: transparent; color: var(--gray-500); border: 1px solid var(--gray-300); }
.approval-done { color: var(--green-500); font-weight: 700; }
.approval-rejected { color: var(--red-500); font-weight: 700; }
.approval-card.approved { border-color: rgba(126, 188, 137, .55); }
.approval-card.rejected { border-color: rgba(224, 112, 112, .45); opacity: .8; }
