/* Admin de leads de Grupo Gil. Sin dependencias; ver src/Views/. */
:root {
  --bg: #f5f6f8;
  --surface: #fff;
  --text: #1d2330;
  --muted: #667085;
  --line: #e3e6ec;
  --accent: #4b47d6;
  --accent-soft: #eceafd;
  --ok: #157f4b;
  --ok-soft: #e3f5ec;
  --warn: #9a6200;
  --warn-soft: #fdf1d8;
  --alert: #c0362c;
  --alert-soft: #fdeceb;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0; font-weight: 600; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
.muted { color: var(--muted); font-size: .9em; }

/* Barra superior */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; color: var(--text); font-size: 1.05rem; }
.brand span { color: var(--accent); }
.brand--big { font-size: 1.5rem; text-align: center; margin-bottom: 1rem; }
.mainnav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.mainnav a { padding: .45rem .75rem; border-radius: 8px; color: var(--text); }
.mainnav a:hover { background: var(--bg); text-decoration: none; }
.mainnav a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.usermenu { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.usermenu__name { color: var(--text); font-weight: 600; }
.usermenu__role { color: var(--muted); }
.usermenu__phone { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.usermenu__phone::before { content: "☎ "; color: var(--muted); }
.usermenu form { margin: 0; }

.main { padding: 1.25rem; max-width: 1600px; margin: 0 auto; }
.main--wide { max-width: none; }
.main--embed { max-width: none; padding: .75rem; }
.main--embed .wa-card { margin: 0; }
.main--embed .wa-card .wa-thread { max-height: none; height: calc(100vh - 230px); min-height: 200px; }
.main--narrow { max-width: 420px; padding-top: 12vh; }

/* Componentes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; gap: .5rem; align-items: center; }
.row--wrap { flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.row--bottom { align-items: flex-end; }
.row--between { justify-content: space-between; }
.inline { display: inline; margin: 0; }
.form-narrow { max-width: 560px; }

label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .4rem; color: var(--text); font-size: .95rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; min-width: 0;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .75rem; margin: 0; }
legend { color: var(--muted); font-size: .85rem; padding: 0 .25rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .4rem; }

.btn {
  font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #3c38bd; }
.btn--danger { color: var(--alert); border-color: var(--alert); }
.btn--danger:hover { background: var(--alert-soft); }
.linkbtn { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn--danger { color: var(--alert); }

.badge { display: inline-block; min-width: 1.5em; padding: 0 .4em; border-radius: 99px; background: var(--bg); color: var(--muted); font-size: .8rem; font-weight: 600; text-align: center; }
.badge--alert { background: var(--alert); color: #fff; }
.chip { display: inline-block; padding: .15rem .6rem; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.chip--appointment { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip--legacy { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip--quote { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.tag { display: inline-flex; align-items: center; gap: .2rem; padding: .05rem .5rem; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: .8rem; font-weight: 600; }
.tag__x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0 0 .15rem; }
.status { display: inline-block; padding: .1rem .55rem; border-radius: 6px; font-size: .8rem; font-weight: 600; background: var(--bg); color: var(--muted); }
.status--contacted { background: var(--accent-soft); color: var(--accent); }
.status--visited { background: var(--warn-soft); color: var(--warn); }
.status--sold { background: var(--ok-soft); color: var(--ok); }
.status--not_sold { background: var(--alert-soft); color: var(--alert); }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: var(--ok-soft); color: var(--ok); }
.flash--error { background: var(--alert-soft); color: var(--alert); }

.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.tabs a { padding: .35rem .8rem; border-radius: 99px; color: var(--text); border: 1px solid var(--line); background: var(--surface); }
.tabs a[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tabs--line { border-bottom: 1px solid var(--line); gap: 1.5rem; margin-bottom: 1.25rem; }
.tabs--line a { border: 0; border-radius: 0; background: none; padding: .6rem 0; }
.tabs--line a[aria-current] { background: none; color: var(--accent); border-bottom: 2px solid var(--accent); font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filters input[type=search] { width: 280px; max-width: 100%; }
.filters label { flex-direction: row; align-items: center; gap: .4rem; }
.lead-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; align-items: start; }
.lead-grid .fields { margin-top: .5rem; }
.lead-grid .fields + h2 { margin-top: 1.25rem; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty__code { font-size: 3rem; font-weight: 700; margin: 0; color: var(--line); }
.login { padding: 2rem; }

/* Tablero */
.board { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: 1rem; align-items: stretch; height: calc(100vh - 175px); min-height: 360px; }
.col { flex: 0 0 260px; background: #eceef2; border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.col--won { background: #e6f2ec; }
.col--won[data-won-type="quote"] { background: #fbf1d6; }
.col--lost { background: #f4e9e8; }
.col__head { display: flex; justify-content: space-between; align-items: center; padding: .7rem .8rem .4rem; }
.col__head h2 { margin: 0; font-size: .9rem; }
.col__head { flex-wrap: wrap; row-gap: .1rem; }
.col__amount { flex-basis: 100%; display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.col__amount strong { font-weight: 600; }
.col__body { display: flex; flex-direction: column; gap: .5rem; padding: .3rem .5rem .6rem; overflow-y: auto; flex: 1; }
.col.is-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col__more { text-align: center; font-size: .85rem; padding: .3rem; }
.dcard {
  display: flex; flex-direction: column; gap: .3rem; padding: .65rem .7rem; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow);
}
.dcard:hover { border-color: var(--accent); text-decoration: none; }
.dcard[data-movable] { cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-drag: none; }
.dcard.is-dragging { opacity: .4; }
.dcard.is-saving { opacity: .6; pointer-events: none; }
.dcard--ghost { position: fixed; top: 0; left: 0; z-index: 50; pointer-events: none; cursor: grabbing; box-shadow: 0 12px 28px rgb(16 24 40 / 25%); rotate: 2deg; }
.dcard__name { font-weight: 600; }
.dcard__meta { font-size: .82rem; color: var(--muted); }
.cp { align-self: flex-start; font-size: .78rem; font-weight: 600; color: var(--muted); }
.cp--missing { padding: .05rem .45rem; border-radius: 99px; background: var(--alert-soft); color: var(--alert); }
.km { display: inline-block; width: .6rem; height: .6rem; margin-left: .3rem; border-radius: 50%; vertical-align: middle; cursor: help; }
.km--near { background: var(--ok); }
.km--mid { background: #e0a100; }
.km--far { background: var(--alert); }
.nowrap { white-space: nowrap; }
input.is-missing { border-color: var(--alert); background: var(--alert-soft); }
.cp-form { gap: .3rem; margin-bottom: .75rem; }
.cp-form .row input { flex: 1; width: 5.5rem; }
.dcard__foot { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); }

.dialog { border: 0; border-radius: var(--radius); padding: 1.25rem; width: min(420px, calc(100vw - 2rem)); box-shadow: 0 20px 40px rgb(16 24 40 / 20%); }
.dialog::backdrop { background: rgb(16 24 40 / 35%); }
.wa-dialog { width: min(760px, calc(100vw - 2rem)); height: min(860px, calc(100vh - 2rem)); padding: 0; overflow: hidden; }
.wa-dialog[open] { display: flex; flex-direction: column; }
.wa-dialog__head { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem .6rem 1rem; border-bottom: 1px solid var(--line); }
.wa-dialog__head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-dialog iframe { flex: 1; width: 100%; border: 0; }

/* Ficha */
.deal-head { display: flex; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.deal-head h1 { font-size: 1.8rem; }
.deal-head p { margin: .1rem 0 0; }
.deal-head__delete { margin-left: auto; }
.back { font-size: 1.4rem; padding: .2rem .5rem; border-radius: 8px; }
.back:hover { background: var(--accent-soft); text-decoration: none; }
.deal-grid { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(0, 2fr) minmax(250px, 1fr); gap: 1.25rem; align-items: start; }
.fields { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 1rem 0 0; font-size: .92rem; }
.fields dt { color: var(--muted); }
.fields dd { margin: 0; overflow-wrap: anywhere; }
.fields--lead { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.stage { margin: 0 0 .5rem; font-size: 1.05rem; }
.progress { width: 100%; height: 8px; appearance: none; border: 0; border-radius: 99px; background: var(--bg); overflow: hidden; }
.progress::-webkit-progress-bar { background: var(--bg); border-radius: 99px; }
.progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
.progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.progress--won::-webkit-progress-value { background: var(--ok); }
.progress--won::-moz-progress-bar { background: var(--ok); }
.progress--lost::-webkit-progress-value { background: var(--alert); }
.progress--lost::-moz-progress-bar { background: var(--alert); }
.timeline { list-style: none; margin: 0 0 1rem; padding: 0 0 0 1rem; border-left: 2px solid var(--line); }
.timeline__item { position: relative; padding: 0 0 1rem .75rem; display: flex; flex-direction: column; gap: .15rem; }
.timeline__item::before { content: ""; position: absolute; left: -1.45rem; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline__item--note::before { background: var(--accent); }
.timeline__item--stage_changed::before { background: var(--warn); }
[data-whatsapp-preview] { white-space: pre-line; }
.wa-thread { display: flex; flex-direction: column; gap: .5rem; max-height: 60vh; overflow-y: auto; padding: .75rem; margin-bottom: .75rem; background: #efeae2; border-radius: 10px; }
.wa-card .wa-thread { max-height: 420px; }
.wa-thread--new { box-shadow: inset 0 0 0 2px var(--accent); }
.wa-msg { max-width: 85%; padding: .45rem .7rem; border-radius: 10px; background: var(--surface); align-self: flex-start; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.wa-msg--out { align-self: flex-end; background: #d9fdd3; }
.wa-msg--failed { background: var(--alert-soft); }
.wa-msg__body { white-space: pre-line; }
.wa-media { display: block; margin-bottom: .3rem; }
.wa-media__img { display: block; max-width: min(280px, 100%); max-height: 320px; border-radius: 8px; }
.wa-media__audio { width: 280px; max-width: 100%; height: 40px; }
.wa-card .wa-msg { max-width: 92%; }
.wa-media__video { max-width: min(320px, 100%); border-radius: 8px; }
.wa-media__file { padding: .5rem .6rem; border-radius: 8px; background: rgb(0 0 0 / 5%); font-size: .9rem; }
.wa-media__file .muted { margin-left: .3rem; }
.wa-media__alt { display: block; font-size: .75rem; margin: -.15rem 0 .3rem; }
.wa-reply textarea { width: 100%; }
.wa-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.wa-template { margin-top: .5rem; }
.wa-template > summary { cursor: pointer; font-weight: 600; padding: .25rem 0; }
.wa-template form { margin-top: .5rem; }
.wa-template .note { white-space: pre-line; }
.wa-send { margin-left: auto; }
.wa-attach { position: relative; overflow: hidden; }
.wa-attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.wa-attach:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.wa-attachment { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .5rem .7rem; border: 1px dashed var(--line); border-radius: 8px; font-size: .9rem; }
.wa-attachment audio { height: 36px; max-width: 100%; }
.wa-emoji { position: relative; }
.wa-emoji > summary { list-style: none; }
.wa-emoji > summary::-webkit-details-marker { display: none; }
.wa-emoji__grid { position: absolute; bottom: calc(100% + .4rem); left: 0; z-index: 20; display: grid; grid-template-columns: repeat(8, 2.1rem); gap: .15rem; padding: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 28px rgb(16 24 40 / 18%); }
.wa-emoji__grid button { font-size: 1.3rem; line-height: 1; padding: .25rem; border: 0; background: none; border-radius: 6px; cursor: pointer; }
.wa-emoji__grid button:hover, .wa-emoji__grid button:focus-visible { background: var(--bg); }
[data-whatsapp-record].is-recording { background: var(--alert); border-color: var(--alert); color: #fff; }
@media (max-width: 480px) { .wa-emoji__grid { grid-template-columns: repeat(6, 2.1rem); } }
.wa-msg__meta { display: block; margin-top: .2rem; font-size: .75rem; color: var(--muted); }
.wa-msg--failed .wa-msg__meta { color: var(--alert); }
.wa-msg__meta a { color: inherit; }
.wa-snippet { max-width: 40ch; }
.is-unread td:first-child a { font-weight: 700; }
.note { background: #faf8f3; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; margin-top: .3rem; }
.contact { display: flex; justify-content: space-between; gap: .5rem; margin: .3rem 0; overflow-wrap: anywhere; }
.tasks { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.task { display: flex; flex-direction: column; gap: .1rem; }
.task--done strong { text-decoration: line-through; color: var(--muted); }
.task--late strong, .task--late .muted:first-of-type { color: var(--alert); }
.tasks--page .task { flex-direction: row; justify-content: space-between; align-items: center; gap: 1rem; }
.tasks--page .task > div { display: flex; flex-direction: column; gap: .15rem; }
.tasks--page .task--late { border-left: 4px solid var(--alert); }

/* Emails enviados */
.mails { list-style: none; margin: 0; padding: 0; }
.mail { padding: .85rem 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .25rem; }
.mail:first-child { border-top: 0; padding-top: 0; }
.mail p { margin: 0; overflow-wrap: anywhere; }
.mail__head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.mail--failed { border-left: 4px solid var(--alert); padding-left: .75rem; }
.mail__error { color: var(--alert); font-size: .9em; }
.mail__content summary { list-style: none; font-size: .9rem; }
.mail__content summary::-webkit-details-marker { display: none; }
.mail__body { margin-top: .4rem; padding: .7rem .9rem; background: #faf8f3; border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; overflow-wrap: anywhere; }
.status--sent { background: var(--ok-soft); color: var(--ok); }
.status--failed { background: var(--alert-soft); color: var(--alert); }

/* Agenda */
.agenda { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 1.25rem; align-items: start; }
.agenda__center header { display: flex; flex-direction: column; gap: .1rem; margin-bottom: .5rem; }
.agenda__center h2 { margin: 0; }
.agenda__center header p { margin: 0; }
.agenda__address { font-style: normal; }
.agenda__hours { display: grid; grid-template-columns: auto 1fr; gap: .4rem .9rem; margin: .75rem 0 0; font-size: .88rem; }
.agenda__hours dt { color: var(--muted); }
.agenda__hours dd { margin: 0; display: flex; flex-direction: column; }
.agenda__people { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; }
.agenda__person { padding: .75rem 0; border-top: 1px solid var(--line); }
.agenda__person p { margin: .3rem 0 0; }

/* Tablas */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .65rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }
.table td .tags { margin-top: .25rem; }
.table .check { width: 1%; padding-right: 0; }
.table .check input { margin: 0; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.is-inactive td { color: var(--muted); }
.stages input[type=number] { width: 5rem; }
.stages__order { white-space: nowrap; }
.stages__order .linkbtn { font-size: 1.1rem; padding: 0 .3rem; }
.stages__new input:placeholder-shown { background: var(--bg); }
.campaigns { margin-top: 1.5rem; }
.campaigns h2 { font-size: 1.1rem; margin: 0; }
.campaigns__actions { display: flex; gap: .8rem; align-items: flex-start; }
.confirm summary { list-style: none; }
.confirm summary::-webkit-details-marker { display: none; }
.confirm[open] form { margin-top: .4rem; max-width: 18rem; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; }

[hidden] { display: none !important; }

@media (max-width: 1100px) {
  .deal-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .deal-grid > section { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 720px) {
  .main { padding: 1rem; }
  .deal-grid { grid-template-columns: minmax(0, 1fr); }
  .row { flex-wrap: wrap; }
  .topbar { gap: .5rem 1rem; padding: .6rem 1rem; }
  .usermenu__role { display: none; }
  .col { flex-basis: 82vw; }
  .tasks--page .task { flex-direction: column; align-items: stretch; }
}
.task__due summary { list-style: none; font-size: .85rem; }
.task__due summary::-webkit-details-marker { display: none; }
.task__due form { margin-top: .4rem; }

/* Bandeja de WhatsApp a dos paneles */
.wa-inbox { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; height: calc(100dvh - 100px); min-height: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.wa-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.wa-list__head { display: flex; flex-direction: column; gap: .6rem; padding: .9rem 1rem .75rem; border-bottom: 1px solid var(--line); }
.wa-list__head h1 { font-size: 1.3rem; }
.wa-list__search { width: 100%; }
.wa-list__items { flex: 1; overflow-y: auto; }
.wa-list__empty { padding: 1.5rem 1rem; text-align: center; }
.wa-chat { display: flex; flex-direction: column; gap: .1rem; padding: .65rem 1rem; border-bottom: 1px solid var(--line); color: var(--text); }
.wa-chat[hidden] { display: none; }
.wa-chat:hover { background: var(--bg); text-decoration: none; }
.wa-chat[aria-current] { background: var(--accent-soft); }
.wa-chat__top, .wa-chat__bottom { display: flex; justify-content: space-between; align-items: center; gap: .5rem; min-width: 0; }
.wa-chat__name, .wa-chat__snippet, .wa-chat__deal { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wa-chat__name { font-weight: 600; }
.wa-chat__time { flex-shrink: 0; font-size: .78rem; color: var(--muted); }
.wa-chat__snippet { font-size: .88rem; color: var(--muted); }
.wa-chat__deal { font-size: .76rem; color: var(--muted); }
.wa-chat--unread .wa-chat__time { color: var(--ok); font-weight: 600; }
.wa-chat--unread .wa-chat__snippet { color: var(--text); font-weight: 500; }
.wa-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #efeae2; }
.wa-pane__empty { margin: auto; padding: 2rem; color: var(--muted); text-align: center; }
.wa-pane__head { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.wa-pane__who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wa-pane__who > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-pane__back { display: none; }
.wa-pane__body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wa-pane .wa-thread { flex: 1; max-height: none; margin: 0; border-radius: 0; padding: 1rem clamp(.75rem, 5%, 3rem); }
.wa-pane .wa-msg { max-width: min(65%, 560px); }
.wa-pane .wa-reply, .wa-pane__body > p { margin: 0; padding: .75rem 1rem; background: var(--surface); border-top: 1px solid var(--line); }
.wa-pane .wa-reply { gap: .5rem; }
.wa-pane .wa-template { margin: 0; padding: .5rem 1rem; background: var(--surface); border-top: 1px solid var(--line); }
.wa-pane .wa-template .note { max-height: 30vh; overflow-y: auto; }
@media (max-width: 800px) {
  .wa-inbox { grid-template-columns: 1fr; }
  .wa-inbox--open .wa-list, .wa-inbox:not(.wa-inbox--open) .wa-pane { display: none; }
  .wa-pane__back { display: inline-block; }
  .wa-pane .wa-msg { max-width: 85%; }
}
