/* =====================================================================
   AL TAMAYUZ GUIDE — a virtual professional host, not a chatbot panel.
   Character first; compact caption; transcript strictly on demand and
   collapsed while the Guide is speaking. Mirrors with the document.
   ===================================================================== */
.gwidget{position:fixed;inset-inline-end:22px;inset-block-end:22px;z-index:95;display:flex;
  flex-direction:column;align-items:flex-end;gap:9px;max-width:352px;}
html[dir="rtl"] .gwidget{align-items:flex-start;}
.gwidget.hidden{display:none;}

.gchar{width:82px;position:relative;cursor:pointer;flex:none;padding:0;
  filter:drop-shadow(0 4px 12px rgba(5,39,51,.22));transition:transform .18s;}
.gchar:hover{transform:scale(1.05);}
.gchar svg{width:100%;height:auto;display:block;}
.gchar .gmute-badge{position:absolute;inset-inline-end:-4px;inset-block-end:10px;width:24px;
  height:24px;border-radius:50%;background:var(--surface);border:1.5px solid var(--border-strong);
  color:var(--ink-3);display:none;align-items:center;justify-content:center;}
.gchar .gmute-badge .ic{width:13px;height:13px;}
.st-muted .gchar .gmute-badge{display:flex;}
.gname-tag{background:var(--heading);color:var(--surface);font-size:10px;font-weight:600;
  letter-spacing:.07em;text-transform:uppercase;padding:3px 10px;border-radius:999px;
  align-self:flex-end;margin-inline-end:6px;}
html[dir="rtl"] .gname-tag{align-self:flex-start;margin-inline:6px 0;}
html[data-theme="dark"] .gname-tag{background:var(--onbrand-accent);color:#052733;}

/*  The face states are gone.

    Everything that used to live here animated a cartoon face inside a circle:
    blinking eye rectangles, a mouth that switched between a smile and a
    waveform, pulsing and spinning state rings, and an idle "breathing"
    translate on the button itself. That mark was rejected twice, and the
    animation was half of why — a thing that blinks at you and bobs while it
    waits is a mascot, whatever it is drawn as. The old class names are
    deliberately not repeated here, because the test that keeps them out
    greps this file for them.

    The replacement lives in `advisor.css`, where the state is carried by a
    slim rule beneath the portrait plate and by the rim, and NOTHING on the
    figure ever moves. `.gchar` keeps only its size, its shadow and its hover,
    because it is still the button the client clicks.  */
.gchar.advframe{width:82px;height:auto;aspect-ratio:5 / 6;}
.st-muted .gchar{filter:none;}

.gcaption{background:var(--surface);border:1px solid var(--border);
  border-start-start-radius:16px;border-start-end-radius:16px;border-end-end-radius:4px;
  border-end-start-radius:16px;box-shadow:var(--sh-raised);padding:12px 15px;font-size:14.5px;
  line-height:1.5;color:var(--ink);max-width:330px;max-height:190px;overflow-y:auto;display:none;}
html[lang="ar"] .gcaption{font-size:15.5px;}
.gwidget.talking .gcaption,.gwidget.expanded .gcaption{display:block;animation:fadein .2s ease-out;}
.gcaption .g-acts{margin-block-start:9px;display:flex;gap:8px;flex-wrap:wrap;}
.gcaption .gq{color:var(--ink-3);font-size:13px;margin-block-end:5px;font-weight:600;}

.gdock{display:none;gap:1px;background:var(--surface);border:1px solid var(--border);
  border-radius:999px;padding:3px;box-shadow:var(--sh-card);}
.gwidget.talking .gdock,.gwidget.expanded .gdock{display:inline-flex;}
.gdock button{width:31px;height:31px;border-radius:50%;color:var(--ink-3);display:flex;
  align-items:center;justify-content:center;}
.gdock button:hover{background:var(--accent-tint);color:var(--action);}
.gdock button[aria-pressed="true"]{color:var(--action);background:var(--accent-tint);}
.gdock .ic{width:15px;height:15px;}

.gask{display:none;gap:7px;width:100%;max-width:330px;}
.gwidget.expanded .gask{display:flex;}
.gask input{flex:1;min-width:0;border:1px solid var(--border-strong);border-radius:999px;
  padding:9px 15px;font:inherit;font-size:13.5px;color:var(--ink);background:var(--surface);}
.gask button{width:38px;height:38px;border-radius:50%;display:flex;align-items:center;
  justify-content:center;color:var(--ink-2);background:var(--surface);
  border:1px solid var(--border-strong);flex:none;}
.gask button:hover{color:var(--action);border-color:var(--action);}
.gask .gsend{background:var(--action);border-color:var(--action);color:var(--btn-primary-text);}
.gask .gmic.listening{background:var(--err-tint);color:var(--err);border-color:var(--err);}
.gchips{display:none;gap:6px;flex-wrap:wrap;justify-content:flex-end;max-width:330px;}
html[dir="rtl"] .gchips{justify-content:flex-start;}
.gwidget.expanded .gchips{display:flex;}
.gchip{border:1px solid var(--border-strong);color:var(--ink-2);border-radius:999px;
  padding:5px 12px;font-size:12.5px;font-weight:500;background:var(--surface);}
.gchip:hover{border-color:var(--action);color:var(--action);}

/* Transcript: secondary, and auto-collapsed whenever the Guide speaks. */
.gsheet{position:fixed;inset-inline-end:22px;inset-block-end:124px;z-index:94;width:336px;
  max-width:calc(100vw - 40px);max-height:300px;overflow-y:auto;background:var(--surface);
  border:1px solid var(--border);border-radius:14px;box-shadow:var(--sh-raised);
  padding:12px 14px;display:none;}
.gsheet.open{display:block;animation:fadein .2s ease-out;}
.gsheet .t-head{font-size:11.5px;letter-spacing:.07em;text-transform:uppercase;color:var(--ink-3);
  font-weight:600;margin-block-end:8px;}
.gsheet .t-line{font-size:13.5px;padding:7px 0;border-block-start:1px solid var(--border);
  color:var(--ink-2);}
.gsheet .t-line b{color:var(--heading);}

.gmodal{position:fixed;inset:0;background:rgba(5,39,51,.55);z-index:120;display:none;
  align-items:center;justify-content:center;padding:20px;}
.gmodal.open{display:flex;}
.gmodal .gm-card{background:var(--surface);border-radius:18px;max-width:440px;width:100%;
  padding:28px;box-shadow:var(--sh-raised);text-align:center;}
.gmodal .gm-orb{width:84px;height:84px;margin-inline:auto;margin-block-end:14px;}
.gmodal h2{font-size:20px;color:var(--heading);}
.gmodal p{font-size:14.5px;color:var(--ink-2);margin-block-start:8px;}
.gmodal .gm-opts{display:flex;gap:10px;margin-block-start:20px;flex-wrap:wrap;justify-content:center;}

@media (max-width:900px){
  .gwidget{inset-inline-end:14px;inset-block-end:86px;max-width:calc(100vw - 28px);}
  .gchar{width:66px;height:auto;}
  .gcaption{max-width:calc(100vw - 110px);max-height:160px;}
  .gsheet{inset-inline:14px;width:auto;inset-block-end:170px;}
}

/* =====================================================================
   GUIDE 4.1 — refinement (CLIENT-PORTAL-UX-REFINEMENT-01)

   Three things the audit required and one it did not ask for:
     * the expanded Guide must stop covering the page it is guiding, in RTL
       as well as LTR (F-27);
     * hiding it must leave a labelled way back (F-28/F-29 — the pill lives in
       ledger4.css because it exists outside the widget);
     * voice unavailability must be visible, never silent (F-09);
     * and a thinking state, because a Guide that is fetching an answer should
       look like it is, not like it is idle.
   ===================================================================== */

/* ---- the expanded Guide reserves its own space instead of overlapping ----
   The widget is anchored to the inline-end edge, which is the LEFT edge in
   Arabic — exactly where content sits. Reserving the gutter on the same
   logical side works in both directions with one rule, rather than an
   RTL-specific override. */
@media (min-width:901px){
  body.guide-open .content{padding-inline-end:372px;transition:padding-inline-end .2s ease;}
  body.guide-open .pub-foot,body.guide-open .e-foot{padding-inline-end:372px;}
}
@media (max-width:900px){
  /* On narrow screens the expanded Guide is a bottom sheet; the page keeps
     enough room beneath it that the primary action is never underneath. */
  body.guide-open .content{padding-block-end:calc(130px + 42vh);}
}

.gwidget.expanded{z-index:97;}
.gcaption{max-height:min(46vh,260px);}

/* ---- states ---- */
.st-thinking .gchar{animation:none;}
.st-listening .gchar{animation:none;}

/* ---- honest voice + capability lines ---- */
.gnotice{margin-block-start:9px;padding:8px 11px;border-radius:10px;
  background:var(--warn-tint);border:1px solid var(--warn-border);color:var(--warn);
  font-size:12.5px;line-height:1.5;}
html[lang="ar"] .gnotice{font-size:13.5px;}
.gcapability{margin-block-start:9px;padding-block-start:8px;
  border-block-start:1px dashed var(--border-strong);color:var(--ink-3);font-size:12px;
  line-height:1.5;}
html[lang="ar"] .gcapability{font-size:13px;}
.gcaption .gsystem{color:var(--ink-2);font-style:normal;}

/* ---- the elapsed counter while the microphone is open ----
   The widget creates this span and, until now, no stylesheet mentioned it: the
   clock inherited the caption's proportional figures, so 1:09 -> 1:10 shifted
   the digits sideways every second beside a live recording indicator. Tabular
   figures hold the column still. It is deliberately quiet — it is a reassurance
   that we are still listening, not a countdown — so it borrows the same muted
   ink and the same small size the other secondary lines already use. No new
   colour is introduced. */
.gcaption .gclock{font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1;
  color:var(--ink-3);font-size:12.5px;font-weight:600;letter-spacing:.02em;
  margin-inline-start:6px;}

/* ---- microphone states: every one of them visible ---- */
.gask .gmic{transition:background .15s,color .15s,border-color .15s;}
.gask .gmic.listening{background:var(--err);color:#fff;border-color:var(--err);
  animation:gmicpulse 1.2s ease-in-out infinite;}
.gask .gmic.denied{background:var(--warn-tint);color:var(--warn);border-color:var(--warn-border);}
@keyframes gmicpulse{0%,100%{box-shadow:0 0 0 0 rgba(179,55,46,.45);}
  50%{box-shadow:0 0 0 7px rgba(179,55,46,0);}}

/* ---- the name tag is a name, not a disclaimer ---- */
.gname-tag{text-transform:none;letter-spacing:.02em;font-size:11px;padding:4px 12px;}

/* ---- chips wrap rather than overflow in either direction ---- */
.gchips{max-width:330px;}
.gchip{max-width:100%;text-align:start;}

/* ---- transcript sits clear of the dock in both directions ---- */
html[dir="rtl"] .gsheet{inset-inline-end:auto;inset-inline-start:22px;}

@media (max-width:900px){
  .gwidget{inset-block-end:78px;}
  .gsheet{inset-block-end:190px;}
  .gcaption{max-height:38vh;}
}
@media (prefers-reduced-motion:reduce){
  .gask .gmic.listening{animation:none;box-shadow:0 0 0 3px var(--err-tint);}
}
