/* The phone frames imitate WhatsApp, so their colours live here as simulator
   tokens. Everything around them uses the JunaKey tokens. */
:root {
  --wa-header: #075e54;
  --wa-header-fg: #ffffff;
  --wa-wall: #ece5dd;
  --wa-in: #ffffff;
  --wa-out: #dcf8c6;
  --wa-link: #027eb5;
  --wa-ink: #111b21;
  --wa-muted: #667781;
  --wa-rule: #d1d7db;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--jh-bg-alt); color: var(--jh-fg); font-family: var(--jh-font-sans); font-size: 14px; }

jk-simulator { display: grid; grid-template-columns: 260px 1fr; height: 100vh; }

.side { background: var(--jh-bg-elev); border-right: 1px solid var(--jh-border); display: flex; flex-direction: column; overflow-y: auto; min-height: 0; }
.side > * { flex: none; }
.side h1 { font-size: 15px; margin: 0; padding: 16px 16px 4px; }
.side .hint { color: var(--jh-fg-muted); font-size: 12px; margin: 0; padding: 0 16px 12px; line-height: 1.4; }
.side h2 { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--jh-fg-subtle); margin: 16px 16px 6px; }
.persona { display: block; width: 100%; text-align: left; padding: 9px 16px; background: none; border: 0; border-left: 3px solid transparent; font: inherit; color: inherit; cursor: pointer; }
.persona:hover { background: var(--jh-bg-alt); }
.persona.open { border-left-color: var(--jh-accent); background: var(--jh-accent-bg); }
.persona b { display: block; font-weight: 550; }
.persona small { color: var(--jh-fg-muted); }
.tools { padding: 0 16px 16px; display: grid; gap: 6px; }
.tools button, .tools a { padding: 7px 10px; border: 1px solid var(--jh-border-strong); background: var(--jh-bg-elev); border-radius: var(--jh-radius-sm); font: inherit; color: inherit; cursor: pointer; text-align: center; text-decoration: none; }
.tools button:hover { background: var(--jh-bg-alt); }
.email { padding: 8px 16px; border-top: 1px solid var(--jh-border); font-size: 12px; }
.email b { display: block; font-weight: 550; overflow-wrap: anywhere; }
.email span { color: var(--jh-fg-muted); overflow-wrap: anywhere; }

.phones { display: flex; gap: 16px; padding: 16px; overflow-x: auto; min-height: 0; }
.empty { margin: auto; color: var(--jh-fg-muted); }
.phone { flex: 0 0 340px; display: flex; flex-direction: column; min-height: 0; border-radius: var(--jh-radius-lg); overflow: hidden; box-shadow: var(--jh-shadow-lg); background: var(--wa-wall); color: var(--wa-ink); position: relative; }
.phone header { background: var(--wa-header); color: var(--wa-header-fg); padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.phone header div { flex: 1; min-width: 0; }
.phone header b { display: block; font-weight: 550; }
.phone header small { opacity: .8; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone header button { background: none; border: 0; color: inherit; font-size: 12px; cursor: pointer; opacity: .85; padding: 4px; }
.notice { background: var(--jh-warn-bg); color: var(--wa-ink); font-size: 12px; padding: 6px 12px; }

.chat { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.msg { max-width: 86%; padding: 6px 9px; border-radius: 8px; line-height: 1.35; overflow-wrap: anywhere; white-space: pre-wrap; box-shadow: 0 1px 1px rgb(0 0 0 / .12); }
.msg.in { align-self: flex-end; background: var(--wa-out); }
.msg.out { align-self: flex-start; background: var(--wa-in); }
.msg.failed { outline: 1px dashed var(--jh-danger); }
.meta { display: flex; justify-content: space-between; gap: 10px; font-size: 10.5px; color: var(--wa-muted); margin-top: 3px; }
.tag { font-family: var(--jh-font-mono); }
.msg img { display: block; max-width: 100%; border-radius: 6px; margin-bottom: 4px; }
.doc, .contact { display: flex; gap: 8px; align-items: center; background: rgb(0 0 0 / .05); padding: 8px; border-radius: 6px; margin-top: 6px; color: inherit; text-decoration: none; }
.doc b, .contact b { font-weight: 550; display: block; }
.contact small, .doc small { color: var(--wa-muted); }
.actions { max-width: 86%; align-self: flex-start; width: 86%; display: grid; gap: 2px; margin-top: -2px; }
.actions button, .actions a { background: var(--wa-in); color: var(--wa-link); border: 0; padding: 8px; font: inherit; font-weight: 550; cursor: pointer; border-radius: 6px; text-align: center; text-decoration: none; box-shadow: 0 1px 1px rgb(0 0 0 / .1); }
.actions button:hover { background: var(--wa-rule); }
.typing { align-self: flex-start; font-size: 12px; color: var(--wa-muted); padding: 2px 4px; }

.sheet { position: absolute; inset: auto 0 0 0; max-height: 75%; overflow-y: auto; background: var(--wa-in); border-radius: 12px 12px 0 0; box-shadow: 0 -4px 20px rgb(0 0 0 / .2); z-index: 2; }
.sheet h3 { font-size: 14px; margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--wa-rule); display: flex; justify-content: space-between; }
.sheet h3 button { border: 0; background: none; cursor: pointer; font: inherit; color: var(--wa-muted); }
.sheet .row { display: block; width: 100%; padding: 10px 14px; background: none; border: 0; border-bottom: 1px solid var(--wa-rule); text-align: left; font: inherit; color: inherit; cursor: pointer; }
.sheet .row:hover { background: var(--wa-wall); }
.sheet .row b { display: block; font-weight: 500; }
.sheet .row small { color: var(--wa-muted); }

.composer { display: flex; gap: 6px; padding: 8px; background: var(--wa-wall); align-items: center; }
.composer input[type=text] { flex: 1; min-width: 0; padding: 9px 12px; border: 0; border-radius: var(--jh-radius-pill); font: inherit; background: var(--wa-in); color: var(--wa-ink); }
.composer button, .composer label { border: 0; background: var(--wa-in); color: var(--wa-muted); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 12px; flex: none; }
.composer button.send { background: var(--wa-header); color: var(--wa-header-fg); }
.composer input[type=file] { display: none; }
.pending { padding: 4px 12px; font-size: 12px; color: var(--wa-muted); background: var(--wa-wall); }

@media (max-width: 640px) {
  jk-simulator { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { max-height: 34vh; border-right: 0; border-bottom: 1px solid var(--jh-border); }
  .phones { padding: 8px; scroll-snap-type: x mandatory; }
  .phone { flex-basis: 100%; scroll-snap-align: start; }
}
