/* ==========================================================================
   loco-ui — CLIENT PORTAL LAYER
   Loads AFTER loco-ui.css, which IS this portal's shared design system.

   WHY THIS FILE EXISTS (14 Aug 2026). Until now the portal carried its own
   inline <style> copy of the whole system while loco-ui.css carried another,
   and the two had already drifted: the portal had 47 selectors loco-ui lacked
   (the email log and the rich-reply editor, both added 13 Aug). Spinning up a
   SECOND client portal would have made that a three-way drift, which is why
   the skill says to migrate before the second instance, not after.

   The split was provably safe: of 347 shared selectors, 347 had byte-identical
   bodies. Only two rules differed, and both were the deliberate edits recorded
   in the skill — `.app` (auth gating, restored below) and `:root` (loco-ui adds
   `--muted`, naming the #9aa6ae the portal hardcodes).

   RULE: a SHARED component changes in loco-ui.css and every surface gets it.
   Anything only a client portal has — auth gating, the ticket editor, the
   email log — belongs here.
   ========================================================================== */

/* ---------- auth gating -----------------------------------------------------
   loco-ui.css ships `.app{display:flex}` because the HQ, chat and hub have no
   login wall. The portal does: the app stays hidden until `body.authed`, or the
   client's workspace would flash on screen before the session is checked.    */
.app{display:none}
body.authed .app{display:flex}
body.authed .login{display:none}

body.authed .app{display:flex}
body.authed .login{display:none}
.md-bar{display:flex;align-items:center;gap:4px;flex-wrap:wrap;margin-bottom:6px}
.md-tool{font-family:var(--font-b);font-size:12px;font-weight:600;color:var(--slate);
    background:#fff;border:1px solid var(--line);border-radius:8px;padding:5px 9px;cursor:pointer;
    line-height:1;transition:.12s}
.md-tool:hover{border-color:var(--copper4);color:var(--copper6)}
.md-tool.active{background:var(--copper1);border-color:transparent;color:var(--copper6)}
.md-tool b,.md-tool i{font-size:12.5px}
.md-sep{width:1px;height:18px;background:var(--line);margin:0 3px}
.md-right{margin-left:auto}
.cmt-form textarea.drop{border-color:var(--copper4);box-shadow:0 0 0 3px var(--copper1);
    background:var(--copper1)}
.md-preview{display:none;margin-top:8px;padding:12px 14px;border:1px dashed var(--line);
    border-radius:10px;background:var(--paper)}
.md-preview.on{display:block}
.md-hint{font-family:var(--font-m);font-size:10px;letter-spacing:.04em;color:#9aa6ae;margin-top:6px}
.md-body img.md-img{display:block;max-width:100%;height:auto;margin:10px 0;border-radius:10px;
    border:1px solid var(--line)}
.cmt-b .bx.md-body{font-size:13.5px}
.cmt-b .bx.md-body p{margin:0 0 8px}
.cmt-b .bx.md-body .md-ul,.cmt-b .bx.md-body .md-ol{margin:4px 0 8px}
.admin-only{display:none}
body[data-role="admin"] .admin-only{display:flex}
.badge.sent{color:var(--green);background:var(--green-bg)}
.badge.failed{color:var(--red);background:var(--red-bg)}
.ml-chart{display:flex;align-items:flex-end;gap:3px;height:92px;margin-top:4px}
.ml-day{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:flex-end;gap:2px;height:100%;border-radius:4px;padding-bottom:1px}
.ml-day:hover{background:var(--line2)}
.ml-seg{border-radius:3px;min-height:3px}
.ml-seg.s{background:var(--copper4)}
.ml-seg.f{background:var(--red)}
.ml-zero{height:3px;background:var(--line);border-radius:3px}
.ml-axis{display:flex;justify-content:space-between;font-family:var(--font-m);font-size:10px;color:#9aa6ae;margin-top:9px}
.ml-key{display:flex;gap:16px;align-items:center;font-size:12px;color:var(--slate)}
.ml-key i{width:9px;height:9px;border-radius:3px;display:inline-block;margin-right:6px;vertical-align:-1px}
.ml-tools{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:16px}
.ml-search{flex:1;min-width:180px;max-width:320px;border:1px solid var(--line);background:#fff;border-radius:9px;padding:9px 13px;font-size:13.5px;font-family:var(--font-b);color:var(--ink)}
.ml-search:focus{outline:none;border-color:var(--copper4)}
.ml-tr{cursor:pointer}
.ml-tr:hover{background:var(--paper)}
.ml-tr.on{background:var(--paper)}
.ml-to{font-weight:600}
.ml-to small{display:block;color:var(--slate);font-weight:400;font-size:12px}
.ml-when{font-family:var(--font-m);font-size:12px;color:var(--slate);white-space:nowrap}
.ml-det>td{background:var(--paper);padding:0 14px 20px}
.ml-err{background:var(--red-bg);color:var(--red);border-radius:var(--r-sm);padding:12px 14px;font-family:var(--font-m);font-size:11.5px;line-height:1.55;white-space:pre-wrap;word-break:break-word}
.ml-meta{display:flex;flex-wrap:wrap;gap:8px 22px;font-size:12.5px;color:var(--slate);margin:14px 0 12px}
.ml-meta b{color:var(--ink);font-weight:600}
.ml-prev{width:100%;height:440px;border:1px solid var(--line);border-radius:var(--r-sm);background:#fff;display:block}
.ml-nobody{background:var(--blue-bg);color:var(--blue);border-radius:var(--r-sm);padding:12px 14px;font-size:13px;line-height:1.55}
@media(max-width:700px){.ml-hide-s{display:none}.ml-prev{height:320px}}

/* ---------- overview callout ----------------------------------------------
   The single thing waiting on the client, shown above the project cards.
   Copper rather than amber: this is a prompt, not a warning, and amber is
   already spoken for by overdue billing. Renders nothing when CLIENT.callout
   is absent, which is the default. */
.callout{display:flex;gap:16px;align-items:flex-start;background:var(--copper1);
  border:1px solid var(--copper4);border-radius:var(--r);padding:20px 22px;margin-bottom:24px}
.callout .co-ic{flex:none;width:34px;height:34px;border-radius:9px;display:grid;place-items:center;
  background:var(--white);border:1px solid var(--copper4);color:var(--copper)}
.callout .co-ic svg{width:17px;height:17px}
.callout .co-b{min-width:0}
.callout .co-k{font-family:var(--font-m);font-size:10px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--copper6);margin:0 0 5px}
.callout h3{font-family:var(--font-d);font-size:16px;font-weight:600;margin:0 0 6px;color:var(--ink)}
.callout .co-b>p:last-of-type{font-size:13.5px;line-height:1.6;color:var(--slate);margin:0}
.callout .co-a{margin-top:14px}
@media(max-width:640px){.callout{padding:16px 16px;gap:12px}}

/* A short plain-English line under a project's title. Carries the status of work
   that has no stepper to describe it (proposed, paused, awaiting a decision). */
.proj-note{font-size:13.5px;line-height:1.6;color:var(--slate);margin:14px 0 0}

/* Caption on the admin-only "Our time" field. Amber-tinted so it reads as an
   internal marker, and it says in words that the client never sees the figure. */
.internal-note{font-size:11.5px;color:var(--amber);font-style:italic}

/* "View as client" preview pill — unmistakable while an admin is seeing the client view.
   Floats bottom-centre so nothing shifts; ink ground so it can't be mistaken for client UI. */
.viewasbar{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);z-index:80;
  display:flex;align-items:center;gap:10px;background:var(--ink);color:#fff;
  border-radius:24px;padding:9px 12px 9px 16px;box-shadow:var(--sh-lg,0 12px 32px rgba(10,20,30,.28));
  font-size:13px;white-space:nowrap;max-width:calc(100vw - 32px)}
.viewasbar svg{width:16px;height:16px;flex:none;opacity:.8}
.viewasbar span{overflow:hidden;text-overflow:ellipsis}
.viewasbar button{border:0;cursor:pointer;background:var(--copper);color:#fff;font:inherit;
  font-size:12.5px;font-weight:600;border-radius:16px;padding:6px 13px;flex:none}
.viewasbar button:hover{filter:brightness(1.08)}

/* Admin-only strip on the Feedback page: shows the Loco-controlled current review
   round and the button that advances it. New feedback joins the current round
   rather than each submission spinning up its own. */
.round-strip{display:flex;align-items:center;gap:16px;flex-wrap:wrap;
  background:var(--copper1);border:1px solid var(--copper4);border-radius:var(--r);
  padding:12px 18px;margin-bottom:20px}
.round-strip .rs-txt{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;min-width:0}
.round-strip .rk{font-family:var(--font-m);font-size:10px;letter-spacing:.1em;
  text-transform:uppercase;color:var(--copper6)}
.round-strip b{font-family:var(--font-d);font-size:15px;font-weight:600;color:var(--ink)}
.round-strip .rk-note{font-size:12.5px;color:var(--slate)}
.round-strip>button{margin-left:auto;flex:none}

/* Status filter chips on the Support & Feedback lists (Open / Resolved / All / Archived).
   Default view is live work; finished tickets stay in the system (and visible to the client)
   one click away. Active chip is solid ink; the count sits in a small inset pill. */
.tfilter{display:inline-flex;gap:6px;flex-wrap:wrap}
.tfilter button{display:inline-flex;align-items:center;gap:7px;font-family:var(--font-b);
  font-size:13px;font-weight:500;color:var(--slate);background:#fff;border:1px solid var(--line);
  border-radius:20px;padding:6px 13px;cursor:pointer;transition:.12s;line-height:1}
.tfilter button:hover{border-color:var(--copper4);color:var(--copper6)}
.tfilter button.on{background:var(--ink);border-color:var(--ink);color:#fff}
.tfilter button.arch.on{background:var(--slate);border-color:var(--slate)}
.tfilter button i{font-style:normal;font-family:var(--font-m);font-size:10.5px;font-weight:600;
  background:var(--paper);color:var(--slate);border-radius:10px;padding:1px 6px;min-width:15px;text-align:center}
.tfilter button.on i{background:rgba(255,255,255,.22);color:#fff}
