/* CHAYTU — composición fiel al modelo de referencia, sin sustituir la marca. */
:root {
  --bg: #080f13;
  --panel: #101b21;
  --panel-2: #19292e;
  --border: #2b3b42;
  --text: #e5ebed;
  --muted: #94a0a4;
  --emerald: #54d8a4;
  --emerald-dark: #1a785b;
  --edge: clamp(16px, 4.36vw, 30px);
  --card-pad: clamp(18px, 4.65vw, 32px);
}
button, input, select { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
button:focus-visible, a:focus-visible, select:focus-visible {
  outline: 2px solid #96ebc9;
  outline-offset: 3px;
}
.ui-icon {
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
  pointer-events: none;
}
.icon-sprite { position: absolute; overflow: hidden; pointer-events: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.app-shell {
  background-color: #0b1317;
  background-image:
    linear-gradient(rgba(80, 124, 117, .105) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 124, 117, .105) 1px, transparent 1px),
    radial-gradient(ellipse at 8% 18%, rgba(16, 94, 66, .18), transparent 55%),
    linear-gradient(135deg, #0b1517, #0d151a 70%, #0b1715);
  background-size: 77px 77px, 77px 77px, auto, auto;
}
.topbar {
  background: rgba(10, 16, 20, .94);
  border-bottom: 1px solid #28383c;
  padding: 24px var(--edge);
  gap: 22px;
}
.brand { gap: 19px; min-width: 0; }
.brand-mark {
  width: 65px;
  height: 65px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #71d7b3;
  flex-shrink: 0;
}
.brand-logo { width: 64px; height: 64px; filter: drop-shadow(0 0 13px #37c99725); }
.brand strong { font: 700 28px var(--sans); letter-spacing: .055em; }
.brand small { font: 400 17px var(--sans); margin-top: 5px; color: #909a9e; }
.topbar-actions { gap: 12px; }
.ghost-button, .secondary-button, .subtle-button {
  font: 400 14px var(--sans);
  color: #b5c1c4;
  border: 1px solid #35444c;
  background: #0b1419;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 13px;
}
.ghost-button:hover, .secondary-button:hover, .subtle-button:hover {
  border-color: #66bfa1;
  background: #17382b;
  color: #e2fff1;
}
.topbar-actions .ghost-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.current-user {
  display: grid;
  place-items: center;
  width: 56px;
  height: 54px;
  min-width: 56px;
  border: 1px solid #35444c;
  border-radius: 9px;
  background: #0c151b;
  cursor: pointer;
}
.current-user .avatar { width: 34px; height: 34px; font-size: 16px; }
.current-user #top-alias { display: none; }
.status-dot { width: 10px; height: 10px; box-shadow: 0 0 16px #36df9a88; }
.unread-badge {
  min-width: 34px;
  min-height: 34px;
  border: 0;
  padding: 3px 8px;
  background: #193f32;
  color: #a9e8cf;
  font: 600 18px var(--sans);
}
.missed-calls-trigger .status-dot { width: 9px; height: 9px; margin-right: -4px; }
.dashboard { max-width: 1540px; grid-template-columns: 210px minmax(0, 1fr); }
.sidebar { border-right-color: #273b3a; background: #0a131675; }
.content { padding: 42px var(--edge) 30px; min-width: 0; }
.room-navigation {
  display: grid;
  grid-template-columns: .95fr 1fr 1.1fr;
  gap: 5px;
  margin-bottom: 28px;
  padding: 5px;
  border: 1px solid #354348;
  border-radius: 22px;
  background: linear-gradient(115deg, #243a36b8, #253138cf);
  box-shadow: 0 5px 26px #0002;
}
.room-nav-button {
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  min-height: 63px;
  padding: 10px;
  color: #aab7b9;
  font: 400 19px var(--sans);
  justify-content: center;
  gap: 12px;
  white-space: nowrap;
  min-width: 0;
}
.room-nav-button .ui-icon { font-size: 26px; }
.room-nav-button.active {
  border-color: #71bba3;
  color: #e4f6ed;
  background: linear-gradient(120deg, #295946, #234639);
  box-shadow: 0 0 0 5px #6de1b611, inset 0 0 25px #60dbac12, 0 0 26px #55c39b22;
}
.room-nav-button span { font: 600 8px var(--mono); color: #b7f6d6; }
.content-heading { gap: 20px; margin-bottom: 35px; }
#comms-view > .content-heading {
  position: relative;
  padding-top: 48px;
  padding-bottom: 44px;
  margin: 0;
  border-top: 1px solid #30403e;
}
.eyebrow { color: #8ec7b5; font: 600 13px var(--mono); letter-spacing: .17em; margin: 12px 0 18px; }
.content-heading h2 { font: 700 40px var(--sans); letter-spacing: -.025em; margin: 0; }
.connection-badge { font: 500 11px var(--mono); color: #96c8b6; gap: 10px; }
#comms-view > .content-heading .connection-badge { position: absolute; right: 0; top: 44px; }
.comms-grid { grid-template-columns: minmax(0, 1.6fr) minmax(270px, 1fr); gap: 16px; align-items: start; }
.panel {
  background: linear-gradient(145deg, #121c22ed, #111c21ed);
  border: 1px solid #2d3d43;
  border-radius: 15px;
  box-shadow: 0 0 0 1px #87b9a505, 0 14px 32px #0002;
}
.panel-header { padding: 25px var(--card-pad); border-bottom-color: #2b3d41; gap: 14px; }
.panel-header strong { font: 600 16px var(--sans); letter-spacing: .08em; }
.panel-header small { font: 400 13px var(--sans); color: #8d9b9f; margin-top: 9px; line-height: 1.3; }
.chat-panel { min-height: 0; overflow: hidden; }
.chat-panel-header > div { min-width: 0; }
.chat-panel-header .secondary-button {
  white-space: nowrap;
  color: #a7dfc5;
  background: #133c2b90;
  border-color: #3b6555;
  box-shadow: inset 0 0 14px #2d715423;
}
.conversation-toolbar {
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 15px var(--card-pad);
  gap: 10px;
}
.conversation-toolbar select { border-radius: 7px; font-size: 12px; padding: 12px; }
#comms-view:not(.has-conversations) .conversation-toolbar { display: none; }
#comms-view:not(.has-conversation) .chat-history { display: none; }
.chat-history { max-height: 450px; min-height: 260px; padding: 24px var(--card-pad); }
.message { font-size: 14px; border-radius: 8px; }
.empty-state { font-size: 12px; color: #9dafb0; line-height: 1.6; }
.chat-selection-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 24px var(--card-pad);
  text-align: center;
}
#comms-view.has-conversation .chat-selection-hint { display: none; }
.contacts-panel { padding-bottom: 10px; }
.contacts-header { display: flex; padding-top: 16px; padding-bottom: 10px; border: 0; }
.contacts-header > strong { flex-shrink: 0; }
.contact-search { position: relative; padding: 0; flex: 1; min-width: 0; }
.contact-search input { width: 100%; padding: 12px 42px 12px 14px; border-radius: 8px; background: #080f14; font: 400 16px var(--sans); }
.contact-search-submit {
  display: grid;
  place-items: center;
  position: absolute;
  top: 1px;
  bottom: 1px;
  right: 1px;
  width: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #91a7a5;
  cursor: pointer;
}
.contact-search-submit:hover { color: #a0f4cd; background: #16392b; }
.contact-list { padding: 0 var(--card-pad); }
.contacts-panel > .setting-status { margin: 0 var(--card-pad); }
.setting-status:empty { display: none; }
.contact-section { border-color: #2b3b40; }
.contact-section-title { padding-left: var(--card-pad); padding-right: var(--card-pad); }
.contact-row { min-height: 76px; padding: 12px 0; border: 0; gap: 10px; }
.contact-info { gap: 14px; }
.contact-info strong { font: 600 17px var(--sans); }
.contact-info small { font: 400 12px var(--sans); color: #9aabaa; margin-top: 3px; }
.contact-info .avatar { width: 44px; height: 44px; font: 600 18px var(--sans); background: #194936; border-color: #47775e; }
.contact-action { min-height: 38px; padding: 7px 9px; border-radius: 8px; font: 400 12px var(--sans); }
.contact-empty { font-size: 12px; color: #93a4a5; margin: 17px 0; }
.composer-panel {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 16px;
  background: #101b20f5;
  backdrop-filter: blur(12px);
  box-shadow: 0 -10px 32px #06101445;
}
.chat-form { padding: 22px 25px 12px; gap: 12px; border: 0; }
.chat-form input { padding: 15px; border: 1px solid #34444c; border-radius: 8px; background: #070e13; font: 400 15px var(--mono); }
.chat-form input:focus { border-color: #7bcaa7; box-shadow: 0 0 0 2px #59d6a416; }
.send-button { width: 56px; min-height: 56px; border-radius: 9px; background: linear-gradient(135deg, #238f65, #178a68); display: grid; place-items: center; font-size: 25px; }
.chat-footer { gap: 10px; padding: 0 25px 20px; font-size: 13px; align-items: center; }
.timer-setting-btn { min-height: 38px; padding: 9px 12px; border-radius: 9px; font: 400 14px var(--mono); background: #233139; color: #c9d4d8; border: 1px solid transparent; }
.timer-setting-btn.active { background: #2a3a42; color: #edf6f7; border-color: #43565f; }
.poll-status { font-size: 10px; max-width: 48%; line-height: 1.5; }
.independent-voice-panel { border-radius: 15px; }
.phone-control { border-radius: 13px; }
.settings-card, .inbox-panel { overflow-wrap: anywhere; }
.app-footer { font-size: 9px; color: #8ba3a1; border-top-color: #284039; }
/* El modo transmisión naranja debe prevalecer sobre el tema, igual que colgar en rojo. */
.walkie-talk-button.transmitting { background: #d07b29; border-color: #ffc166; color: #fff; }
@media (max-width: 1100px) and (min-width: 851px) {
  .topbar { flex-wrap: wrap; }
  .comms-grid { grid-template-columns: 1fr; }
  .room-nav-button { font-size: 16px; }
}
@media (max-width: 850px) {
  .dashboard { display: block; min-height: 0; }
  .sidebar { display: none; }
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1.46fr) minmax(0, .71fr) minmax(0, 1fr);
    column-gap: 16px;
    row-gap: 28px;
    padding-top: 20px;
    padding-bottom: 24px;
    align-items: center;
  }
  .topbar-actions { display: contents; }
  .brand { grid-column: 1 / 3; grid-row: 1; }
  .current-user { grid-column: 3; grid-row: 1; justify-self: end; }
  #missed-calls-trigger { grid-column: 1; grid-row: 2; }
  #inbox-trigger { grid-column: 2; grid-row: 2; }
  #settings-trigger { grid-column: 3; grid-row: 2; }
  #node-logout { grid-column: 3; grid-row: 3; justify-self: end; }
  #install-app-button-top { grid-column: 1 / 3; grid-row: 3; justify-self: start; }
  .topbar-actions .ghost-button { font-size: clamp(11px, 2.9vw, 20px); min-width: 0; min-height: 49px; padding: 9px 12px; white-space: nowrap; }
  .topbar-actions #settings-trigger { gap: 8px; }
  #settings-trigger .ui-icon { width: 20px; height: 20px; }
  .content { padding: 50px var(--edge) 0; }
  .room-nav-button { min-height: 64px; font-size: clamp(14px, 3.49vw, 24px); }
  .room-nav-button .ui-icon { width: 33px; height: 33px; }
  #comms-view > .content-heading { padding-top: 51px; padding-bottom: 52px; }
  .eyebrow { font-size: clamp(11px, 2.62vw, 18px); }
  .content-heading h2 { font-size: clamp(30px, 6.7vw, 46px); }
  .connection-badge { font-size: clamp(10px, 2vw, 14px); }
  .comms-grid { display: flex; flex-direction: column; gap: 14px; }
  .chat-panel, .right-stack { width: 100%; }
  .right-stack { display: block; }
  .chat-panel-header { min-height: 141px; padding-top: 30px; padding-bottom: 30px; }
  .panel-header strong { font-size: clamp(14px, 3.2vw, 22px); }
  .panel-header small { font-size: clamp(12px, 2.62vw, 18px); }
  .chat-panel-header .secondary-button { font-size: clamp(13px, 2.62vw, 18px); min-height: 50px; }
  .contacts-header { gap: 28px; }
  .contact-search input { font-size: clamp(15px, 3.2vw, 22px); min-height: 51px; }
  .contact-row { min-height: 87px; }
  .contact-info .avatar { width: 54px; height: 54px; font-size: 24px; }
  .contact-info strong { font-size: clamp(16px, 3.2vw, 22px); }
  .contact-info small { font-size: clamp(11px, 2.62vw, 18px); }
  .contact-action { font-size: clamp(12px, 2.3vw, 16px); min-height: 40px; }
  .chat-form { padding: 24px 25px 13px; }
  .chat-form input { font-size: clamp(13px, 3.2vw, 22px); padding: 16px; }
  .send-button { width: 56px; min-height: 64px; }
  .chat-footer { flex-wrap: wrap; font-size: clamp(11px, 2.62vw, 18px); padding-bottom: 23px; }
  .chat-footer > span:first-child { white-space: nowrap; }
  .timer-setting-btn { min-height: 43px; font-size: 18px; }
  .poll-status { max-width: none; width: 100%; font-size: 10px; margin: 0; }
  .app-footer { padding-top: 15px; padding-bottom: max(15px, env(safe-area-inset-bottom)); }
}
@media (max-width: 580px) {
  .topbar { column-gap: 8px; row-gap: 16px; }
  .brand { gap: 10px; }
  .brand-mark { width: 48px; height: 54px; }
  .brand-logo { width: 48px; height: 48px; }
  .brand strong { font-size: 23px; }
  .brand small { font-size: 12px; }
  .current-user { width: 48px; min-width: 48px; height: 48px; }
  .topbar-actions .ghost-button { padding: 7px 8px; gap: 4px; min-height: 44px; }
  .unread-badge { min-width: 24px; min-height: 26px; font-size: 13px; padding: 2px 5px; }
  .missed-calls-trigger .status-dot { display: none; }
  #settings-trigger .ui-icon { width: 15px; height: 15px; }
  .content { padding-top: 27px; }
  .room-navigation { border-radius: 15px; gap: 2px; padding: 4px; margin-bottom: 20px; }
  .room-nav-button { min-height: 48px; padding: 6px 4px; border-radius: 11px; gap: 6px; font-size: 13px; }
  .room-nav-button .ui-icon { width: 22px; height: 22px; }
  #comms-view > .content-heading { padding-top: 36px; padding-bottom: 30px; }
  #comms-view > .content-heading .connection-badge { top: 23px; }
  .eyebrow { margin: 14px 0 15px; letter-spacing: .1em; }
  .content-heading h2 { font-size: 30px; }
  .chat-panel-header { min-height: 114px; gap: 10px; padding: 21px var(--card-pad); }
  .chat-panel-header .secondary-button { min-height: 44px; padding: 9px; }
  .contacts-header { gap: 14px; padding: 15px var(--card-pad) 8px; }
  .contacts-header strong { font-size: 14px; }
  .contact-search input { min-height: 44px; padding-left: 10px; }
  .contact-info { gap: 9px; }
  .contact-info .avatar { width: 41px; height: 41px; font-size: 19px; }
  .contact-info strong { font-size: 16px; }
  .contact-row { gap: 6px; min-height: 70px; }
  .contact-action { font-size: 11px; padding: 7px; min-height: 38px; }
  .chat-form { padding: 15px 15px 10px; gap: 8px; }
  .chat-form input { font-size: 13px; padding: 12px; }
  .send-button { min-height: 49px; width: 47px; }
  .chat-footer { padding: 0 15px 15px; gap: 7px; font-size: 12px; }
  .timer-setting-btn { font-size: 13px; padding: 8px 10px; min-height: 38px; }
  .conversation-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .conversation-toolbar label { display: none; }
  .conversation-builder .settings-input { margin-left: 0; margin-right: 0; }
  .independent-voice-panel .panel-header { flex-wrap: wrap; }
}
@media (max-width: 359px) {
  .topbar-actions .ghost-button { font-size: 11px; padding: 6px; }
  .brand small { font-size: 11px; }
  .room-nav-button { font-size: 11px; }
  .room-nav-button .ui-icon { width: 18px; }
}
@media (max-width: 580px) and (max-height: 950px) {
  .composer-panel { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
