/* FarmaGold — Design system · Farmácia de manipulação */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
    --fg-ink: #0f1f1c;
    --fg-muted: #5c6f6a;
    --fg-teal: #0d4a42;
    --fg-teal-deep: #082f2a;
    --fg-sage: #1a6b5c;
    --fg-mint: #2d8f7a;
    --fg-gold: #c4a35a;
    --fg-gold-soft: #e8d4a8;
    --fg-cream: #f7f5f0;
    --fg-surface: #ffffff;
    --fg-panel: #eef4f1;
    --fg-border: rgba(13, 74, 66, 0.12);
    --fg-shadow: 0 12px 40px rgba(8, 47, 42, 0.12);
    --fg-shadow-sm: 0 4px 16px rgba(8, 47, 42, 0.08);
    --fg-radius: 12px;
    --fg-radius-lg: 20px;
    --msg-sent: #d4efe6;
    --msg-received: #ffffff;
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-ui: 'DM Sans', system-ui, sans-serif;
    /* aliases legados */
    --primary-color: var(--fg-teal);
    --primary-hover: var(--fg-teal-deep);
    --accent-color: var(--fg-mint);
    --bg-body: var(--fg-cream);
    --bg-panel: var(--fg-panel);
    --bg-white: var(--fg-surface);
    --text-main: var(--fg-ink);
    --text-secondary: var(--fg-muted);
}

* { box-sizing: border-box; outline: none; }

html:has(body[data-fg-index="1"]) {
    height: 100%;
    overflow: hidden;
}

body[data-fg-index="1"] {
    overflow: hidden !important;
    height: 100vh !important;
}

body {
    font-family: var(--font-ui);
    margin: 0;
    padding: 0;
    background: var(--fg-cream);
    color: var(--fg-ink);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========== APP SHELL ========== */
.main-container { display: flex; width: 100%; height: 100vh; min-height: 0; overflow: hidden; }
.main-container.admin-layout {
    min-height: 100vh;
    height: 100vh;
}
.admin-layout .sidebar {
    height: 100vh;
    flex-shrink: 0;
}
.sidebar-spacer { flex: 1; min-height: 12px; }
.user-info span:last-child {
    font-size: 10px;
    opacity: 0.7;
    display: block;
    letter-spacing: 0.08em;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--fg-teal-deep) 0%, var(--fg-teal) 55%, #0f5c50 100%);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    z-index: 1000;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(8, 47, 42, 0.2);
    overflow: hidden;
    position: relative;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent, var(--fg-gold-soft), transparent);
    opacity: 0.35;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    min-height: 56px;
}

.logo-area { display: flex; align-items: center; gap: 12px; overflow: hidden; }

.logo-icon-img {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 10px;
    display: block;
    object-fit: contain;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.logo-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    background: linear-gradient(135deg, var(--fg-gold) 0%, #a88b45 100%);
    color: var(--fg-teal-deep);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.logo-text {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    line-height: 1;
}

.brand-farma,
.brand-gold {
    font-family: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
}

.sidebar .logo-text .brand-farma { color: #fff; }
.sidebar .logo-text .brand-gold { color: var(--fg-gold); }

.login-card h2 .brand-farma { color: var(--fg-teal); }
.login-card h2 .brand-gold { color: var(--fg-gold); }

.brand-wordmark .brand-farma { color: var(--fg-teal); }
.brand-wordmark .brand-gold { color: var(--fg-gold); }

.logo-tagline {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    opacity: 0.65;
    margin-top: 2px;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 8px;
    border-radius: 8px;
    opacity: 0.9;
}
.toggle-btn:hover { background: rgba(255, 255, 255, 0.15); }

.menu-btn {
    width: 100%;
    height: 46px;
    margin-bottom: 6px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding-left: 14px;
    gap: 14px;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
}
.menu-btn i { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; opacity: 0.9; }
.menu-btn:hover,
.menu-btn.active {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    box-shadow: inset 3px 0 0 var(--fg-gold);
}

.sidebar.collapsed { width: 72px; padding: 16px 10px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .logo-tagline,
.sidebar.collapsed .menu-btn span,
.sidebar.collapsed .user-info,
.sidebar.collapsed .sidebar-spacer { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .menu-btn { justify-content: center; padding: 0; }

.user-card {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--fg-radius);
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    overflow: hidden;
}
.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--fg-gold);
    color: var(--fg-teal-deep);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    position: relative;
}
.status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--fg-teal);
}
.status-dot.status-ok { background: #4ade80; }

/* ========== CONTENT ========== */
.content-area {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    background: var(--fg-panel);
    min-height: 0;
    min-width: 0;
}
.modulo { display: none; width: 100%; height: 100%; min-height: 0; overflow: hidden; }
.modulo.active { display: flex; min-height: 0; }

#mod-chat > #lista {
    width: 360px;
    background: var(--fg-surface);
    border-right: 1px solid var(--fg-border);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: var(--fg-shadow-sm);
}

.header-lista,
#chat-header,
.chat-header-bar {
    padding: 14px 20px;
    background: var(--fg-surface);
    border-bottom: 1px solid var(--fg-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-height: 64px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.chat-avatar {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--fg-teal), var(--fg-mint));
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar--list {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
}

.chat-avatar--header {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
}

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

img.chat-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    object-fit: cover;
    display: block;
    border-radius: 50%;
    flex-shrink: 0;
}

img.chat-avatar.chat-avatar--list {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    max-width: 48px;
    max-height: 48px;
}

.chat-avatar--fallback,
#header-avatar-iniciais {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    user-select: none;
}

.chat-avatar--header #header-avatar-iniciais {
    font-size: 17px;
}

#header-avatar-box {
    position: relative;
}

#header-avatar-box #header-avatar {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#header-avatar-box #header-avatar.hidden + #header-avatar-iniciais {
    display: flex;
}

#header-avatar-box #header-avatar:not(.hidden) + #header-avatar-iniciais {
    display: none;
}

.chat-header-info { flex: 1; min-width: 180px; }
.header-num { font-size: 0.8rem; color: var(--fg-muted); display: block; }
.header-num.num-lid,
.num-cliente.num-lid {
    color: #9a7b2e;
    font-style: italic;
    font-size: 0.75rem;
}

/* IA (Gemini) no chat */
.ia-badge, .ia-transcricao, .ia-receita-resumo {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.4;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(13, 74, 66, 0.06);
    border-left: 3px solid var(--fg-gold, #c4a35a);
}
.ia-badge.ia-processando { color: var(--fg-teal); }
.ia-badge.ia-erro { background: rgba(231, 76, 60, 0.08); border-left-color: #e74c3c; color: #c0392b; }
.ia-transcricao { color: #444; }
.ia-link-orcamento, .btn-ia-gerar, .btn-ia-reprocessar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}
.ia-link-orcamento, .btn-ia-gerar {
    background: var(--fg-teal, #0d4a42);
    color: #fff;
}
.btn-ia-reprocessar {
    background: #f0f0f0;
    color: #333;
}
.btn-ia-gerar:hover, .ia-link-orcamento:hover { opacity: 0.9; }
.chat-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.atendimento-status {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.atendimento-status.status-livre {
    background: rgba(196, 163, 90, 0.15);
    color: #8a7340;
}
.atendimento-status.status-meu {
    background: rgba(45, 143, 122, 0.12);
    color: var(--fg-sage);
}
.atendimento-status.status-outro {
    background: rgba(185, 28, 28, 0.08);
    color: #b45309;
}

.btn-iniciar-atend {
    background: linear-gradient(135deg, var(--fg-mint), var(--fg-sage));
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-finalizar-atend {
    background: var(--fg-panel);
    color: var(--fg-teal);
    border: 1px solid var(--fg-border);
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-sm { padding: 8px 14px !important; font-size: 12px !important; }

.input-bloqueio {
    width: 100%;
    padding: 12px 16px;
    background: var(--fg-panel);
    border-radius: 10px;
    color: var(--fg-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}
.input-row.hidden { display: none !important; }

.atendente-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(45, 143, 122, 0.12);
    color: var(--fg-sage);
}
.item-em-atendimento { border-left: 3px solid var(--fg-gold) !important; }
.item-meu-atendimento { border-left: 3px solid var(--fg-mint) !important; background: linear-gradient(90deg, rgba(45, 143, 122, 0.06), transparent); }

.msg-sistema {
    align-items: center !important;
    width: 100%;
}
.msg-sistema .msg-content {
    max-width: 90%;
    background: rgba(196, 163, 90, 0.12) !important;
    border: 1px dashed var(--fg-gold) !important;
    text-align: center;
    font-size: 12px;
    color: var(--fg-muted);
    box-shadow: none;
}
.msg-atendente-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--fg-sage);
    margin-bottom: 4px;
}

.fg-notif-interna-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.fg-notif-interna-box {
    background: var(--fg-surface);
    border-radius: 12px;
    max-width: 440px;
    width: 100%;
    padding: 24px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
    border-top: 4px solid var(--fg-gold);
}
.fg-notif-interna-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fg-muted);
    background: var(--fg-panel);
    padding: 6px 10px;
    border-radius: 999px;
    margin-bottom: 12px;
}
.fg-notif-interna-titulo {
    margin: 0 0 12px;
    font-size: 18px;
    color: var(--fg-teal);
}
.fg-notif-interna-texto {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
    color: #444;
}
.fg-notif-interna-acoes {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.header-lista .titulo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--fg-teal);
}

#lista-clientes {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--fg-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.15s;
}
.item:hover { background: var(--fg-panel); }
.item.ativo {
    background: linear-gradient(90deg, rgba(45, 143, 122, 0.08), transparent);
    border-left: 3px solid var(--fg-mint);
}

.item .badge {
    background: var(--fg-mint);
    color: white;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    margin-left: auto;
}

/* ========== CHAT ========== */
#painel-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(45, 143, 122, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(196, 163, 90, 0.05) 0%, transparent 45%),
        var(--fg-panel);
    position: relative;
    overflow: hidden;
}

#msgs {
    flex: 1 1 auto;
    min-height: 0;
    padding: 24px 6%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg { display: flex; flex-direction: column; margin-bottom: 8px; width: 100%; }
.msg.recebida { align-items: flex-start; }
.msg.enviada { align-items: flex-end; }

.msg-content {
    position: relative;
    max-width: 68%;
    min-width: 120px;
    padding: 10px 12px 8px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: var(--fg-shadow-sm);
    word-wrap: break-word;
}
.msg.recebida .msg-content {
    background: var(--msg-received);
    border: 1px solid var(--fg-border);
    border-bottom-left-radius: 4px;
}
.msg.enviada .msg-content {
    background: var(--msg-sent);
    border: 1px solid rgba(45, 143, 122, 0.2);
    border-bottom-right-radius: 4px;
}

.msg-meta {
    float: right;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
    margin-top: 4px;
}
.msg-time { font-size: 11px; color: var(--fg-muted); }
.msg-tick { color: var(--fg-mint); }

.msg-content img {
    max-width: 100%;
    max-height: 320px;
    border-radius: 10px;
    display: block;
    margin-bottom: 6px;
    cursor: pointer;
}

#input-area {
    padding: 14px 20px;
    background: var(--fg-surface);
    border-top: 1px solid var(--fg-border);
    display: flex;
    gap: 12px;
    align-items: center;
    min-height: 68px;
}

#input-area input[type="text"] {
    flex: 1;
    border-radius: 999px;
    border: 1px solid var(--fg-border);
    padding: 12px 20px;
    background: var(--fg-cream);
}

#emoji-picker-container {
    position: absolute;
    bottom: 78px;
    left: 24px;
    z-index: 2000;
    box-shadow: var(--fg-shadow);
    border-radius: var(--fg-radius);
    background: white;
}

.audio-msg-container { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.audio-icon-visual {
    width: 40px;
    height: 40px;
    background: var(--fg-mint);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.doc-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--fg-panel);
    padding: 12px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
}

.chat-video {
    max-width: min(100%, 360px);
    border-radius: 8px;
    background: #000;
    display: block;
}

.video-msg-fallback {
    max-width: min(100%, 360px);
}

.video-msg-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--fg-muted);
}

.hidden { display: none !important; }

/* ========== FORMS & BUTTONS ========== */
.form-container {
    padding: 32px 40px;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: var(--fg-surface);
}

.tabs-header,
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--fg-border);
    padding-bottom: 0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: var(--font-ui);
}
.tab-btn:hover { color: var(--fg-teal); }
.tab-btn.active {
    color: var(--fg-teal);
    border-bottom-color: var(--fg-gold);
}

.tab-pane,
.tab-content { display: none !important; opacity: 0; }
.tab-pane.active,
.tab-content.active {
    display: block !important;
    opacity: 1;
    animation: fgFadeIn 0.35s forwards;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 16px;
}
.full-width { grid-column: span 2; }
@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: span 1; }
}

label {
    font-size: 12px;
    font-weight: 600;
    color: var(--fg-muted);
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--fg-border);
    border-radius: 10px;
    font-size: 14px;
    font-family: var(--font-ui);
    background: var(--fg-cream);
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus,
select:focus,
textarea:focus {
    border-color: var(--fg-mint);
    box-shadow: 0 0 0 3px rgba(45, 143, 122, 0.15);
    background: white;
}

.btn-primary {
    background: linear-gradient(135deg, var(--fg-teal) 0%, var(--fg-sage) 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-ui);
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(13, 74, 66, 0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(13, 74, 66, 0.3);
}

.btn-danger {
    background: #b91c1c;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
}
.btn-icon:hover { background: var(--fg-panel); }

.btn-secondary {
    background: var(--fg-panel);
    color: var(--fg-teal);
    border: 1px solid var(--fg-border);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

/* ========== LOGIN ========== */
.login-body {
    margin: 0;
    min-height: 100vh;
    overflow: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--fg-teal-deep);
}

.login-hero {
    position: relative;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: white;
    overflow: hidden;
}

.login-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 20%, rgba(196, 163, 90, 0.25) 0%, transparent 45%),
        radial-gradient(circle at 70% 80%, rgba(45, 143, 122, 0.3) 0%, transparent 50%);
    pointer-events: none;
}

.login-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 600;
    line-height: 1.1;
    margin: 0 0 16px;
    position: relative;
}

.login-hero p {
    font-size: 1.05rem;
    opacity: 0.85;
    max-width: 420px;
    line-height: 1.6;
    position: relative;
}

.login-hero-features {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    opacity: 0.9;
}
.login-feature i {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-gold);
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--fg-cream);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--fg-surface);
    border-radius: var(--fg-radius-lg);
    box-shadow: var(--fg-shadow);
    padding: 40px;
    border: 1px solid var(--fg-border);
}

.login-card .brand-mark {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
}

.login-card .brand-mark img,
.login-card .brand-mark .brand-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 12px;
}

.login-card h2 {
    font-family: var(--font-display);
    font-size: 28px;
    margin: 0;
}

.login-card .subtitle {
    font-size: 14px;
    color: var(--fg-muted);
    margin-top: 4px;
}

.input-group { margin-bottom: 20px; }
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--fg-muted);
    font-size: 14px;
}
.input-styled {
    padding-left: 42px !important;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--fg-teal-deep), var(--fg-mint));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    font-family: var(--font-ui);
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 12px;
    color: var(--fg-muted);
}

@media (max-width: 900px) {
    .login-body { grid-template-columns: 1fr; }
    .login-hero { display: none; }
}

/* legado login-card antigo */
.login-header,
.login-logo-circle,
.login-body-content { display: none; }

/* ========== ADMIN & TABLES ========== */
body.admin-body,
body.page-body {
    overflow: auto !important;
    height: auto !important;
    min-height: 100vh;
}

.admin-layout .content-area.admin-main,
.page-layout .content-area.page-main {
    display: block !important;
    overflow: visible !important;
    background: var(--fg-panel) !important;
    height: auto !important;
    min-height: 100vh;
}

.admin-header,
.page-header {
    background: var(--fg-surface);
    padding: 24px 32px;
    box-shadow: var(--fg-shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--fg-border);
}

.admin-header h2,
.page-header h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--fg-teal);
    font-weight: 600;
}

.admin-workspace,
.page-workspace {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.panel-card {
    background: var(--fg-surface);
    border-radius: var(--fg-radius);
    box-shadow: var(--fg-shadow-sm);
    border: 1px solid var(--fg-border);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 18px 24px;
    background: var(--fg-panel);
    border-bottom: 1px solid var(--fg-border);
}
.card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--fg-teal);
}
.card-body { padding: 24px; }
.p-0 { padding: 0 !important; }
.mt-4 { margin-top: 24px; }

.form-grid-users {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 120px;
    gap: 16px;
}
@media (max-width: 900px) {
    .form-grid-users { grid-template-columns: 1fr; }
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    background: var(--fg-panel);
    padding: 14px 18px;
    text-align: left;
    font-size: 11px;
    color: var(--fg-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--fg-border);
}
.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--fg-border);
    font-size: 14px;
}
.data-table tr:hover { background: rgba(45, 143, 122, 0.04); }

.tag {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tag-admin { background: #dbeafe; color: #1d4ed8; }
.tag-farmaceutico { background: #d1fae5; color: #047857; }

.btn-back-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    padding: 12px;
    border-radius: 10px;
    margin: 0 8px 16px;
    transition: 0.2s;
    font-size: 14px;
    font-weight: 500;
}
.btn-back-chat:hover { background: rgba(255, 255, 255, 0.18); }

/* Kanban / produção */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding: 24px;
}
.kanban-col {
    background: var(--fg-surface);
    border-radius: var(--fg-radius);
    border: 1px solid var(--fg-border);
    min-height: 400px;
    box-shadow: var(--fg-shadow-sm);
}
.kanban-col-header {
    padding: 16px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--fg-border);
    color: var(--fg-teal);
}
.kanban-card {
    margin: 12px;
    padding: 16px;
    background: var(--fg-cream);
    border-radius: 10px;
    border: 1px solid var(--fg-border);
    cursor: grab;
    transition: box-shadow 0.2s;
}
.kanban-card:hover { box-shadow: var(--fg-shadow-sm); }

/* QR WhatsApp */
.qr-box {
    text-align: center;
    padding: 24px;
    background: var(--fg-panel);
    border-radius: var(--fg-radius);
}
.qr-box img {
    max-width: 280px;
    border-radius: 12px;
    box-shadow: var(--fg-shadow);
}

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

/* ========== LISTA COM SCROLL INTERNO (fg-scroll-page) ========== */
html:has(body.fg-scroll-page) {
    height: 100%;
    overflow: hidden;
}

body.admin-body.fg-scroll-page {
    overflow: hidden !important;
    height: 100vh !important;
    min-height: 0 !important;
}

body.admin-body.fg-scroll-page .main-container.admin-layout {
    height: 100vh !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

body.admin-body.fg-scroll-page .admin-layout .content-area.admin-main {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: 100vh !important;
    overflow: hidden !important;
}

body.admin-body.fg-scroll-page .admin-header {
    flex-shrink: 0;
}

body.admin-body.fg-scroll-page .fg-list-workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 24px 32px 32px;
    max-width: none;
    margin: 0;
    overflow: hidden;
}

body.admin-body.fg-scroll-page .fg-list-workspace--compact {
    padding-top: 12px;
}

body.admin-body.fg-scroll-page .fg-list-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    overflow: hidden;
}

body.admin-body.fg-scroll-page .fg-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--fg-border);
    flex-shrink: 0;
    background: var(--fg-surface);
}

body.admin-body.fg-scroll-page .fg-list-toolbar .card-header,
body.admin-body.fg-scroll-page .card-header.fg-list-toolbar {
    padding: 0;
    border: none;
    background: transparent;
    margin: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

body.admin-body.fg-scroll-page .fg-list-search {
    position: relative;
    flex: 1;
    max-width: 420px;
}

body.admin-body.fg-scroll-page .fg-list-search input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--fg-border);
    border-radius: 24px;
    font-size: 14px;
    font-family: var(--font-ui);
}

body.admin-body.fg-scroll-page .fg-list-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

body.admin-body.fg-scroll-page .fg-list-count {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

body.admin-body.fg-scroll-page .fg-list-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

body.admin-body.fg-scroll-page .fg-list-scroll .data-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

body.admin-body.fg-scroll-page .fg-list-scroll .data-table thead {
    display: table-header-group;
}

body.admin-body.fg-scroll-page .fg-list-scroll .data-table tbody {
    display: table-row-group;
}

body.admin-body.fg-scroll-page .fg-list-scroll .data-table tr {
    display: table-row;
}

body.admin-body.fg-scroll-page .fg-list-scroll .data-table th,
body.admin-body.fg-scroll-page .fg-list-scroll .data-table td {
    display: table-cell;
    word-break: normal;
    overflow-wrap: break-word;
    vertical-align: middle;
    white-space: normal;
}

body.admin-body.fg-scroll-page .fg-list-scroll .data-table--sticky {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    min-width: 100%;
}

body.admin-body.fg-scroll-page .fg-list-scroll .data-table--sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f1f3f5;
    box-shadow: 0 1px 0 var(--fg-border);
}

/* Admin: abas com lista ou formulário longo */
body.admin-body.fg-scroll-page[data-fg-page="admin"] .admin-tabs {
    flex-shrink: 0;
    margin-bottom: 0;
    padding: 12px 32px 0;
}

body.admin-body.fg-scroll-page[data-fg-page="admin"] .admin-workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px 32px 32px;
    max-width: none;
    margin: 0;
}

body.admin-body.fg-scroll-page[data-fg-page="admin"] .tab-pane.active {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

body.admin-body.fg-scroll-page[data-fg-page="admin"] .tab-pane.active.fg-tab-form {
    overflow-y: auto;
}

body.admin-body.fg-scroll-page[data-fg-page="admin"] .fg-list-panel--nested {
    flex: 1 1 auto;
    min-height: 0;
}

/* Produção: kanban preenche área restante */
body.admin-body.fg-scroll-page[data-fg-page="producao"] .kanban-board {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    overflow-x: auto;
    overflow-y: hidden;
}

body.admin-body.fg-scroll-page[data-fg-page="producao"] .kanban-column {
    max-height: 100%;
}

/* Orçamentos: tela de cálculo rola livremente */
body.admin-body.fg-scroll-page.fg-orc-lista .admin-workspace {
    overflow: hidden;
}

body.admin-body.fg-scroll-page.fg-orc-calculo .admin-layout .content-area.admin-main {
    overflow-y: auto !important;
}

body.admin-body.fg-scroll-page.fg-orc-calculo .admin-workspace {
    overflow: visible;
    flex: none;
}

body.admin-body.fg-scroll-page[data-fg-page="admin"] #tab-users > .panel-card:first-child {
    flex-shrink: 0;
}

body.admin-body.fg-scroll-page[data-fg-page="admin"] #tab-users > .panel-card.fg-list-panel {
    flex: 1 1 auto;
    min-height: 0;
}

/* ========== CLIENTES MODULO ========== */
.clientes-container {
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.modulo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modulo-header h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--fg-teal);
}

.search-section {
    background: var(--fg-surface);
    padding: 20px;
    border-radius: var(--fg-radius);
    box-shadow: var(--fg-shadow-sm);
    border: 1px solid var(--fg-border);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--fg-panel);
    padding: 4px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.search-box:focus-within {
    border-color: var(--fg-mint);
    background: white;
    box-shadow: 0 0 0 3px rgba(45, 143, 122, 0.1);
}

.search-box i { color: var(--fg-muted); }
.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 15px;
    color: var(--fg-ink);
}

.btn-search {
    background: var(--fg-teal);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.clientes-results-wrapper {
    background: var(--fg-surface);
    border-radius: var(--fg-radius);
    box-shadow: var(--fg-shadow-sm);
    border: 1px solid var(--fg-border);
    overflow: hidden;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* Modal Clientes */
.fg-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 47, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.fg-modal-content {
    background: var(--fg-surface);
    width: 100%;
    max-width: 650px;
    border-radius: var(--fg-radius-lg);
    box-shadow: var(--fg-shadow);
    overflow: hidden;
    animation: modalShow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.fg-modal-header {
    padding: 20px 24px;
    background: var(--fg-panel);
    border-bottom: 1px solid var(--fg-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fg-modal-header h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--fg-teal);
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--fg-muted);
    cursor: pointer;
    line-height: 1;
}

.fg-modal-content form {
    padding: 24px;
}

.form-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--fg-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
