.yun-app [hidden] { display: none !important; }

.yun-app {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 480px at 90% -10%, rgba(212, 179, 106, 0.08), transparent 55%),
    radial-gradient(700px 400px at -10% 80%, rgba(60, 90, 70, 0.14), transparent 50%),
    #070a08;
}

.yun-app .muted { color: var(--muted); margin: 0; font-size: .9rem; line-height: 1.55; }
.yun-app label { display: block; font-size: .82rem; color: var(--muted); margin: 12px 0 6px; }
.yun-app input, .yun-app textarea, .yun-app select {
  width: 100%;
  background: #0c100e;
  color: var(--cream);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
}
.yun-app input:focus, .yun-app textarea:focus, .yun-app select:focus {
  outline: none;
  border-color: var(--gold);
}
.yun-app .msg { min-height: 1.2em; margin-top: 10px; font-size: .88rem; }
.yun-app .msg.ok { color: #8fbf9a; }
.yun-app .msg.err { color: #e07a7a; }
.btn-mini { min-height: 36px; padding: 0 14px; font-size: .85rem; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* —— Gate —— */
.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.gate-card {
  width: min(100%, 440px);
  background: linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,.012));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 26px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.32);
  backdrop-filter: blur(14px);
}
.gate-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--cream);
}
.gate-brand img { border-radius: 8px; }
.gate-card h1 {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 8px;
}
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; }
.captcha-img {
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
}
.gate-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.gate-foot { margin-top: 16px; font-size: .82rem; color: var(--muted); }
.gate-foot a { color: var(--gold); }

/* —— Shell —— */
.shell-app {
  display: grid;
  grid-template-columns: 228px 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}
.side {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(10, 14, 12, .78);
  padding: 16px 12px;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 8px;
  color: inherit;
  cursor: pointer;
  width: 100%;
}
.side-user:hover { border-color: var(--line-strong); background: rgba(255,255,255,.03); }
.side-user img {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line-strong);
}
.side-user strong { display: block; font-size: .92rem; }
.side-user em { display: block; font-style: normal; font-size: .75rem; color: var(--muted); }
.svip {
  margin-left: auto;
  font-size: .62rem;
  letter-spacing: .08em;
  color: var(--gold-ink);
  background: linear-gradient(135deg, #e4c888, var(--gold-deep));
  border-radius: 999px;
  padding: 2px 6px;
  font-weight: 700;
}
.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; flex: 1; }
.nav-label {
  margin: 12px 8px 4px;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.tab-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
}
.tab-btn:hover { color: var(--cream); background: rgba(255,255,255,.04); }
.tab-btn.is-on {
  color: var(--gold-ink);
  background: linear-gradient(135deg, #e4c888, var(--gold-deep));
  font-weight: 600;
}
.side-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 8px 4px;
  font-size: .78rem;
  color: var(--muted);
}
.side-foot a { color: var(--muted); }
.side-foot a:hover { color: var(--gold); }

.workspace { display: flex; flex-direction: column; min-width: 0; }
.warn-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 18px;
  background: rgba(184, 120, 50, .16);
  border-bottom: 1px solid rgba(212, 179, 106, .28);
  color: #e8d2a0;
  font-size: .9rem;
}
.warn-bar[hidden] { display: none !important; }
.main { flex: 1; min-height: 0; overflow: auto; padding: 22px 24px 40px; }
.panel { display: none; max-width: 980px; }
.panel.is-on { display: block; }
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.panel-head h2 {
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 600;
  margin: 0 0 6px;
}
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.select { min-width: 220px; max-width: 320px; }

.chat-board {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(12, 16, 14, .55);
  overflow: hidden;
}
.chat-log {
  height: min(52vh, 520px);
  overflow: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: min(78%, 560px);
  padding: 10px 13px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-size: .95rem;
}
.bubble.them {
  align-self: flex-end;
  background: linear-gradient(135deg, #e4c888, var(--gold-deep));
  color: var(--gold-ink);
  border-bottom-right-radius: 4px;
}
.bubble.me {
  align-self: flex-start;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.bubble.sys {
  align-self: center;
  background: transparent;
  color: var(--muted);
  font-size: .82rem;
  max-width: 90%;
}
.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  align-items: end;
}
.chat-compose textarea { resize: none; min-height: 46px; }
.chat-meta { padding: 0 14px 12px; font-size: .78rem; color: var(--muted); min-height: 1.2em; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.mini-card {
  text-align: left;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.mini-card:hover { border-color: var(--line-strong); }
.mini-card h3 { margin: 0 0 6px; font-size: 1rem; }
.mini-card p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.mini-card .tag {
  display: inline-block;
  margin-top: 8px;
  font-size: .68rem;
  color: var(--gold);
  letter-spacing: .04em;
}
.persona-view {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: rgba(12,16,14,.5);
}
.persona-view header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.persona-view h3 { margin: 0; font-size: 1.05rem; }
.persona-view pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .84rem;
  line-height: 1.65;
  color: #d9d4c8;
  max-height: 480px;
  overflow: auto;
  font-family: inherit;
}

.account-grid, .guide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.info-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: rgba(255,255,255,.03);
}
.info-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.info-card ul, .info-card ol { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.info-card li { margin: 4px 0; }
.profile-row { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--gold);
}
.acc-name { font-weight: 700; font-size: 1.1rem; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #121a14;
  border: 1px solid var(--line);
  font-size: .82rem;
  color: var(--muted);
}
.pill strong { color: var(--gold); font-weight: 600; }

.empty {
  color: var(--muted);
  padding: 24px 8px;
  font-size: .92rem;
}

.warn-bar-info {
  background: rgba(80, 120, 90, .18);
  border-color: rgba(143, 191, 154, .35);
}
.pill.ok { border-color: #8fbf9a; color: #8fbf9a; }

.channel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.channel-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255,255,255,.03);
}
.channel-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.05rem;
}
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-end { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge {
  font-size: .72rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.st-ready { color: #8fbf9a; border-color: #8fbf9a; }
.badge.st-qr { color: var(--gold); border-color: var(--gold); }
.badge.st-starting { color: #c9b27a; }
.badge.st-error { color: #e07a7a; border-color: #e07a7a; }
.error-text { color: #e07a7a; min-height: 1.1em; margin: 6px 0 0; }
.qr-box {
  min-height: 0;
  margin-top: 10px;
  display: grid;
  place-items: center;
}
.qr-box img {
  width: min(220px, 100%);
  height: auto;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.line-config { margin-top: 10px; color: var(--muted); font-size: .86rem; }
.line-config .field { display: block; margin: 8px 0; }
.line-config .field span { display: block; margin-bottom: 4px; }
.ch-logo {
  width: 18px; height: 18px; border-radius: 4px; display: inline-block;
}
.ch-wa { background: #25d366; }
.ch-line { background: #06c755; }

.contacts-split {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 12px;
  min-height: 62vh;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(12,16,14,.45);
}
.contact-list {
  border-right: 1px solid var(--line);
  overflow: auto;
  max-height: 70vh;
}
.contact-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  font: inherit;
  padding: 12px 12px 10px;
  cursor: pointer;
}
.contact-item strong { display: block; font-size: .92rem; }
.contact-item span { display: block; color: var(--muted); font-size: .78rem; margin-top: 4px; }
.contact-item.is-on { background: rgba(212,179,106,.08); }
.tag-man, .tag-alert {
  display: inline-block;
  margin-top: 6px;
  margin-right: 6px;
  font-size: .68rem;
  font-style: normal;
  padding: 1px 6px;
  border-radius: 999px;
}
.tag-man { color: var(--gold); border: 1px solid var(--gold); }
.tag-alert { color: #e07a7a; border: 1px solid #e07a7a; }
.contact-pane { display: flex; flex-direction: column; min-height: 62vh; }
.contact-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.contact-head h3 { margin: 0; font-size: 1.05rem; }
#contact-detail { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#ct-log { flex: 1; height: auto; min-height: 280px; }
#ct-log small { display: block; opacity: .55; font-size: .7rem; margin-bottom: 4px; }

@media (max-width: 860px) {
  .channel-grid, .contacts-split { grid-template-columns: 1fr; }
  .contact-list { max-height: 28vh; border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 860px) {
  .shell-app { grid-template-columns: 1fr; }
  .side {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    gap: 8px;
  }
  .side-user { width: auto; flex: 1; }
  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    margin-top: 0;
    width: 100%;
  }
  .nav-label { display: none; }
  .tab-btn { padding: 8px 10px; font-size: .85rem; }
  .side-foot { display: none; }
  .main { padding: 16px 14px 32px; }
  .panel-head { flex-direction: column; }
  .select { max-width: 100%; min-width: 0; width: 100%; }
  .account-grid, .guide { grid-template-columns: 1fr; }
  .bubble { max-width: 88%; }
  .chat-log { height: 46vh; }
}
