/* owner: admin-v2 B2 · contract: server/ADMIN-V2.md sec. 2.1 (layout per width), 2.7 (the Maya widget), 4.5 (shell.css
   classes), 5.1 (login), 6.4 and 6.5 (responsive, motion, transparency)
   The shell's own layer, ported from the approved sketch (maya-sketches/c-bold, teal): the compact glass nav card (a rail from
   761 to 1179, a glass tab bar at 760 and down), Maya's glass island with its panel, the bubble next to it, the avatar and the
   login. Every rule sits under a widget root: .side, .tabbar, #maya, .mbub, .login (and .avatar). The Maya widget is addressed
   as #maya because .maya is also the chat and transcript bubble variant (.bub.maya). */

/* ---------- the avatar (nav brand row, and each band's phone header) ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background-color: var(--solid); color: var(--onSolid); font-weight: 500; font-size: 17px; line-height: 1; text-decoration: none;
}
.band .avatar { width: 36px; height: 36px; background-color: var(--onBand); color: var(--band); }

/* ---------- the nav card (1180 and up): brand row and six links (5.10: + CRM; 6.10: + WhatsApp) ---------- */
.side {
  position: fixed; z-index: var(--z-nav); top: 16px; inset-inline-start: 16px; width: var(--sideW);
  border-radius: 30px; padding: 16px 12px 12px; display: flex; flex-direction: column; gap: 14px;
}
.sbrand { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-inline: 10px 2px; }
.sbrand .logo { font-size: 28px; line-height: 1; font-weight: 500; letter-spacing: -.03em; }
.snav { display: grid; gap: 4px; }
.snav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 14px; border-radius: var(--r);
  text-decoration: none; font-size: 16px; font-weight: 500; color: var(--ink); transition: background-color .15s;
}
.snav a:hover { background-color: rgba(255, 255, 255, .5); }
.snav a[aria-current="page"] { background-color: var(--solid); color: var(--onSolid); }
.snav .n {
  margin-inline-start: auto; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 11px; display: grid; place-items: center;
  font-size: 12px; font-variant-numeric: tabular-nums; background-color: rgba(0, 0, 0, .08);
}
.snav a[aria-current="page"] .n { background-color: rgba(255, 255, 255, .2); }
/* 6.10: what customers wrote on WhatsApp since he last looked: the spark pill (it moved here from the CRM's tray) */
:is(.snav, .tabbar) a[data-id="whatsapp"] .n { background-color: var(--spark); color: var(--onSpark); }
.tabbar { display: none; }

/* ---------- Maya's island: the handle (orb, name and status, the wave) ---------- */
#maya {
  position: fixed; z-index: var(--z-maya); bottom: 16px; inset-inline-start: 16px; width: var(--sideW); height: 72px;
  border-radius: 30px; overflow: hidden;
  transition: width .45s var(--spring), height .45s var(--spring), border-radius .45s;
}
#maya .mhandle {
  position: relative; width: 100%; height: 100%; display: flex; align-items: center; gap: 12px; padding: 0 14px 0 12px;
  border: 0; border-radius: inherit; background-color: transparent; color: var(--ink); font: inherit; text-align: start; cursor: pointer;
}
#maya .mhandle:focus-visible { outline-offset: -4px; }
#maya .mt { display: grid; min-width: 0; flex: 1; }
#maya .mt b { font-size: 16px; font-weight: 500; line-height: 1.25; }
#maya .mstat { display: flex; min-width: 0; font-size: 13px; line-height: 1.35; }
#maya .mstat > span:first-child, #maya .mlive .r1 > span:first-of-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#maya .mstat > span + span, #maya .mlive .r1 > span + span { flex: none; white-space: pre; }
#maya .mbadge {
  position: absolute; top: 12px; inset-inline-start: 48px; width: 12px; height: 12px; border-radius: 50%;
  background-color: var(--bad); box-shadow: 0 0 0 2px var(--card);
}
#maya .wave { display: flex; align-items: center; gap: 3px; height: 22px; flex: none; opacity: .3; }
#maya .wave i { width: 3px; height: 30%; border-radius: 3px; background-color: var(--ink); }
#maya[data-live="true"] .wave { opacity: 1; }
#maya[data-live="true"] .wave i { animation: maya-wave 1s ease-in-out infinite; }
#maya .wave i:nth-child(2) { animation-delay: -.35s; }
#maya .wave i:nth-child(3) { animation-delay: -.7s; }
#maya .wave i:nth-child(4) { animation-delay: -.15s; }
#maya .wave i:nth-child(5) { animation-delay: -.5s; }
@keyframes maya-wave { 0%, 100% { height: 22%; } 50% { height: 100%; } }

/* ---------- the panel: header, live strip, chat log, hint, composer ---------- */
#maya[data-open="true"] {
  width: min(390px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 350px)); height: min(600px, calc(100dvh - 350px));
  background-color: var(--ground); background-color: color-mix(in srgb, var(--ground) 88%, transparent);
}
#maya[data-open="true"] .mhandle { display: none; }
#maya .mpanel { display: flex; flex-direction: column; height: 100%; animation: maya-in .3s .15s both; }
@keyframes maya-in { from { opacity: 0; transform: translateY(6px); } }
#maya .mph { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; }

#maya .mlive {
  margin: 0 16px; padding: 14px; border-radius: var(--r); display: grid; gap: 6px;
  background-color: var(--deep); color: #fff;
}
#maya .mlive p { font-size: 14px; color: var(--onDeep); overflow-wrap: anywhere; }
#maya .mlive .r1 { display: flex; align-items: center; min-width: 0; font-weight: 500; color: #fff; }
#maya .mlive .r1 .dot { margin-inline-end: 8px; }
#maya .mlive p a { color: #fff; font-weight: 500; }
#maya .mlive .acts { margin-top: 8px; gap: 8px; }

#maya .mchat {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px;
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 8px; scrollbar-width: thin;
}
#maya .mchat:focus-visible { outline-offset: -3px; }
#maya .mload .skel-row { margin-inline: 0; }
#maya .mempty { display: grid; justify-items: center; gap: 4px; padding: 20px 4px 8px; text-align: center; }
#maya .mempty b { font-size: 22px; font-weight: 500; line-height: 1.2; }
#maya .mempty p { font-size: 14px; color: var(--muted); }
#maya .mchips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
#maya .mchips button {
  min-height: 36px; padding: 7px 12px; border: 0; border-radius: var(--r); font: inherit; font-size: 13px; font-weight: 500;
  color: var(--ink); text-align: start; cursor: pointer;
  background-color: rgba(255, 255, 255, .75); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
#maya .mchips button:hover { background-color: var(--card); }

/* the lines: his (white, end side), hers (ink, start side), short status lines, her question */
#maya .mlines { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
#maya .mlines li { scroll-margin-block: 24px; }
#maya .bub { font-size: 14px; padding: 10px 14px; line-height: 1.45; overflow-wrap: anywhere; }
#maya .bub p { white-space: pre-line; }
#maya .bub.maya { --ring: #fff; justify-self: start; background-color: var(--deep); color: #fff; }
#maya .bub.me { justify-self: end; background-color: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
#maya .bub.sending { opacity: .7; }
#maya .bub a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-size: 13px; font-weight: 500; color: inherit; }
#maya .mlines time { display: block; margin-top: 2px; font-size: 11px; opacity: .7; text-align: end; font-variant-numeric: tabular-nums; }
#maya .mlines li[data-role="status"] {
  justify-self: center; max-width: 94%; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  gap: 2px 8px; padding: 2px 10px; font-size: 13px; color: var(--muted); text-align: center;
}
#maya .mlines li[data-role="status"] time { display: inline; margin: 0; }
#maya .mlines li[data-target="true"] { outline: 2px solid var(--cta); outline-offset: 2px; border-radius: var(--r); }

#maya .mq { display: grid; gap: 6px; padding: 12px 14px 8px; border-radius: 20px; background-color: var(--card); box-shadow: inset 0 0 0 2px var(--cta); }
#maya li[data-open="false"] .mq { box-shadow: inset 0 0 0 1px var(--line); }
#maya .mq-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 500; color: var(--muted); }
#maya .mq-top > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
#maya .mq-left { color: var(--ink); white-space: nowrap; }
#maya .mq-q { font-size: 16px; font-weight: 500; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
#maya .mq .acts { margin-top: 2px; align-items: center; gap: 8px; }
#maya .mq .acts > span { font-size: 13px; color: var(--muted); }
#maya .mq-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; overflow-wrap: anywhere; }

#maya .typing { justify-self: start; display: flex; gap: 4px; padding: 13px 14px; border-radius: var(--r); background-color: var(--deep); }
#maya .typing i { width: 6px; height: 6px; border-radius: 50%; background-color: #fff; animation: maya-typing 1s ease-in-out infinite; }
#maya .typing i:nth-of-type(2) { animation-delay: .15s; }
#maya .typing i:nth-of-type(3) { animation-delay: .3s; }
@keyframes maya-typing { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

#maya .mhint { margin: 0 16px 6px; font-size: 13px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
#maya .mhint:empty { display: none; }
#maya .mhint[data-tone="danger"] { color: var(--bad); }
#maya .mdock {
  display: flex; align-items: flex-end; gap: 6px; margin: 0 12px 12px; padding: 5px; border-radius: var(--r);
  background-color: var(--card); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
#maya .mdock:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
#maya .mdock textarea {
  flex: 1; min-width: 0; min-height: 40px; max-height: 120px; padding: 9px 10px; border: 0; outline: 0; resize: none;
  background-color: transparent; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.4;
}
#maya .send {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%;
  background-color: var(--ink); color: #fff; cursor: pointer;
}
#maya .send:disabled { opacity: .45; cursor: default; }

/* ---------- the bubble: what just happened, next to the island ---------- */
.mbub {
  position: fixed; z-index: var(--z-bubble); inset-inline-start: 16px; bottom: 100px; width: min(300px, calc(100vw - 32px));
  padding: 14px 16px; border-radius: var(--r); color: var(--ink); cursor: pointer;
  background-color: var(--glassSolid); background-color: color-mix(in srgb, var(--ground) 72%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .7); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 18px 40px rgba(0, 0, 0, .14);
  opacity: 0; transform: translateY(10px) scale(.96); pointer-events: none; visibility: hidden;
  transition: opacity .25s, transform .4s cubic-bezier(.2, .9, .25, 1.25), visibility 0s .4s;
}
.mbub.on { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity .25s, transform .4s cubic-bezier(.2, .9, .25, 1.25), visibility 0s; }
#maya[data-open="true"] ~ .mbub { display: none; }
.mbub .mbub-text { font-size: 14px; line-height: 1.45; padding-inline-end: 34px; overflow-wrap: anywhere; }
.mbub[data-kind="line"] .mbub-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.mbub .xb { position: absolute; top: 6px; inset-inline-end: 6px; }
.mbub .acts { margin-top: 10px; gap: 8px; }
.mbub .acts:empty { display: none; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .mbub { background-color: var(--glassSolid); } }

/* ---------- login: the teal band with her orb, and a white card ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center;
  background-color: var(--band); color: var(--onBand);
}
.login-art { display: flex; flex-direction: column; justify-content: space-between; gap: 40px; min-height: 100vh; min-height: 100dvh; padding: 44px 48px; }
.login-art .logo { font-size: 28px; line-height: 1; font-weight: 500; letter-spacing: -.03em; }
.login-art .logo + p { margin-top: 8px; font-size: 15px; color: var(--onBandMuted); }
.login-art .orb { align-self: center; }
.login-art .quote { max-width: 18ch; font-size: 40px; line-height: 1.05; letter-spacing: -.02em; font-weight: 500; color: var(--onBand); }
.login-art small { display: block; margin-top: 14px; font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--onBandMuted); }
.login-card { justify-self: center; width: min(440px, calc(100% - 64px)); margin: 32px; color: var(--ink); }
.login-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.login-form h1 { font-size: 40px; line-height: 1; letter-spacing: -.02em; font-weight: 500; }
.login-form h1 + p { margin-top: -6px; color: var(--muted); }
.login-form .btn { width: 100%; justify-content: center; }
.login-form .login-google { display: grid; gap: 10px; }
.login-form .login-google p { font-size: 14px; color: var(--muted); }
.login-form details { font-size: 14px; line-height: 1.6; color: var(--muted); }
.login-form summary { display: flex; align-items: center; min-height: 44px; font-weight: 500; color: var(--ink); cursor: pointer; }
.login-form code {
  display: block; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background-color: var(--ground); color: var(--ink);
  font-size: 13px; text-align: left; overflow-wrap: anywhere;
}

/* ---------- 1100 and down: the login stacks a little earlier than the app ---------- */
@media (max-width: 1100px) {
  .login-art .quote { font-size: 32px; }
}

/* ---------- 761 to 1179: the nav becomes a glass rail, Maya an orb-only island ---------- */
@media (min-width: 761px) and (max-width: 1179px) {
  .side { padding: 16px 10px 12px; align-items: center; }
  .sbrand { padding: 0; justify-content: center; }
  .sbrand .logo { font-size: 0; }
  .sbrand .logo::after { content: "מ"; font-size: 30px; }
  .side .avatar { display: none; }
  .snav .l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .snav a { width: 54px; height: 54px; padding: 0; justify-content: center; }
  .snav .n {
    position: absolute; top: 2px; inset-inline-end: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    font-size: 11px; background-color: var(--solid); color: var(--onSolid);
  }
  .snav a[aria-current="page"] .n { background-color: #fff; color: var(--ink); }
  #maya:not([data-open="true"]) { height: 76px; border-radius: 38px; }
  #maya:not([data-open="true"]) .mt, #maya:not([data-open="true"]) .wave { display: none; }
  #maya:not([data-open="true"]) .mhandle { justify-content: center; padding: 0; }
  #maya .mbadge { top: 14px; inset-inline-start: 50px; }
  #maya[data-open="true"] { width: 380px; }
  .mbub { bottom: 104px; }
}

/* ---------- 760 and down: the glass tab bar, a detached orb, the panel as a sheet ---------- */
@media (max-width: 760px) {
  .side { display: none; }
  .tabbar {
    display: grid; position: fixed; z-index: var(--z-nav); inset-inline: 12px 90px; bottom: calc(12px + env(safe-area-inset-bottom));
    height: 68px; border-radius: 34px; padding: 6px; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; /* 5.10: + CRM; 6.10: + WhatsApp */
  }
  .tabbar a {
    position: relative; min-width: 0; display: grid; justify-items: center; align-content: center; gap: 1px; border-radius: 28px;
    text-decoration: none; font-size: 11px; font-weight: 500; color: var(--ink);
  }
  .tabbar a[aria-current="page"] { background-color: var(--solid); color: var(--onSolid); }
  .tabbar .l { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .n {
    position: absolute; top: 3px; inset-inline-end: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    display: grid; place-items: center; font-size: 11px; font-variant-numeric: tabular-nums; background-color: var(--solid); color: var(--onSolid);
  }
  .tabbar a[aria-current="page"] .n { background-color: #fff; color: var(--ink); }
  /* 6.10: six tabs need about 46 px each for their words ("וואטסאפ"); narrower, the words are read but not shown (the icons
     stay, each tab's name stays its accessible name) */
  @media (max-width: 400px) {
    .tabbar .l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
    .tabbar a .icon { width: 26px; height: 26px; }
  }
  #maya {
    inset-inline-start: auto; inset-inline-end: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
    width: 68px; height: 68px; border-radius: 34px;
  }
  #maya:not([data-open="true"]) .mt, #maya:not([data-open="true"]) .wave { display: none; }
  #maya:not([data-open="true"]) .mhandle { justify-content: center; padding: 0; }
  #maya:not([data-open="true"]) .mhandle .orb { --o: 58px; }
  #maya .mbadge { top: 5px; inset-inline-start: 50px; }
  #maya[data-open="true"] {
    inset-inline-end: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: calc(100vw - 16px);
    height: min(84vh, 660px); height: min(84dvh, 660px);
  }
  .mbub { inset-inline-start: auto; inset-inline-end: 12px; bottom: calc(94px + env(safe-area-inset-bottom)); }

  .login { grid-template-columns: minmax(0, 1fr); align-items: start; align-content: start; }
  .login-art { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px 18px; padding: 24px 16px 20px; }
  .login-art > div { flex: 1; min-width: 0; }
  .login-art .orb { order: -1; align-self: center; --o: 64px; }
  .login-art .quote { flex-basis: 100%; max-width: none; font-size: 24px; }
  .login-art small { margin-top: 8px; }
  .login-card { width: auto; margin: 0 16px 24px; }
  .login-form h1 { font-size: 32px; }
}

/* ---------- transparency (base.css turns every animation and transition off for reduced motion) ---------- */
@media (prefers-reduced-transparency: reduce) {
  #maya[data-open="true"], .mbub { background-color: var(--glassSolid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
