:root {
  --bg:#f6f4ef; --rail:#eeece5; --surface:#fff; --line:#e4e0d7; --text:#30372f;
  --muted:#74796f; --accent:#a54f37; --green:#3f7357; --amber:#986a28; --red:#a84038;
  font-family:"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,sans-serif;
  color:var(--text); background:var(--bg); font-synthesis:none;
}
* { box-sizing:border-box; }
[hidden] { display:none!important; }
body { margin:0; min-width:320px; }
button,input,select { font:inherit; }
button { cursor:pointer; }
button:disabled { opacity:.5; cursor:not-allowed; }
button:focus-visible,a:focus-visible,summary:focus-visible { outline:3px solid #b67b59; outline-offset:3px; }
svg { display:block; width:24px; height:24px; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.brand-mark { display:grid; place-items:center; flex:none; width:38px; height:38px; border-radius:13px; color:#fff8ef; background:var(--accent); }
.eyebrow { margin:0 0 5px; color:var(--muted); font-size:12px; font-weight:500; letter-spacing:.01em; }
h1,h2,h3 { margin:0; }
h1 { font-size:23px; font-weight:650; letter-spacing:-.6px; }
h2 { font-size:22px; font-weight:650; letter-spacing:-.5px; }
h3 { font-size:15px; font-weight:650; }
.muted,.small-message { color:var(--muted); line-height:1.6; }
form { margin-top:25px; }
label { display:grid; gap:8px; margin-top:20px; font-size:13px; font-weight:600; }
input,select { width:100%; min-height:42px; padding:11px 12px; border:1px solid #d7d6cb; border-radius:9px; color:var(--text); background:var(--surface); outline:none; }
input::placeholder { color:#85897f; }
input:focus,select:focus { border-color:#ae795c; box-shadow:0 0 0 3px #ae795c1c; }
.form-error { padding:12px; border:1px solid #ebc5bf; border-radius:9px; color:#922f29; background:#fff0ed; font-size:13px; line-height:1.5; }
.button { display:inline-flex; justify-content:center; align-items:center; gap:10px; min-height:38px; padding:9px 14px; border:1px solid #dbdcd2; border-radius:9px; background:#fff; color:var(--text); font-size:12px; font-weight:600; transition:background .15s,border-color .15s; }
.button:hover { background:#f1f1e9; border-color:#babfb1; }
.button.primary { color:#fffaf5; background:var(--accent); border-color:var(--accent); }
.button.primary:hover { background:#8f422e; border-color:#8f422e; }
.button.danger { color:var(--red); border-color:#e6c7c0; background:#fff4f1; }
.button.danger:hover { background:#fce4de; }
.button.small { min-height:30px; padding:6px 9px; font-size:11px; }
.button.full { width:100%; min-height:47px; margin-top:24px; justify-content:space-between; }

/* Warm, local-only presentation: no external fonts or assets. */
.login-page { display:grid; grid-template-columns:1.1fr 1fr; align-items:center; min-height:100dvh; padding:24px; gap:5vw; background:#faf9f5; }
.login-intro { display:flex; flex-direction:column; align-self:stretch; justify-content:space-between; min-height:620px; padding:35px 42px; border-radius:22px; background:#e9eadd; }
.login-brand { display:flex; align-items:center; gap:11px; font-size:24px; font-weight:700; letter-spacing:-1px; }
.intro-copy { padding:60px 0; max-width:550px; }
.intro-copy .eyebrow { margin-bottom:22px; color:#64705c; font-size:14px; }
.intro-copy h1 { font-family:Georgia,"Times New Roman",serif; font-size:clamp(38px,4.5vw,68px); line-height:1.08; font-weight:400; letter-spacing:-2.5px; }
.intro-copy em { color:#9e513c; font-weight:400; }
.intro-copy > p:not(.eyebrow) { max-width:350px; margin:26px 0; color:#6c7564; line-height:1.75; font-size:15px; }
.intro-services { display:flex; flex-wrap:wrap; gap:8px; margin-top:30px; }
.intro-services span { padding:7px 11px; border:1px solid #d0d6c3; border-radius:20px; font-size:11px; color:#58664c; }
.intro-footer { margin:0; color:#707863; font-size:11px; line-height:1.6; }
.login-card { width:min(100%,355px); justify-self:center; margin-right:4vw; padding:40px 0; }
.login-card h2 { margin-top:12px; font-family:Georgia,"Times New Roman",serif; font-size:35px; font-weight:400; letter-spacing:-1px; }
.login-card > .muted { margin:15px 0 33px; font-size:13px; }
.login-card input { min-height:46px; }
.login-help { margin:28px 0 0; color:#898d83; font-size:11px; line-height:1.8; max-width:290px; }

.app-page { height:100dvh; overflow:hidden; background:var(--bg); }
.messenger-shell { display:grid; grid-template-columns:204px minmax(0,1fr) auto; height:100dvh; }
.service-rail { display:flex; flex-direction:column; min-height:0; padding:27px 13px 15px; border-right:1px solid var(--line); background:var(--rail); overflow-y:auto; }
.rail-brand { display:flex; align-items:center; gap:9px; margin:0 7px 34px; color:var(--text); text-decoration:none; font-size:21px; font-weight:700; letter-spacing:-.8px; }
.rail-brand .brand-mark { width:35px; height:35px; border-radius:12px; }
.brand-caption { display:block; margin-top:2px; color:var(--muted); font-size:10px; font-weight:400; letter-spacing:0; }
.rail-label { margin:0 12px 10px; color:#85897d; font-size:10px; font-weight:600; letter-spacing:.05em; }
.service-list,.rail-tools { display:flex; flex-direction:column; gap:4px; }
.rail-tools { margin-top:32px; }
.rail-action { width:100%; min-height:30px; margin:0 0 8px; padding:6px 8px; font-size:11px; }
.service-button { position:relative; display:flex; align-items:center; gap:10px; width:100%; min-height:46px; padding:8px 10px; border:1px solid transparent; border-radius:10px; color:#697061; background:transparent; font-size:12px; font-weight:500; text-align:left; }
.service-button:hover { color:var(--text); background:#e4e4d8; }
.service-button.active { color:#3c4635; background:#fffef9; border-color:#e1dfd3; box-shadow:0 2px 4px #30372f04; font-weight:650; }
.service-button.active::after { content:""; width:5px; height:5px; margin-left:auto; background:var(--green); border-radius:50%; }
.service-glyph,.tool-glyph { display:grid; place-items:center; flex:none; width:29px; height:29px; border-radius:9px; }
.service-glyph svg,.tool-glyph svg { width:20px; height:20px; }
.whatsapp-glyph { color:#35774e; background:#deebde; }
.whatsapp2-glyph { color:#9e5e32; background:#f2e6d3; }
.telegram-glyph { color:#467d9a; background:#dfeaf0; }
.textos-glyph { color:#a26a51; background:#f1e4dd; }
.browser-glyph { color:#6b6598; background:#e8e4f1; }
.tool-glyph { color:#747c68; }
.rail-bottom { margin-top:auto; padding-top:25px; }
.rail-identity { display:flex; align-items:center; gap:10px; padding:14px 10px 10px; border-top:1px solid #dddfd1; }
.identity-avatar { display:grid; place-items:center; flex:none; width:31px; height:31px; border-radius:50%; color:#6e735c; background:#dedfcd; font-size:12px; font-weight:700; }
.rail-identity > div { display:grid; min-width:0; gap:3px; }
.rail-identity strong { overflow:hidden; text-overflow:ellipsis; font-size:12px; font-weight:600; }
.rail-identity div > span { color:#838777; font-size:10px; }
#logout { min-height:37px; font-size:11px; }
.conversation-stage { display:flex; flex-direction:column; min-width:0; min-height:0; padding:0 20px; }
.stage-toolbar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; min-height:91px; gap:12px; padding:20px 0; }
.service-heading { display:flex; align-items:center; gap:12px; }
.active-app-dot { flex:none; width:9px; height:9px; border-radius:50%; }
.whatsapp-dot { background:#5c8d65; }
.whatsapp2-dot { background:#bb8556; }
.telegram-dot { background:#6697ae; }
.textos-dot { background:#b8816b; }
.browser-dot { background:#8b80b1; }
.session-controls { display:flex; align-items:center; justify-content:flex-end; gap:16px; }
.session-state { display:flex; align-items:center; gap:7px; max-width:230px; font-size:11px; color:var(--muted); }
.session-state strong { font-weight:500; }
.live-dot,.footer-dot { width:5px; height:5px; flex:none; border-radius:50%; background:#769570; }
.control-actions { display:flex; flex-wrap:wrap; gap:6px; }
.status-own { color:var(--green); }
.status-view { color:var(--amber); }
.service-message { margin:0 0 10px; padding:12px 15px; color:#805e2e; border:1px solid #e7d2ad; border-radius:10px; background:#fcf2df; font-size:12px; }
.remote-frame-wrap { position:relative; flex:1; min-height:0; overflow:hidden; border:1px solid #d6d9ce; border-radius:13px; background:#111b18; box-shadow:0 4px 16px #30372f07; }
#remote-frame { position:absolute; inset:0; width:100%; height:100%; border:0; }
.stage-footer { display:flex; align-items:center; gap:7px; min-height:42px; color:#8b9084; font-size:10px; }
.footer-note { margin-left:auto; }
.tool-drawer { width:min(390px,34vw); min-width:320px; overflow:auto; border-left:1px solid var(--line); background:#fdfcf8; }
.drawer-header { position:sticky; top:0; z-index:2; display:flex; justify-content:space-between; align-items:center; min-height:91px; padding:20px; border-bottom:1px solid var(--line); background:#fdfcf8; }
.icon-button { display:grid; place-items:center; flex:none; width:31px; height:31px; padding:0; border:1px solid #dedfd3; border-radius:9px; color:#66715d; background:#f7f7f0; font-size:20px; }
.icon-button:hover { background:#eaece0; }
.drawer-view { padding-bottom:20px; }
.drawer-section-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:22px 20px 16px; }
.drawer-section-heading p { margin:7px 0 0; color:var(--muted); font-size:12px; line-height:1.6; }
.library-search { display:grid; gap:8px; margin:0 20px 20px; }
.library-search input,.tag-input { font-size:12px; }
.library-search span { color:var(--muted); font-size:10px; }
.upload-form { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; margin:0 20px 16px; }
.file-picker { display:flex; align-items:center; margin:0; min-width:0; padding:10px 12px; overflow:hidden; border:1px dashed #bec8ad; border-radius:9px; background:#f5f7ef; color:#657654; font-size:12px; cursor:pointer; }
.file-picker input { position:absolute; width:1px; height:1px; opacity:0; }
.file-picker:focus-within { outline:3px solid #ae795c66; }
.tag-input { grid-column:1 / -1; }
.small-message { margin:8px 20px; font-size:12px; overflow-wrap:anywhere; }
.drawer-tip { margin:18px 20px; padding:13px; border:1px solid #e0e3d2; border-radius:10px; background:#f1f4e9; color:#6a765d; font-size:11px; line-height:1.7; }
.image-list,.user-list { display:flex; flex-direction:column; gap:10px; padding:0 20px; }
.image-row { display:grid; grid-template-columns:52px minmax(0,1fr); gap:10px; padding:12px; border:1px solid var(--line); border-radius:11px; background:#fff; }
.image-preview { display:block; width:52px; height:52px; border-radius:8px; overflow:hidden; background:#f1f1e9; }
.image-preview img { width:100%; height:100%; object-fit:cover; }
.library-pagination { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:16px 20px; color:var(--muted); font-size:11px; }
.image-info { display:flex; flex-direction:column; min-width:0; gap:5px; }
.image-info strong,.image-meta,code { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.image-info strong { font-size:12px; }
.image-meta { color:var(--muted); font-size:10px; }
.image-tags { color:#71865d; font-size:10px; }
code { color:#8c7968; font-size:10px; }
.image-actions { grid-column:1 / -1; display:flex; flex-wrap:wrap; gap:5px; }
.image-actions .button { min-height:30px; padding:6px 8px; font-size:10px; }
.empty-state { margin:10px 0; padding:24px 15px; border:1px dashed #dddccf; border-radius:12px; color:var(--muted); font-size:12px; line-height:1.7; text-align:center; }
.stacked-form { display:grid; gap:9px; margin:0 20px 22px; }
.stacked-form input,.stacked-form select { font-size:12px; }
.user-row { display:flex; flex-direction:column; align-items:stretch; gap:12px; padding:14px; border:1px solid var(--line); border-radius:11px; background:#fff; }
.user-row > div:first-child { display:grid; gap:5px; }
.user-row strong { font-size:13px; }
.user-row span,.audit-row { color:var(--muted); font-size:11px; }
.user-actions { display:flex; flex-wrap:wrap; align-items:center; gap:5px; }
.role-select { width:auto; min-height:30px; padding:5px; font-size:11px; }
.audit { margin:24px 20px; }
.audit summary { color:#69745c; font-size:12px; cursor:pointer; }
.audit-list { display:grid; gap:10px; max-height:300px; overflow:auto; padding-top:16px; }
.audit-row { line-height:1.6; overflow-wrap:anywhere; }
.session-heading { padding-top:8px; }
.session-list { display:grid; gap:10px; padding:0 20px; }
.session-row { display:flex; flex-direction:column; align-items:flex-start; gap:12px; padding:14px; border:1px solid var(--line); border-radius:11px; background:#fff; }
.session-row strong,.session-row span { display:block; }
.session-row strong { font-size:12px; }
.session-row span { margin-top:8px; color:var(--muted); font-size:11px; line-height:1.7; overflow-wrap:anywhere; }
.remote-page { height:100dvh; overflow:hidden; background:#111b18; }
#remote-canvas { width:100%; height:100%; }
#remote-canvas canvas { outline:0; }
.remote-overlay { position:fixed; inset:0; display:grid; place-items:center; padding:30px; background:#edf0e6; color:#6e7a60; text-align:center; font-size:13px; }

@media (max-width:1250px) {
  .tool-drawer { position:fixed; z-index:5; top:0; right:0; bottom:0; width:min(390px,92vw); min-width:0; box-shadow:-20px 0 60px #30372f18; }
  .session-controls { gap:10px; }
}
@media (max-height:720px) and (min-width:761px) {
  .service-rail { padding-top:15px; }
  .rail-brand { margin-bottom:20px; }
  .rail-tools { margin-top:18px; }
  .rail-bottom { padding-top:12px; }
}
@media (max-width:760px) {
  .messenger-shell { grid-template-columns:72px minmax(0,1fr); }
  .service-rail { padding:16px 6px 10px; }
  .rail-brand { margin:0 auto 25px; }
  .rail-brand > span:last-child,.rail-label,.rail-identity,.brand-caption { display:none; }
  .service-button { flex-direction:column; gap:5px; padding:9px 1px; font-size:9px; text-align:center; line-height:1.3; }
  .service-button[data-service="landing"] { font-size:11px; }
  .service-button.active::after { display:none; }
  .rail-tools { margin-top:22px; }
  .rail-bottom { padding-top:16px; }
  #logout { font-size:9px; }
  .conversation-stage { padding:0 10px; }
  .stage-toolbar { min-height:114px; padding:17px 0 13px; gap:10px; }
  .service-heading { gap:8px; }
  .service-heading h1 { font-size:20px; }
  .eyebrow { font-size:10px; }
  .session-controls { width:100%; justify-content:space-between; gap:8px; }
  .session-state { max-width:150px; font-size:10px; }
  .control-actions .button { min-height:33px; padding:7px 9px; font-size:10px; }
  .footer-note { display:none; }
  .stage-footer { min-height:33px; font-size:9px; }
  .remote-frame-wrap { border-radius:9px; }
  .login-page { grid-template-columns:1fr; padding:18px; gap:0; }
  .login-intro { min-height:0; padding:25px; border-radius:17px; }
  .login-brand { font-size:20px; }
  .intro-copy { padding:30px 0 5px; }
  .intro-copy h1 { font-size:38px; letter-spacing:-1.5px; }
  .intro-copy h1 br:first-child { display:none; }
  .intro-copy > p:not(.eyebrow),.intro-services,.intro-footer { display:none; }
  .intro-copy .eyebrow { margin-bottom:12px; font-size:11px; }
  .login-card { margin:0; padding:35px 12px 25px; }
  .login-card h2 { font-size:29px; }
}
@media (prefers-reduced-motion:reduce) { * { transition:none!important; } }
