/* TV 21 Chat – home / chat app styles */
    :root {
      --bg: #f8fafc;
      --side: #ffffff;
      --side2: #f1f5f9;
      --txt: #0f172a;
      --sub: #64748b;
      --line: #e2e8f0;
      --acc: #E31E24;
      --accDark: #b91c1c;
      --accSoft: rgba(227, 30, 36, 0.12);
      --accTxt: #ffffff;
      --chatBg: #f1f3f6;
      --chatPat: radial-gradient(rgba(227, 30, 36, 0.06) 1px, transparent 1px);
      --me: #ffe8e9;
      --meTxt: #1e1b1b;
      --them: #ffffff;
      --hover: #f1f5f9;
      --sel: #E31E24;
      --tick: #E31E24;
      --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
      --shadowLg: 0 12px 36px rgba(15, 23, 42, 0.18);
      box-sizing: border-box;
    }

    @media (prefers-color-scheme: dark) {
      :root:not([data-theme="light"]) {
        --bg: #0b0f14;
        --side: #121820;
        --side2: #1a222d;
        --txt: #f1f5f9;
        --sub: #94a3b8;
        --line: #1e293b;
        --accSoft: rgba(227, 30, 36, 0.2);
        --chatBg: #0d1117;
        --chatPat: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
        --me: #7a1216;
        --meTxt: #ffffff;
        --them: #18202c;
        --hover: #1c2533;
        --tick: #fca5a5;
        --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
        --shadowLg: 0 14px 40px rgba(0, 0, 0, 0.55);
      }
    }

    :root[data-theme="dark"] {
      --bg: #0b0f14;
      --side: #121820;
      --side2: #1a222d;
      --txt: #f1f5f9;
      --sub: #94a3b8;
      --line: #1e293b;
      --accSoft: rgba(227, 30, 36, 0.2);
      --chatBg: #0d1117;
      --chatPat: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
      --me: #7a1216;
      --meTxt: #ffffff;
      --them: #18202c;
      --hover: #1c2533;
      --tick: #fca5a5;
      --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
      --shadowLg: 0 14px 40px rgba(0, 0, 0, 0.55);
    }

    *, *::before, *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      -webkit-tap-highlight-color: transparent;
    }

    html, body {
      height: 100%;
      height: 100dvh;
      width: 100%;
      overflow: hidden;
    }

    body {
      font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
      background: var(--bg);
      color: var(--txt);
      line-height: 1.45;
      -webkit-font-smoothing: antialiased;
    }

    /* Custom Scrollbars */
    ::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }
    ::-webkit-scrollbar-track {
      background: transparent;
    }
    ::-webkit-scrollbar-thumb {
      background: rgba(100, 116, 139, 0.28);
      border-radius: 999px;
    }
    ::-webkit-scrollbar-thumb:hover {
      background: rgba(100, 116, 139, 0.45);
    }

    button {
      font: inherit;
      color: inherit;
      background: none;
      border: 0;
      cursor: pointer;
      user-select: none;
      transition: transform 0.14s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
    }

    button:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
      outline: 2px solid var(--acc);
      outline-offset: 2px;
    }

    .app {
      display: flex;
      height: 100%;
      height: 100dvh;
      width: 100%;
      max-width: 1680px;
      margin: 0 auto;
      background: var(--side);
      box-shadow: var(--shadowLg);
    }

    /* Sidebar */
    .side {
      width: 390px;
      max-width: 100%;
      height: 100%;
      background: var(--side);
      border-right: 1px solid var(--line);
      display: flex;
      flex-direction: column;
      flex-shrink: 0;
      padding-top: env(safe-area-inset-top, 0px);
    }

    /* Brand Header */
    .brand-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 14px 6px;
      gap: 10px;
    }

    .brand-id {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }

    .brand-logo {
      width: 42px;
      height: 42px;
      border-radius: 12px;
      flex-shrink: 0;
      box-shadow: 0 3px 10px rgba(227, 30, 36, 0.28);
      overflow: hidden;
      background: #fff;
    }

    .brand-title-wrap {
      display: flex;
      flex-direction: column;
      min-width: 0;
    }

    .brand-title {
      font-size: 18px;
      font-weight: 800;
      letter-spacing: -0.02em;
      display: flex;
      align-items: center;
      gap: 5px;
      line-height: 1.15;
    }

    .brand-badge {
      background: var(--acc);
      color: #fff;
      font-size: 11px;
      font-weight: 800;
      padding: 1px 6px;
      border-radius: 6px;
      font-style: italic;
    }

    .brand-sub {
      font-size: 11.5px;
      color: var(--sub);
      font-weight: 500;
    }

    .brand-actions {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .sh {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 14px 10px;
      border-bottom: 1px solid var(--line);
    }

    .ib {
      width: 40px;
      height: 40px;
      border-radius: 12px;
      display: grid;
      place-items: center;
      font-size: 20px;
      flex-shrink: 0;
      color: var(--sub);
      background: transparent;
    }

    .ib:hover {
      background: var(--hover);
      color: var(--txt);
    }

    .ib:active {
      transform: scale(0.92);
    }

    .ib.accent-pill {
      background: var(--accSoft);
      color: var(--acc);
    }

    .ib.accent-pill:hover {
      background: var(--acc);
      color: #fff;
    }

    .search-wrap {
      flex: 1;
      position: relative;
      display: flex;
      align-items: center;
      min-width: 0;
    }

    .search-wrap svg {
      position: absolute;
      left: 13px;
      color: var(--sub);
      pointer-events: none;
    }

    .search {
      width: 100%;
      background: var(--side2);
      border-radius: 14px;
      padding: 10px 14px 10px 38px;
      border: 1px solid transparent;
      color: var(--txt);
      font-size: 14.5px;
      min-width: 0;
      transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
    }

    .search:focus {
      background: var(--side);
      border-color: var(--acc);
      box-shadow: 0 0 0 3px var(--accSoft);
    }

    .list {
      flex: 1;
      overflow-y: auto;
      padding: 6px 0;
    }

    .row {
      display: flex;
      gap: 12px;
      padding: 10px 12px;
      margin: 2px 8px;
      border-radius: 14px;
      cursor: pointer;
      align-items: center;
      transition: background-color 0.15s ease, transform 0.12s ease;
    }

    .row:hover {
      background: var(--hover);
    }

    .row:active {
      transform: scale(0.99);
    }

    .row.on {
      background: linear-gradient(135deg, var(--sel), var(--accDark));
      color: #fff;
      box-shadow: 0 4px 14px rgba(227, 30, 36, 0.32);
    }

    .row.on .sub,
    .row.on .tm {
      color: rgba(255, 255, 255, 0.88);
    }

    .av {
      width: 50px;
      height: 50px;
      border-radius: 16px;
      display: grid;
      place-items: center;
      color: #fff;
      font-weight: 700;
      font-size: 18px;
      flex-shrink: 0;
      position: relative;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    }

    .av.sm {
      width: 42px;
      height: 42px;
      border-radius: 14px;
      font-size: 16px;
    }

    .on-dot {
      position: absolute;
      right: -2px;
      bottom: -2px;
      width: 13px;
      height: 13px;
      border-radius: 50%;
      background: #22c55e;
      border: 2.5px solid var(--side);
    }

    .mid {
      flex: 1;
      min-width: 0;
    }

    .l1, .l2 {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
    }

    .nm {
      font-weight: 600;
      font-size: 15px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .tm {
      font-size: 11.5px;
      color: var(--sub);
      flex-shrink: 0;
      display: flex;
      align-items: center;
      gap: 3px;
    }

    .sub {
      font-size: 13.5px;
      color: var(--sub);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-top: 2px;
    }

    .bd {
      background: var(--acc);
      color: #fff;
      font-size: 11.5px;
      font-weight: 700;
      min-width: 21px;
      height: 21px;
      border-radius: 999px;
      display: grid;
      place-items: center;
      padding: 0 6px;
      box-shadow: 0 2px 6px rgba(227, 30, 36, 0.35);
    }

    .row.on .bd {
      background: #fff;
      color: var(--acc);
      box-shadow: none;
    }

    /* Main Chat Area */
    .main {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      height: 100%;
      background-color: var(--chatBg);
      background-image: var(--chatPat);
      background-size: 20px 20px;
      position: relative;
    }

    .ch {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      background: var(--side);
      border-bottom: 1px solid var(--line);
      z-index: 3;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    }

    .ch .back {
      display: none;
    }

    .ch .info {
      flex: 1;
      min-width: 0;
      padding: 2px 4px;
      border-radius: 8px;
    }

    .ch .info:hover {
      background: var(--hover);
    }

    .ch .st {
      font-size: 12.5px;
      color: var(--sub);
    }

    .ch .st.typ {
      color: var(--acc);
      font-weight: 600;
    }

    .msgs {
      flex: 1;
      overflow-y: auto;
      padding: 14px 16px;
      display: flex;
      flex-direction: column;
      gap: 5px;
    }

    .day {
      align-self: center;
      background: rgba(15, 23, 42, 0.55);
      backdrop-filter: blur(6px);
      color: #fff;
      font-size: 12px;
      font-weight: 600;
      padding: 4px 14px;
      border-radius: 999px;
      margin: 8px 0;
    }

    .m {
      max-width: min(540px, 84%);
      padding: 9px 12px 7px;
      border-radius: 16px;
      line-height: 1.42;
      font-size: 15px;
      word-wrap: break-word;
      overflow-wrap: anywhere;
      position: relative;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
      white-space: pre-wrap;
    }

    .m.me {
      align-self: flex-end;
      background: var(--me);
      color: var(--meTxt);
      border-bottom-right-radius: 4px;
    }

    .m.th {
      align-self: flex-start;
      background: var(--them);
      border: 1px solid var(--line);
      border-bottom-left-radius: 4px;
    }

    .meta {
      float: right;
      margin: 6px 0 -2px 10px;
      font-size: 11px;
      color: var(--sub);
      display: flex;
      gap: 3px;
      align-items: center;
      white-space: nowrap;
    }

    .m.me .meta {
      color: var(--tick);
      font-weight: 500;
    }

    .dots {
      display: inline-flex;
      gap: 4px;
      padding: 4px 2px;
    }

    .dots i {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--acc);
      animation: b 1s infinite;
    }

    .dots i:nth-child(2) {
      animation-delay: 0.15s;
    }

    .dots i:nth-child(3) {
      animation-delay: 0.3s;
    }

    @keyframes b {
      0%, 60%, 100% { transform: none; opacity: 0.45; }
      30% { transform: translateY(-4px); opacity: 1; }
    }

    @media (prefers-reduced-motion: reduce) {
      .dots i { animation: none; }
    }

    /* Composer Bar */
    .bar {
      display: flex;
      align-items: flex-end;
      gap: 8px;
      padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
      background: var(--side);
      border-top: 1px solid var(--line);
      position: relative;
    }

    .inp {
      flex: 1;
      background: var(--side2);
      color: var(--txt);
      border: 1px solid transparent;
      border-radius: 20px;
      padding: 10px 16px;
      font: inherit;
      font-size: 15px;
      resize: none;
      max-height: 120px;
      line-height: 1.35;
      transition: border-color 0.15s, background-color 0.15s;
    }

    .inp:focus {
      background: var(--side);
      border-color: var(--acc);
    }

    .send {
      background: linear-gradient(135deg, var(--acc), var(--accDark));
      color: #fff;
      width: 44px;
      height: 44px;
      border-radius: 15px;
      display: grid;
      place-items: center;
      font-size: 18px;
      flex-shrink: 0;
      box-shadow: 0 4px 12px rgba(227, 30, 36, 0.35);
    }

    .send:hover {
      filter: brightness(1.08);
      transform: translateY(-1px);
    }

    .send:active {
      transform: scale(0.92);
    }

    .send svg {
      margin: 1px 2px 0 0;
    }

    .emo {
      position: absolute;
      bottom: 68px;
      left: 12px;
      background: var(--side);
      border: 1px solid var(--line);
      border-radius: 16px;
      padding: 10px;
      display: none;
      grid-template-columns: repeat(8, 1fr);
      gap: 4px;
      width: min(340px, calc(100% - 24px));
      box-shadow: var(--shadowLg);
      z-index: 15;
    }

    .emo.show {
      display: grid;
    }

    .emo button {
      font-size: 22px;
      padding: 5px;
      border-radius: 10px;
    }

    .emo button:hover {
      background: var(--hover);
      transform: scale(1.15);
    }

    /* Context Menu */
    .cm {
      position: fixed;
      background: var(--side);
      border: 1px solid var(--line);
      border-radius: 16px;
      padding: 8px;
      z-index: 30;
      display: none;
      min-width: 195px;
      box-shadow: var(--shadowLg);
    }

    .cm.show {
      display: block;
    }

    .cm .rx {
      display: flex;
      gap: 4px;
      padding: 4px 4px 8px;
      border-bottom: 1px solid var(--line);
      margin-bottom: 6px;
    }

    .cm .rx button {
      font-size: 20px;
      padding: 4px 6px;
      width: auto;
      border-radius: 10px;
      display: block;
    }

    .cm button {
      display: flex;
      align-items: center;
      gap: 12px;
      width: 100%;
      text-align: left;
      padding: 9px 12px;
      border-radius: 10px;
      font-size: 14.5px;
      font-weight: 500;
    }

    .cm button:hover {
      background: var(--hover);
    }

    .cm svg {
      color: var(--sub);
      flex-shrink: 0;
    }

    .cm [data-a="delete"],
    .menu [data-a="del"] {
      color: #ef4444;
    }

    .cm [data-a="delete"] svg,
    .menu [data-a="del"] svg {
      color: #ef4444;
    }

    .rp {
      border-left: 3px solid var(--acc);
      padding: 4px 8px;
      margin-bottom: 5px;
      font-size: 13px;
      background: var(--accSoft);
      border-radius: 6px;
      cursor: pointer;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .rp b {
      display: block;
      color: var(--acc);
      font-size: 12.5px;
    }

    .rpbar {
      display: none;
      align-items: center;
      gap: 8px;
      padding: 6px 10px 6px 16px;
      background: var(--side);
      border-top: 1px solid var(--line);
      font-size: 13.5px;
    }

    .rpbar.show {
      display: flex;
    }

    .rpbar div {
      flex: 1;
      min-width: 0;
      border-left: 3px solid var(--acc);
      padding-left: 10px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .rxs {
      display: flex;
      gap: 4px;
      flex-wrap: wrap;
      margin-top: 5px;
      clear: both;
    }

    .rxs span {
      background: var(--accSoft);
      border-radius: 999px;
      padding: 2px 8px;
      font-size: 13px;
    }

    .m img {
      max-width: 100%;
      border-radius: 12px;
      display: block;
      margin-bottom: 4px;
      max-height: 320px;
    }

    .m.fl {
      outline: 2.5px solid var(--acc);
    }

    /* Empty Welcome Placeholder */
    .ph {
      flex: 1;
      display: grid;
      place-items: center;
      text-align: center;
      padding: 24px;
    }

    .ph-card {
      background: var(--side);
      border: 1px solid var(--line);
      border-radius: 24px;
      padding: 32px 28px;
      max-width: 380px;
      box-shadow: var(--shadow);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 14px;
    }

    .ph-logo {
      width: 96px;
      height: 96px;
      border-radius: 24px;
      box-shadow: 0 8px 24px rgba(227, 30, 36, 0.25);
      overflow: hidden;
      background: #fff;
    }

    .ph-card h2 {
      font-size: 22px;
      font-weight: 800;
      letter-spacing: -0.02em;
    }

    .ph-card p {
      font-size: 14px;
      color: var(--sub);
    }

    .ph-pill {
      background: var(--accSoft);
      color: var(--acc);
      font-weight: 600;
      padding: 6px 14px;
      border-radius: 999px;
      font-size: 13px;
    }

    /* Dropdown Menu */
    .menu {
      position: absolute;
      top: 62px;
      right: 12px;
      background: var(--side);
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 6px;
      display: none;
      z-index: 16;
      min-width: 195px;
      box-shadow: var(--shadowLg);
    }

    .menu.show {
      display: block;
    }

    .menu button {
      display: flex;
      align-items: center;
      gap: 12px;
      width: 100%;
      text-align: left;
      padding: 10px 12px;
      border-radius: 10px;
      font-size: 14.5px;
      font-weight: 500;
    }

    .menu button:hover {
      background: var(--hover);
    }

    .menu svg {
      color: var(--sub);
      flex-shrink: 0;
    }

    /* Modals & Sheets */
    .modal {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.58);
      backdrop-filter: blur(4px);
      display: none;
      place-items: center;
      z-index: 25;
      padding: 16px;
    }

    .modal.show {
      display: grid;
    }

    .card {
      background: var(--side);
      border: 1px solid var(--line);
      border-radius: 20px;
      padding: 20px;
      width: min(390px, 100%);
      box-shadow: var(--shadowLg);
    }

    .card h3 {
      margin-bottom: 12px;
      font-size: 18px;
      font-weight: 700;
    }

    .card input {
      width: 100%;
      background: var(--side2);
      color: var(--txt);
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 11px 14px;
      font: inherit;
    }

    .card .act {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 16px;
    }

    .card .act button {
      padding: 10px 18px;
      border-radius: 12px;
      font-weight: 600;
      color: var(--sub);
      background: var(--side2);
    }

    .card .act button:hover {
      background: var(--hover);
      color: var(--txt);
    }

    .card .act .ok {
      background: linear-gradient(135deg, var(--acc), var(--accDark));
      color: #fff;
      box-shadow: 0 3px 10px rgba(227, 30, 36, 0.3);
    }

    @media (max-width: 768px) {
      .side {
        width: 100%;
      }
      .main {
        position: fixed;
        inset: 0;
        transform: translateX(100%);
        transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
        z-index: 10;
        padding-top: env(safe-area-inset-top, 0px);
      }
      .app.chat .main {
        transform: translateX(0);
      }
      .ch .back {
        display: grid;
      }
    }

    @media (max-width: 768px) and (prefers-reduced-motion: reduce) {
      .main {
        transition: none;
      }
    }

    /* ---- v2 fixes: responsive, offline banner, perf ---- */
    html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
    .app,.side,.main,.list,.msgs,.mid,.info,.l1,.l2{min-width:0}
    .nm,.sub,.info .nm,.info .st,.brand-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
    .ch .info .nm,.ch .info .st{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:break-word;line-height:1.28}
    .chips{flex-wrap:wrap!important;overflow:visible!important}
    .bar .inp{line-height:1.35;padding-top:10px;padding-bottom:10px}
    .row .nm{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere}
    .row .sub{white-space:normal!important;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
    .m{max-width:min(82%,560px);overflow-wrap:anywhere;word-break:break-word}
    .m img,.m video,.m canvas,.m svg.ai{max-width:100%;height:auto}
    .msgs{min-height:0}
    .msgs{overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}
    .bar{padding-bottom:calc(8px + env(safe-area-inset-bottom,0px));gap:4px;min-width:0}
    .bar .inp{min-width:0;flex:1 1 auto}
    .ch{padding-top:max(8px,env(safe-area-inset-top,0px))}
    .brand-bar{padding-top:max(10px,env(safe-area-inset-top,0px))}
    .tabs{overflow-x:auto;scrollbar-width:none}.tabs::-webkit-scrollbar{display:none}
    .tabs button{min-width:56px}
    .modal .card,.sc{max-width:calc(100vw - 24px);max-height:88dvh}
    .cm{max-width:calc(100vw - 16px);max-height:80dvh;overflow:auto}
    img,video,svg{max-width:100%}
    @media (max-width:768px){input,textarea,select,.inp,.search{font-size:16px!important}.m{max-width:88%}}
    @media (max-width:360px){.ib{width:36px;height:36px}.brand-sub{display:none}.bar{gap:2px}}
    @media (max-height:480px) and (orientation:landscape){.emo{max-height:90px;overflow:auto}}
    #net{position:fixed;left:50%;top:max(8px,env(safe-area-inset-top,0px));transform:translate(-50%,-150%);z-index:99999;background:#111;color:#fff;font:600 12.5px Inter,system-ui,sans-serif;padding:7px 14px;border-radius:999px;box-shadow:var(--shadowLg);transition:transform .25s;max-width:calc(100vw - 24px);text-align:center;pointer-events:none}
    #net.show{transform:translate(-50%,0)}#net.ok{background:#15803d}
    .m .pdc{display:inline-block;vertical-align:-2px;opacity:.7}
    @media (prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;transition-duration:.01ms!important}}
    /* ---- v9: mobile polish for the typing bar ---- */
    html,body{overscroll-behavior-y:none;-webkit-tap-highlight-color:transparent}
    button,.ib,.send,.row,.sr,.ctb{touch-action:manipulation;-webkit-user-select:none;user-select:none}
    .bar{flex-shrink:0;align-items:flex-end;z-index:3}
    .bar .inp{-webkit-user-select:text;user-select:text;scrollbar-width:none;overflow-y:auto;-webkit-appearance:none;appearance:none;border-radius:22px;min-height:42px}
    .bar .inp::-webkit-scrollbar{display:none}
    .bar .ib,.bar .send{flex:0 0 auto;margin-bottom:0}
    .send{min-width:44px;min-height:44px;border-radius:50%}
    @media (max-width:768px){
      .bar{padding:6px 8px calc(6px + env(safe-area-inset-bottom,0px));gap:6px}
      .bar .ib{width:42px;height:42px}
      .bar .inp{padding:10px 14px;max-height:112px}
      .m{font-size:15.5px}
    }
  
  #lk{align-items:center;justify-content:center;padding:12px;overflow:auto}
  #lk .card{width:min(420px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto}
  #lk .card h3{margin-bottom:8px}#lk .card p{color:var(--sub);font-size:13px;margin:4px 0 8px}
  #lk input{width:100%;margin:5px 0;padding:11px 12px;border-radius:12px;border:1px solid var(--line);background:var(--side2);color:var(--txt);font-size:16px}
  #lk label{display:block;text-align:left;font-size:12px;color:var(--sub);margin-top:6px}
  #lk .btn{width:100%;margin-top:8px}#lk .lgl{margin-top:14px;font-size:12px;line-height:1.7;color:var(--sub,#6b7280);text-align:center}#lk .lgl a{color:var(--acc,#E31E24);text-decoration:none;font-weight:600}.lkw{color:#dc2626;font-weight:600;font-size:13px;min-height:18px;margin:4px 0}
  #lk .lg{width:64px;height:64px;margin:0 auto 6px;border-radius:16px}
  .pwr{position:relative;width:100%}
  .pwr input{width:100%;padding-right:46px!important;box-sizing:border-box}
  .eye{position:absolute;right:4px;top:50%;transform:translateY(-50%);width:38px;height:38px;border:0;background:none;color:var(--sub);cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:10px;padding:0}
  .eye.on{color:var(--acc)}
  .rcb{font-size:34px;font-weight:800;letter-spacing:5px;margin:10px 0 2px;color:var(--acc);font-variant-numeric:tabular-nums}
  .rct{display:block;color:var(--sub);margin-bottom:8px}
  .tk{display:inline-flex;vertical-align:middle}
  .vw{position:relative;width:100%}
  .vw input{width:100%;box-sizing:border-box;padding-right:40px!important}
  #lk .pwr input{padding-right:78px!important}
  .vi{position:absolute;right:13px;top:50%;transform:translateY(-50%);font-weight:800;font-size:17px;line-height:1;pointer-events:none}
  .pwr .vi{right:46px}
  .vi.ok{color:#16a34a}.vi.bad{color:#dc2626}.vi.wait{color:var(--sub);font-size:14px}
  #lk input.vok{border-color:#16a34a!important}#lk input.vbad{border-color:#dc2626!important}
  .vh{font-size:12px;text-align:left;margin:-2px 2px 4px;color:var(--sub)}.vh:empty{display:none}.vh.ok{color:#16a34a}.vh.bad{color:#dc2626}
  #lk .btn:disabled{opacity:.5;cursor:not-allowed}
  #dlg{align-items:center;justify-content:center;padding:12px}#dlg .card{width:min(360px,calc(100vw - 24px))}
  #dlg .card button{display:block;width:100%;margin-top:8px;padding:12px;border-radius:12px;border:1px solid var(--line);background:var(--side2);color:var(--txt);font-weight:600;cursor:pointer}
  #dlg .card button.dn{background:#dc2626;color:#fff;border:0}
    /* ---- v5: nothing gets cut, header stays visible while typing (like WhatsApp) ---- */
    .ch{flex:0 0 auto;position:relative;z-index:5;min-height:56px}
    .ch .av.sm,.ch .ib{flex:0 0 auto}
    .msgs{min-height:0;flex:1 1 auto}
    .bar,.chips,.rpbar{flex:0 0 auto}
    .av{overflow:hidden}.av img{width:100%;height:100%;object-fit:cover;border-radius:inherit;display:block}
    .av .on-dot{overflow:visible}
    .modal .card{max-height:calc(var(--vvh,100dvh) - 16px);overflow-y:auto;-webkit-overflow-scrolling:touch}
    @media (max-width:768px){
      .app{height:var(--vvh,100dvh)}
      .main{inset:auto!important;top:var(--vvt,0px);left:0;right:0;height:var(--vvh,100dvh);bottom:auto}
    }
    .pfb{display:flex;gap:8px;margin:6px 0}.pfb .btn{flex:1;margin-top:0}
    .cti{display:flex;align-items:center;gap:8px;padding:9px 0;border-bottom:1px solid var(--line);flex-wrap:wrap}
    .ctm{flex:1;min-width:120px}.ctm b{display:block;overflow-wrap:anywhere}.ctm small{color:var(--sub)}
    .ctb{border:1px solid var(--line);background:var(--side2);color:var(--txt);border-radius:999px;padding:6px 11px;font-size:12.5px;font-weight:600;cursor:pointer}
    .ctb.off{background:#fee2e2;color:#b91c1c;border-color:#fecaca}.ctb.dn{color:#dc2626}
