:root{
  --brand-900:#23205a;
  --brand-800:#2f2b70;
  --brand-700:#3a3485; /* logo main */
  --brand-600:#4a45a0;
  --brand-500:#5b56b3;
  --brand-300:#c0bdd4;
  --brand-200:#d9d7ea;
  --brand-100:#eef0ff;
  --text:#1b1f2a;
  --muted:#667085;
  --bg:#f5f7ff;
  --card:rgba(255,255,255,0.78);
  --card-strong:rgba(255,255,255,0.88);
  --stroke:rgba(58,52,133,0.14);
  --stroke-strong:rgba(58,52,133,0.22);
  --shadow: 0 18px 60px rgba(20, 28, 60, 0.14);
  --shadow-soft: 0 12px 28px rgba(20, 28, 60, 0.10);
  --radius:22px;
  --radius-sm:16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(58,52,133,0.18), rgba(58,52,133,0) 65%),
    radial-gradient(800px 500px at 20% 0%, rgba(91,86,179,0.16), rgba(91,86,179,0) 60%),
    radial-gradient(900px 700px at 60% 110%, rgba(58,52,133,0.10), rgba(58,52,133,0) 60%),
    linear-gradient(180deg, #ffffff 0%, #f2f6ff 30%, #eaf0ff 100%);
  -webkit-text-size-adjust: 100%;
  overflow-x:hidden;
}

a{color:var(--brand-700);text-decoration:none}
a:hover{text-decoration:underline}

.page{
  min-height:100%;
  position:relative;
  padding:26px 18px 40px;
}

.bg-layer{
  position:absolute;
  inset:0;
  pointer-events:none;
  overflow:hidden;
}

.bg-layer:before{
  content:"";
  position:absolute;
  left:-10%;
  top:8%;
  width:120%;
  height:70%;
  background:
    radial-gradient(circle at 20% 20%, rgba(58,52,133,0.10), rgba(58,52,133,0) 60%),
    radial-gradient(circle at 80% 35%, rgba(91,86,179,0.12), rgba(91,86,179,0) 55%),
    radial-gradient(circle at 40% 80%, rgba(58,52,133,0.08), rgba(58,52,133,0) 60%);
  filter: blur(6px);
  opacity:0.9;
  transform: rotate(-2deg);
}

.bg-layer:after{
  content:"";
  position:absolute;
  inset:0;
  background-image: radial-gradient(rgba(58,52,133,0.12) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity:0.10;
  transform: translate3d(0,0,0);
  animation: floatDots 16s ease-in-out infinite;
}

@keyframes floatDots{
  0%{transform: translate3d(0,0,0)}
  50%{transform: translate3d(10px, -8px,0)}
  100%{transform: translate3d(0,0,0)}
}

.nav{
  max-width:1240px;
  margin:0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 18px;
  position:relative;
  z-index:120;
  background: rgba(255,255,255,0.62);
  border:1px solid rgba(58,52,133,0.10);
  border-radius: 30px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
}

.brand img{
  width:54px;
  height:54px;
  object-fit:contain;
  filter: drop-shadow(0 6px 18px rgba(20, 28, 60, 0.10));
}

.brand-title{
  display:flex;
  flex-direction:column;
  line-height:1.05;
}

.brand-title b{
  font-size:20px;
  letter-spacing:-0.03em;
  font-weight:800;
}

.brand-title span{
  color:var(--muted);
  font-size:12px;
  letter-spacing:0.04em;
  text-transform:uppercase;
}

.nav-actions{
  display:flex;
  gap:10px;
  align-items:center;
  flex:1 1 auto;
  justify-content:flex-end;
  flex-wrap:nowrap;
  min-width:0;
}

.nav-primary{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex:1 1 auto;
  min-width:0;
}

.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 16px;
  border-radius:999px;
  background: rgba(255,255,255,0.78);
  border:1px solid var(--stroke);
  box-shadow: 0 8px 18px rgba(20, 28, 60, 0.06);
  backdrop-filter: blur(10px);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  position:relative;
  white-space: nowrap;
  font-weight:600;
  color: rgba(27,31,42,0.88);
}

.pill--files{
  min-width:auto;
}

.nav-account{
  position:relative;
  flex:0 0 auto;
}

.nav-account summary{
  list-style:none;
}

.nav-account summary::-webkit-details-marker{
  display:none;
}

.nav-account__toggle{
  gap:8px;
  cursor:pointer;
}

.nav-account[open] .nav-account__toggle{
  border-color: var(--stroke-strong);
  box-shadow: 0 14px 30px rgba(20, 28, 60, 0.10);
}

.nav-account__toggle svg{
  transition: transform .15s ease;
}

.nav-account[open] .nav-account__toggle svg{
  transform: rotate(180deg);
}

.nav-account__menu{
  position:absolute;
  top: calc(100% + 10px);
  right:0;
  min-width: 190px;
  padding:8px;
  border-radius: 18px;
  border:1px solid rgba(58,52,133,0.12);
  background: rgba(255,255,255,0.96);
  box-shadow: 0 18px 40px rgba(20, 28, 60, 0.12);
  backdrop-filter: blur(14px);
  display:flex;
  flex-direction:column;
  gap:4px;
  z-index: 160;
}

.nav-account__item{
  display:flex;
  align-items:center;
  padding:11px 12px;
  border-radius: 12px;
  color: var(--text);
  font-weight:600;
}

.nav-account__item:hover{
  background: rgba(58,52,133,0.08);
  text-decoration:none;
}

.nav-account__item--danger{
  color: #8b2733;
}

.nav-account__item--danger:hover{
  background: rgba(214, 66, 66, 0.08);
}

@media (min-width: 921px){
  .brand{
    gap:10px;
    flex:0 0 auto;
  }

  .brand img{
    width:48px;
    height:48px;
  }

  .brand-title b{
    font-size:18px;
  }

  .brand-title span{
    font-size:11px;
  }

  .nav-actions{
    gap:10px;
  }

  .pill{
    padding:9px 13px;
    font-size:15px;
  }
}

.pill:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(20, 28, 60, 0.10);
  border-color: var(--stroke-strong);
  text-decoration:none;
}

.pill-badge{
  position:absolute;
  top:-7px;
  right:-7px;
  z-index:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:20px;
  height:20px;
  padding:0 6px;
  border-radius:999px;
  background: linear-gradient(180deg, var(--brand-700) 0%, var(--brand-900) 100%);
  color:#fff;
  font-size:12px;
  font-weight:800;
  line-height:1;
  border:2px solid rgba(255,255,255,0.92);
  box-shadow: 0 12px 26px rgba(35,32,90,0.22);
  pointer-events:none;
}

.container{
  max-width:1100px;
  margin:24px auto 0;
}

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:18px;
}

@media (min-width: 920px){
  .grid.two{
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.card{
  position:relative;
  overflow:hidden;
  background: linear-gradient(180deg, var(--card-strong) 0%, rgba(247,249,255,0.80) 100%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding:24px;
}

.card:before{
  content:"";
  position:absolute;
  inset:0 auto auto 0;
  width:100%;
  height:84px;
  background: linear-gradient(180deg, rgba(255,255,255,0.36), rgba(255,255,255,0));
  pointer-events:none;
}

.card h1, .card h2{
  margin:0 0 8px 0;
  letter-spacing:-0.04em;
}

.card p{
  margin:6px 0;
  color: var(--muted);
  line-height:1.65;
}

.footer{
  text-align:center;
  color: rgba(102,112,133,0.9);
  margin-top: 24px;
  font-size: 13px;
}

.form{
  display:flex;
  flex-direction:column;
  gap:14px;
  margin-top: 12px;
}

.row{
  display:grid;
  gap:12px;
}

@media (min-width: 700px){
  .row.two{
    grid-template-columns: 1fr 1fr;
  }
}

label{
  display:block;
  font-size:13px;
  color: rgba(27,31,42,0.78);
  margin-bottom:6px;
}

.sr-only{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

.input, input[type="text"], input[type="email"], input[type="password"], input[type="datetime-local"], input[type="number"], textarea{
  width:100%;
  padding:12px 14px;
  border-radius: 14px;
  border:1px solid rgba(58,52,133,0.18);
  background: rgba(255,255,255,0.86);
  outline:none;
  transition: box-shadow .15s ease, border-color .15s ease, transform .10s ease;
  font-size: 15px;
}

textarea{min-height:110px; resize:vertical}

.input:focus, input:focus, textarea:focus{
  border-color: rgba(58,52,133,0.42);
  box-shadow: 0 0 0 4px rgba(58,52,133,0.14);
}

.help{
  font-size:12px;
  color: var(--muted);
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:12px 18px;
  border-radius: 14px;
  border:1px solid rgba(58,52,133,0.25);
  cursor:pointer;
  font-weight:700;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  user-select:none;
}

.btn-icon{
  width:44px;
  height:44px;
  padding:0;
  gap:0;
  flex:0 0 44px;
}

.btn-icon svg{ display:block; }

.btn-primary{
  background: linear-gradient(180deg, var(--brand-700) 0%, var(--brand-900) 100%);
  color:white;
  border:none;
  box-shadow: 0 16px 34px rgba(35,32,90,0.28);
}

.btn-primary:hover{transform: translateY(-1px); filter: brightness(1.03)}
.btn-primary:active{transform: translateY(0px); filter: brightness(0.99)}

.btn-ghost{
  background: rgba(255,255,255,0.72);
}

.btn-ghost:hover{
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(20, 28, 60, 0.08);
}

.btn-danger{
  background: linear-gradient(180deg, #d64242 0%, #a61f1f 100%);
  color:white;
  border:none;
  box-shadow: 0 16px 34px rgba(166,31,31,0.18);
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:7px 10px;
  border-radius:999px;
  border:1px solid rgba(58,52,133,0.18);
  background: rgba(255,255,255,0.65);
  font-size: 12px;
  color: rgba(27,31,42,0.75);
}

.hr{
  height:1px;
  background: rgba(58,52,133,0.14);
  margin: 16px 0;
}

.alert{
  padding:12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(58,52,133,0.18);
  background: rgba(255,255,255,0.78);
  margin: 12px 0;
}

.alert.success{
  border-color: rgba(46, 165, 105, 0.35);
  background: rgba(46, 165, 105, 0.08);
}

.alert.error{
  border-color: rgba(214, 66, 66, 0.35);
  background: rgba(214, 66, 66, 0.07);
}

.small{font-size:13px;color:var(--muted)}

.list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.item,
.list-item{
  padding:14px;
  border-radius: 16px;
  border:1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.70);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  box-shadow: 0 10px 24px rgba(20, 28, 60, 0.06);
}

.item-title{
  font-weight:700;
}

.item-sub{
  font-size:13px;
  color:var(--muted);
}

.avatar{
  width:40px;height:40px;border-radius:999px;object-fit:cover;border:1px solid rgba(58,52,133,0.18);
  background: rgba(255,255,255,0.9);
}

.item-title--row{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.item-title__text{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.presence-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.55);
  font-size:12px;
  line-height:1;
  color: var(--muted);
  flex:0 0 auto;
}

.presence-pill .presence-dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:#b9becd;
  box-shadow: 0 0 0 3px rgba(185,190,205,0.16);
}

.presence-pill--online{
  border-color: rgba(46, 165, 105, 0.28);
  background: rgba(46, 165, 105, 0.10);
  color: rgba(23, 121, 73, 0.95);
}

.presence-pill--online .presence-dot{
  background:#2ea569;
  box-shadow: 0 0 0 3px rgba(46,165,105,0.16);
}

.chat-wrap{
  display:grid;
  grid-template-columns: 1fr;
  gap:14px;
}

@media(min-width: 980px){
  .chat-wrap{
    grid-template-columns: 1fr 320px;
    align-items:start;
  }
}

.chat-box{
  height: 520px;
  overflow:auto;
  padding: 14px;
  border-radius: 18px;
  border:1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.6);
}

.msg{
  display:flex;
  gap:10px;
  margin-bottom: 12px;
}

.msg .bubble{
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(58,52,133,0.12);
  background: rgba(255,255,255,0.85);
  box-shadow: 0 10px 24px rgba(20, 28, 60, 0.08);
}

.msg.me{
  justify-content:flex-end;
}

.msg.me .bubble{
  background: linear-gradient(180deg, rgba(58,52,133,0.16) 0%, rgba(58,52,133,0.08) 100%);
  border-color: rgba(58,52,133,0.18);
}

.msg .meta{
  font-size:12px;
  color: var(--muted);
  margin-bottom: 6px;
  display:flex;
  gap:10px;
  align-items:center;
}

.attachments{
  margin-top: 8px;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.attachment{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius: 14px;
  border:1px solid rgba(58,52,133,0.16);
  background: rgba(255,255,255,0.72);
  font-size: 13px;
}

.attachment img{
  width:46px;height:46px;border-radius: 12px;object-fit:cover;border:1px solid rgba(58,52,133,0.16);
}

.video-stage{
  display:grid;
  grid-template-columns: 1fr;
  gap:14px;
}

@media(min-width: 980px){
  .video-stage{
    grid-template-columns: 1fr 340px;
  }
}

.video-grid{
  display:grid;
  gap:12px;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media(min-width: 600px){
  .video-grid{grid-template-columns: repeat(2, minmax(0, 1fr));}
}
@media(min-width: 920px){
  .video-grid{grid-template-columns: repeat(3, minmax(0, 1fr));}
}

.video-tile{
  position:relative;
  border-radius: 18px;
  overflow:hidden;
  border:1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.55);
  box-shadow: 0 18px 50px rgba(20,28,60,0.10);
  min-height: 180px;
}

.video-tile video{
  width:100%;
  height:100%;
  object-fit:cover;
  background: #0b1020;
}

.video-tile .label{
  position:absolute;
  left:10px;
  bottom:10px;
  padding:6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.35);
  color:white;
  font-size:12px;
  backdrop-filter: blur(6px);
}

.video-controls{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  justify-content:center;
  margin-top: 12px;
}

.ctrl{
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid rgba(58,52,133,0.18);
  background: rgba(255,255,255,0.70);
  cursor:pointer;
  font-weight:700;
  transition: transform .15s ease;
}

.ctrl:hover{transform: translateY(-1px)}

.ctrl.on{
  background: linear-gradient(180deg, rgba(58,52,133,0.18) 0%, rgba(58,52,133,0.10) 100%);
}

.sidebar{
  border-radius: 18px;
  border:1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.60);
  padding: 14px;
}

.tabs{
  display:flex;
  gap:10px;
  margin-bottom: 10px;
}

.tab{
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.65);
  cursor:pointer;
  font-weight:700;
  font-size: 13px;
}

.tab.active{
  background: linear-gradient(180deg, rgba(58,52,133,0.18) 0%, rgba(58,52,133,0.10) 100%);
  border-color: rgba(58,52,133,0.22);
}

.hidden{display:none !important}

.participant{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px;
  border-radius: 14px;
  border:1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.72);
  margin-bottom: 10px;
}

.participant .name{
  font-weight:700;
  font-size: 13px;
}

.participant .role{
  font-size: 12px;
  color: var(--muted);
}

.participant .actions{
  display:flex;
  gap:8px;
}

.iconbtn{
  padding:8px 10px;
  border-radius: 12px;
  border:1px solid rgba(58,52,133,0.18);
  background: rgba(255,255,255,0.65);
  cursor:pointer;
  font-weight:800;
  font-size: 12px;
}

.iconbtn:hover{transform: translateY(-1px)}

.iconbtn-danger{
  border-color: rgba(214, 66, 66, 0.26);
  background: rgba(214, 66, 66, 0.12);
  color: rgba(166, 31, 31, 0.95);
}

.iconbtn-danger:hover{
  background: rgba(214, 66, 66, 0.18);
}

.conf-row__link{
  flex: 1 1 auto;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.conf-row__actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.conf-row__delete{
  opacity: 0;
  transform: translateY(1px);
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
}

.conf-row:hover .conf-row__delete,
.conf-row:focus-within .conf-row__delete{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ===== Chat bubbles (mine vs other) ===== */
.chat-list { display:flex; flex-direction:column; gap:10px; }

.msg-row { display:flex; margin-bottom: 8px; }
.msg-row.mine { justify-content: flex-end; }
.msg-row.other { justify-content: flex-start; }

.msg-bubble {
  max-width: 68%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
}

.msg-row.mine .msg-bubble {
  background: linear-gradient(135deg, #2b4ea2, #1f3b82);
  color: #fff;
  border: 1px solid rgba(35, 60, 130, 0.25);
  border-bottom-right-radius: 6px;
}

.msg-row.other .msg-bubble {
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(0,0,0,.08);
  border-bottom-left-radius: 6px;
}

.msg-meta {
  font-size: 11px;
  opacity: .7;
  margin-top: 6px;
  display:flex;
  justify-content: space-between;
  gap: 8px;
}

.msg-text { white-space: pre-wrap; }

/* ===== System conference messages (interactive link + status card) ===== */
.conf-inline-link{
  text-decoration: underline;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sys-conf{
  display:flex;
  flex-direction:column;
  gap:8px;
  width:100%;
}

.sys-conf__text{
  color: rgba(102,112,133,0.95);
  font-size:12.5px;
  line-height:1.32;
}

.conf-card{
  width:100%;
  padding:10px;
  border-radius:14px;
  border:1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.62);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.conf-card__top{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

.conf-card__icon{
  width:30px;
  height:30px;
  border-radius:10px;
  background: rgba(58,52,133,0.12);
  color: var(--brand-800);
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(58,52,133,0.18);
  flex:0 0 30px;
}

.conf-card__info{
  min-width:0;
}

.conf-card__title{
  font-weight:800;
  font-size:13px;
  line-height:1.2;
}

.conf-card__meta{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
  font-size:12px;
  color: var(--muted);
  margin-top:2px;
}

.conf-card__uuid{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:11px;
  opacity:.75;
  max-width: 150px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.btn-sm{
  padding:7px 10px;
  border-radius: 12px;
  font-size: 12.5px;
}

.conf-card__actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:0;
  flex:0 0 auto;
}

.conf-status{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.55);
  font-weight:800;
  line-height:1;
}

.conf-status--checking{ opacity:.85; }

.conf-status--ok{
  border-color: rgba(46,165,105,0.28);
  background: rgba(46,165,105,0.10);
  color: rgba(23,121,73,0.95);
}

.conf-status--bad{
  border-color: rgba(214,66,66,0.28);
  background: rgba(214,66,66,0.10);
  color: rgba(166,31,31,0.95);
}

.conf-status--noaccess{
  border-color: rgba(100,116,139,0.28);
  background: rgba(100,116,139,0.10);
  color: rgba(51,65,85,0.95);
}

.conf-card--disabled{ opacity:0.78; }

.conf-card--disabled .conf-open,
.conf-card--disabled .conf-open-detail{
  pointer-events:none;
  opacity:0.72;
  filter: grayscale(0.25);
}

@media (max-width: 520px){
  .sys-conf{ max-width: 100%; }

  .conf-card{
    flex-direction:column;
    align-items:stretch;
  }

  .conf-card__actions{
    width:100%;
  }

  .conf-card__actions .btn,
  .conf-card__actions button{
    width:100%;
    justify-content:center;
  }

  .conf-card__uuid{ max-width: 100%; }
}

/* ===== Chat fit to viewport (no page scroll) ===== */
.chat-page {
  min-height: calc(100vh - 170px); /* под шапку/отступы, можно подправить */
  display: flex;
  flex-direction: column;
}

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* важно для корректного скролла внутри */
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* форма всегда снизу */
.chat-sendbar {
  margin-top: 12px;
}

/* ===== Chat fit to viewport (FINAL override) =====
   Важно: у тебя .chat-box имеет height:520px. Это мешает “в экран”.
   Ниже мы перебиваем это поведение для страниц чата. */
.card.chat-page{
  height: calc(100vh - 170px);
  display:flex;
  flex-direction:column;
}

.chat-layout{
  flex:1;
  min-height:0;
}

.chat-panel{
  flex:1;
  display:flex;
  flex-direction:column;
  min-height:0;
}

.chat-box.chat-scroll{
  height:auto !important;     /* перебиваем 520px */
  flex:1;
  min-height:0;
  overflow:auto;
}

.chat-sendbar{
  margin-top:12px;
}

/* ===== Fixed chat window (stable height) ===== */
.chat-layout{
  display:grid;
  grid-template-columns: 1fr 320px;
  gap:16px;
}

/* фиксированная высота всего "окна" чата */
.chat-panel{
  height: 62vh;                 /* <- можно 55-70vh, под вкус */
  min-height: 420px;
  max-height: 700px;
  display:flex;
  flex-direction:column;
  min-height:0;
}

/* внутри панели: сообщения скроллятся */
.chat-box.chat-scroll{
  flex:1;
  min-height:0;
  overflow:auto;
  height:auto !important;       /* перебиваем старый height:520px */
  padding-right:8px;
}

/* форма всегда снизу */
.chat-sendbar{
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid rgba(0,0,0,.08);
}

/* сайдбар по высоте как чат */
.chat-sidebar{
  height: 62vh;
  min-height: 420px;
  max-height: 700px;
  overflow:auto;
}

/* ===== Attachments / previews in chat ===== */
.att-list{
  margin-top: 10px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.att-item{
  display:flex;
  gap:10px;
  align-items:center;
  padding:8px 10px;
  border:1px solid rgba(0,0,0,.08);
  border-radius:12px;
  background: rgba(255,255,255,.65);
}

.msg.me .att-item{
  background: rgba(255,255,255,.35);
  border-color: rgba(35,60,130,.20);
}

.att-thumb{
  width:64px;
  height:64px;
  border-radius:10px;
  overflow:hidden;
  display:block;
  flex:0 0 auto;
  border:1px solid rgba(0,0,0,.08);
}

.att-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.att-fileicon{
  width:64px;
  height:64px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:28px;
  border-radius:10px;
  background: rgba(255,255,255,.7);
  border:1px solid rgba(0,0,0,.08);
  flex:0 0 auto;
}

.att-meta{ min-width:0; }
.att-name{
  font-weight:600;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 360px;
}
.att-actions{
  font-size:12px;
  opacity:.8;
  display:flex;
  gap:8px;
  align-items:center;
  margin-top:2px;
}
.att-actions a{ text-decoration: underline; }

/* ===== HARD FIX: image preview size clamp ===== */
.att-list{
  margin-top: 10px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.att-item{
  display:flex;
  gap:10px;
  align-items:center;
  padding:8px 10px;
  border:1px solid rgba(0,0,0,.08);
  border-radius:12px;
  background: rgba(255,255,255,.65);
  max-width: 100%;
  overflow:hidden;
}

.msg.me .att-item{
  background: rgba(255,255,255,.35);
  border-color: rgba(35,60,130,.20);
}

/* Превью-контейнер фиксированный */
.att-thumb{
  width: 96px !important;
  height: 96px !important;
  min-width: 96px !important;
  min-height: 96px !important;
  max-width: 96px !important;
  max-height: 96px !important;
  border-radius: 12px;
  overflow: hidden;
  display: block;
  flex: 0 0 96px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.8);
}

/* Картинка всегда вписывается */
.att-thumb img{
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display:block;
}

/* Если вдруг где-то img без контейнера */
.att-list img{
  max-width: 100% !important;
  height: auto;
}

/* Текст рядом не растягивает блок */
.att-meta{ min-width:0; max-width: calc(100% - 110px); }
.att-name{
  font-weight:600;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 520px;
}
.att-actions{
  font-size:12px;
  opacity:.8;
  display:flex;
  gap:8px;
  align-items:center;
  margin-top:2px;
}
.att-actions a{ text-decoration: underline; }

/* Bubble safety: never allow content to stretch layout */
.bubble{
  max-width: 720px;
  overflow:hidden;
}

.section-kicker{
  display:inline-flex;
  align-items:center;
  padding:7px 12px;
  border-radius:999px;
  border:1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.76);
  color: var(--brand-700);
  font-size:12px;
  font-weight:800;
  letter-spacing:0.08em;
  text-transform:uppercase;
}

.dashboard-shell{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.dashboard-top{
  display:grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap:18px;
}

.dashboard-welcome h1{
  margin-top:14px;
  font-size: clamp(30px, 4vw, 42px);
  line-height:1.08;
  max-width: 11ch;
}

.dashboard-welcome p{
  max-width: 640px;
  font-size:16px;
}

.dashboard-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin-top:18px;
}

.dashboard-note{
  margin-top:18px;
  padding:14px 16px;
  border-left:3px solid rgba(58,52,133,0.24);
  border-radius: 14px;
  background: rgba(255,255,255,0.52);
  color: rgba(56,64,86,0.88);
  line-height:1.6;
}

.dashboard-summary h2,
.dashboard-security h2,
.auth-note h2{
  margin-bottom:14px;
  font-size:28px;
  line-height:1.15;
}

.summary-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.summary-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:15px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.72);
  border:1px solid rgba(58,52,133,0.12);
}

.summary-copy{
  min-width:0;
}

.summary-copy strong{
  display:block;
  margin-bottom:4px;
  font-size:15px;
}

.summary-copy span{
  display:block;
  color: var(--muted);
  font-size:13px;
  line-height:1.5;
}

.summary-row b{
  flex:0 0 auto;
  min-width:44px;
  text-align:center;
  font-size:20px;
  letter-spacing:-0.03em;
}

.dashboard-links{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:16px;
}

.dashboard-link{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-height: 190px;
  color: inherit;
  text-decoration:none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.dashboard-link:hover{
  transform: translateY(-2px);
  border-color: var(--stroke-strong);
  box-shadow: 0 22px 44px rgba(20, 28, 60, 0.10);
  text-decoration:none;
}

.dashboard-link__title{
  font-size:24px;
  font-weight:800;
  letter-spacing:-0.04em;
  color: var(--text);
}

.dashboard-link__more{
  margin-top:auto;
  font-weight:700;
  color: var(--brand-700);
}

.dashboard-badges{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

.dashboard-section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}

.auth-grid{
  display:grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap:18px;
  max-width:980px;
  margin:0 auto;
  align-items:start;
}

.auth-grid--wide{
  grid-template-columns: minmax(0, 1fr) 340px;
}

.auth-main h1{
  margin-top:14px;
  font-size: clamp(30px, 4vw, 40px);
  line-height:1.08;
}

.auth-main p{
  max-width: 560px;
  font-size:16px;
}

.auth-submit{
  width:100%;
}

.auth-note{
  min-height:100%;
}

.auth-note-list{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:14px;
}

.auth-note-item{
  padding:14px 16px;
  border-radius: 16px;
  border:1px solid rgba(58,52,133,0.12);
  background: rgba(255,255,255,0.72);
}

.auth-note-item strong{
  display:block;
  margin-bottom:6px;
  font-size:15px;
}

.auth-note-item p{
  margin:0;
  font-size:14px;
}

/* ===== Mobile / small screens ===== */

.nav-toggle{
  display:none;
  width:44px;
  height:44px;
  align-items:center;
  justify-content:center;
  border-radius: 14px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,0.70);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
  cursor:pointer;
  color: var(--brand-900);
  transition: transform .15s ease, box-shadow .15s ease;
}

.nav-toggle:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.nav-toggle:active{
  transform: translateY(0);
}

.nav-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 25, 0.35);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  z-index: 100;
}

@media (max-width: 980px){
  .chat-layout{ grid-template-columns: 1fr; }
  .chat-panel{ height: auto; min-height: 0; max-height: none; }
  .chat-sidebar{ height: auto; min-height: 0; max-height: none; }
}

@media (max-width: 920px){
  .page{ padding:18px 12px 28px; }
  .card{ padding:16px; border-radius: 18px; }
  .brand img{ width:44px; height:44px; }
  .brand-title b{ font-size:18px; }
  .pill{ padding:9px 12px; font-size:14px; }
  .dashboard-top,
  .auth-grid,
  .auth-grid--wide{
    grid-template-columns: 1fr;
  }

  .dashboard-links{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-toggle{ display:inline-flex; }
  .nav-actions{ display:none; }
  .nav-primary{
    flex-direction:column;
    align-items:stretch;
    width:100%;
  }

  body.nav-open{ overflow:hidden; }
  body.nav-open .nav-backdrop{ opacity: 1; pointer-events:auto; }

  body.nav-open .nav-actions{
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:8px;
    position:absolute;
    top: calc(100% + 10px);
    right: 0;
    left: 0;
    padding: 12px;
    border-radius: 18px;
    border:1px solid var(--stroke);
    background: rgba(255,255,255,0.92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    max-height: calc(100vh - 140px);
    overflow:auto;
    z-index: 130;
  }

  body.nav-open .pill{ width:100%; }
  body.nav-open .nav-account{
    width:100%;
  }
  body.nav-open .nav-account__menu{
    position:static;
    margin-top:8px;
    min-width:0;
    width:100%;
    box-shadow:none;
    background: rgba(255,255,255,0.76);
  }
  body.nav-open .nav-account__item{
    padding-left:14px;
    padding-right:14px;
  }
}

@media (max-width: 720px){
  #sendForm{ grid-template-columns: 1fr !important; }
}

@media (max-width: 420px){
  .brand-title span{ display:none; }
  .msg .bubble{ max-width: 92%; }
  .dashboard-links{ grid-template-columns: 1fr; }
  .summary-row{
    align-items:flex-start;
  }
  .summary-row b{
    min-width:auto;
    font-size:18px;
  }
  .dashboard-link__title{
    font-size:22px;
  }

  /* Prevent iOS Safari from zooming inputs on focus */
  input[type="text"], input[type="email"], input[type="password"], input[type="datetime-local"], input[type="number"], textarea{
    font-size: 16px;
  }

  .att-thumb{
    width: 72px !important;
    height: 72px !important;
    min-width: 72px !important;
    min-height: 72px !important;
    max-width: 72px !important;
    max-height: 72px !important;
    flex: 0 0 72px !important;
  }

  .att-meta{ max-width: calc(100% - 86px); }
}

/* ===== Messaging conversation page (responsive + manage tools) ===== */
.chat-page .chat-topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.chat-page .chat-topbar__actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.chat-page .chat-title-row{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

.chat-page .chat-title-row h1{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.chat-page .chat-title-avatar{
  width:42px;
  height:42px;
  flex:0 0 42px;
}

.chat-page .chat-layout{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 330px;
  gap:16px;
  min-height:0;
}

.chat-page .chat-panel{
  min-height:60vh;
  max-height:74vh;
}

.chat-page .chat-sidebar{
  min-height:60vh;
  max-height:74vh;
  overflow:auto;
}

.chat-sidebar-toggle{
  display:none;
}

.chat-page .chat-participants-list{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.chat-page .msg-participant{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}

.chat-page .msg-participant__main{
  display:flex;
  gap:10px;
  align-items:flex-start;
  min-width:0;
}

.chat-page .compact-list .compact-item{
  padding:10px 12px;
}

.chat-page .chat-admin-panel{
  margin-top:8px;
  padding:12px;
  border:1px solid rgba(58,52,133,0.16);
  border-radius:14px;
  background: rgba(255,255,255,0.62);
}

.chat-row__time{
  white-space:nowrap;
}

.chat-row__meta{
  display:flex;
  align-items:center;
  gap:10px;
  flex:0 0 auto;
}

.unread-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:22px;
  height:22px;
  padding:0 7px;
  border-radius:999px;
  background: linear-gradient(180deg, var(--brand-700) 0%, var(--brand-900) 100%);
  color:#fff;
  font-size:12px;
  font-weight:800;
  line-height:1;
  box-shadow: 0 10px 18px rgba(35,32,90,0.20);
}

@media (max-width: 980px){
  .chat-sidebar-toggle{
    display:inline-flex;
  }

  .chat-page .chat-layout{
    grid-template-columns:1fr;
  }

  .chat-page .chat-panel{
    min-height:58vh;
    max-height:none;
  }

  .chat-page .chat-sidebar{
    display:none;
    min-height:0;
    max-height:none;
  }

  .chat-page .chat-sidebar.is-open{
    display:block;
  }
}

@media (max-width: 760px){
  .chat-page .chat-topbar__actions{
    width:100%;
  }

  .chat-page .chat-topbar__actions .btn,
  .chat-page .chat-topbar__actions form{
    width:100%;
  }

  .chat-page .chat-topbar__actions .btn{
    justify-content:center;
  }

  .chat-row{
    align-items:flex-start;
    flex-direction:column;
  }

  .chat-row__meta{
    width:100%;
    justify-content:space-between;
  }

  .chat-row__time{
    white-space:normal;
  }

  .chat-page .chat-title-row h1{
    white-space:normal;
    line-height:1.2;
  }
}

/* ===== Messaging conversation layout (v3): wide + in-viewport (no page scroll to input) ===== */
body.messaging .container{
  max-width: 1360px;
}

body.messaging.messaging-conversation .footer{
  display:none;
}

body.messaging.messaging-conversation .card.chat-page{
  display:flex;
  flex-direction:column;
  overflow:hidden;
  height: calc(100vh - 160px);
  max-height: calc(100vh - 160px);
  padding:16px;
}

@supports (height: 100dvh){
  body.messaging.messaging-conversation .card.chat-page{
    height: calc(100dvh - 160px);
    max-height: calc(100dvh - 160px);
  }
}

body.messaging.messaging-conversation .chat-layout{
  flex:1;
  min-height:0;
  display:grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap:16px;
}

body.messaging.messaging-conversation .chat-topbar{
  align-items:center;
  gap:10px;
}

body.messaging.messaging-conversation .chat-title-avatar{
  width:36px;
  height:36px;
  flex:0 0 36px;
}

body.messaging.messaging-conversation .chat-title-row{
  gap:10px;
}

body.messaging.messaging-conversation .chat-title-row h1{
  font-size:32px;
  letter-spacing:-0.02em;
}

body.messaging.messaging-conversation .chat-count-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:24px;
  min-width:24px;
  padding:0 8px;
  border-radius:999px;
  border:1px solid rgba(58,52,133,0.18);
  background: rgba(58,52,133,0.08);
  color: var(--brand-900);
  font-weight:900;
  font-size:12px;
  line-height:1;
  flex:0 0 auto;
}

body.messaging.messaging-conversation .chat-topbar__actions{
  gap:8px;
}

body.messaging.messaging-conversation .hr{
  margin: 10px 0;
}

body.messaging.messaging-conversation .chat-panel{
  display:flex;
  flex-direction:column;
  min-height:0;
  height:auto !important;
  max-height:none !important;
}

body.messaging.messaging-conversation .chat-box.chat-scroll{
  flex:1;
  min-height:0;
  height:auto !important;
  max-height:none !important;
  overflow:auto;
}

body.messaging.messaging-conversation .chat-sendbar{
  flex:0 0 auto;
  margin-top:12px;
  padding-top:12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top:1px solid rgba(58,52,133,0.14);
}

body.messaging.messaging-conversation .chat-compose{
  display:flex;
  align-items:flex-end;
  gap:10px;
}

body.messaging.messaging-conversation .chat-compose textarea{
  flex:1;
  min-height:46px;
  max-height:140px;
  resize:none;
}

body.messaging.messaging-conversation .chat-compose__actions{
  display:flex;
  gap:10px;
  align-items:flex-end;
}

body.messaging.messaging-conversation .chat-file-input{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

body.messaging.messaging-conversation .chat-file-hint{
  margin-top:10px;
  padding:7px 10px;
  border-radius:12px;
  border:1px dashed rgba(58,52,133,0.18);
  background: rgba(255,255,255,0.55);
  color: var(--muted);
  overflow-wrap:anywhere;
}

body.messaging.messaging-conversation .chat-typing-hint{
  margin-top:8px;
  color: var(--muted);
}

body.messaging.messaging-conversation .chat-sidebar{
  overflow:auto;
  min-height:0;
  height:auto !important;
  max-height:none !important;
}

body.messaging.messaging-conversation .msg{
  max-width:100%;
}

body.messaging.messaging-conversation .msg .bubble{
  max-width:min(860px, 86%);
}

@media (max-width: 980px){
  body.messaging.messaging-conversation .card.chat-page{
    height:auto;
    max-height:none;
    overflow:visible;
  }

  body.messaging.messaging-conversation .chat-layout{
    grid-template-columns:1fr;
  }

  body.messaging.messaging-conversation .chat-sidebar{
    display:none;
    height:auto;
    max-height:none;
  }

  body.messaging.messaging-conversation .chat-sidebar.is-open{
    display:block;
    margin-top:8px;
  }
}

/* ===== Messaging conversation mobile hard override (final) ===== */
@media (max-width: 980px){
  body.messaging.messaging-conversation .container{
    max-width: 100%;
    padding-left: 10px;
    padding-right: 10px;
    margin-top: 10px;
  }

  body.messaging.messaging-conversation .card.chat-page{
    height: calc(100dvh - 102px) !important;
    max-height: calc(100dvh - 102px) !important;
    min-height: calc(100dvh - 102px) !important;
    padding: 10px !important;
    overflow: hidden !important;
  }

  @supports not (height: 100dvh){
    body.messaging.messaging-conversation .card.chat-page{
      height: calc(100vh - 102px) !important;
      max-height: calc(100vh - 102px) !important;
      min-height: calc(100vh - 102px) !important;
    }
  }

  body.messaging.messaging-conversation .chat-topbar{
    align-items:flex-start;
    gap: 8px;
  }

  body.messaging.messaging-conversation .chat-title-row{
    gap: 8px;
  }

  body.messaging.messaging-conversation .chat-title-avatar{
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  body.messaging.messaging-conversation .chat-title-row h1{
    font-size: 24px;
    line-height: 1.12;
  }

  body.messaging.messaging-conversation .chat-topbar__actions{
    width: 100%;
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.messaging.messaging-conversation .chat-topbar__actions form,
  body.messaging.messaging-conversation .chat-topbar__actions .btn{
    width: 100%;
    min-width: 0;
  }

  body.messaging.messaging-conversation .chat-topbar__actions .btn{
    justify-content:center;
  }

  body.messaging.messaging-conversation .hr{
    margin: 8px 0;
  }

  body.messaging.messaging-conversation .chat-layout{
    grid-template-columns: 1fr !important;
    gap: 8px;
    min-height: 0;
    height: 100%;
  }

  body.messaging.messaging-conversation .chat-panel{
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
  }

  body.messaging.messaging-conversation .chat-box.chat-scroll{
    flex: 1 1 auto;
    min-height: 0;
    padding-right: 4px;
  }

  body.messaging.messaging-conversation .chat-sendbar{
    margin-top: 8px;
    padding-top: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    position: sticky;
    bottom: 0;
    z-index: 4;
    background: rgba(244,246,255,0.94);
    backdrop-filter: blur(8px);
  }

  body.messaging.messaging-conversation .chat-compose{
    display:grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items:end;
    gap: 8px;
  }

  body.messaging.messaging-conversation .chat-compose textarea{
    min-height: 44px;
    max-height: 108px;
    font-size: 16px;
  }

  body.messaging.messaging-conversation .chat-compose__actions{
    gap: 8px;
  }

  body.messaging.messaging-conversation .chat-attach-btn,
  body.messaging.messaging-conversation .chat-send-btn{
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content:center;
  }

  body.messaging.messaging-conversation .chat-sidebar{
    display:none;
    position: fixed;
    left: 8px;
    right: 8px;
    top: 76px;
    bottom: 8px;
    z-index: 110;
    margin-top: 0 !important;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(14,19,44,0.28);
    overflow:auto;
  }

  body.messaging.messaging-conversation .chat-sidebar.is-open{
    display:block;
  }

  body.messaging.messaging-conversation .msg .bubble{
    max-width: 94%;
  }
}

@media (max-width: 560px){
  body.messaging.messaging-conversation .page{
    padding-top: 8px;
    padding-bottom: 10px;
  }

  body.messaging.messaging-conversation .nav{
    padding-top: 4px;
    padding-bottom: 4px;
  }

  body.messaging.messaging-conversation .container{
    margin-top: 6px;
  }

  body.messaging.messaging-conversation .brand img{
    width: 38px;
    height: 38px;
  }

  body.messaging.messaging-conversation .brand-title b{
    font-size: 18px;
  }

  body.messaging.messaging-conversation .nav-toggle{
    width: 40px;
    height: 40px;
  }

  body.messaging.messaging-conversation .card.chat-page{
    height: calc(100dvh - 82px) !important;
    max-height: calc(100dvh - 82px) !important;
    min-height: calc(100dvh - 82px) !important;
    border-radius: 14px;
    padding: 8px !important;
  }

  @supports not (height: 100dvh){
    body.messaging.messaging-conversation .card.chat-page{
      height: calc(100vh - 82px) !important;
      max-height: calc(100vh - 82px) !important;
      min-height: calc(100vh - 82px) !important;
    }
  }

  body.messaging.messaging-conversation .chat-topbar__actions{
    grid-template-columns: 1fr;
  }

  body.messaging.messaging-conversation .chat-title-row h1{
    font-size: 20px;
  }

  body.messaging.messaging-conversation .chat-sidebar{
    top: 66px;
    left: 6px;
    right: 6px;
    bottom: 6px;
  }
}

/* ===== Messaging mobile polish: attachments + composer fit ===== */
@media (max-width: 980px){
  body.messaging.messaging-conversation #msgs{
    overflow-x: hidden !important;
  }

  body.messaging.messaging-conversation .msg{
    width: 100%;
  }

  body.messaging.messaging-conversation .msg .bubble{
    max-width: 100% !important;
  }

  body.messaging.messaging-conversation .att-item{
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    max-width: 100%;
    overflow: hidden;
  }

  body.messaging.messaging-conversation .att-thumb,
  body.messaging.messaging-conversation .att-fileicon{
    width: 72px !important;
    height: 72px !important;
    min-width: 72px !important;
    min-height: 72px !important;
    max-width: 72px !important;
    max-height: 72px !important;
    flex: 0 0 72px !important;
  }

  body.messaging.messaging-conversation .att-meta{
    min-width: 0;
    max-width: 100% !important;
  }

  body.messaging.messaging-conversation .att-name{
    max-width: 100% !important;
  }

  body.messaging.messaging-conversation .att-actions{
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: center;
    white-space: normal;
  }

  body.messaging.messaging-conversation .att-actions span{
    display: none;
  }

  body.messaging.messaging-conversation .att-actions a{
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  body.messaging.messaging-conversation .chat-sendbar{
    overflow: visible;
  }

  body.messaging.messaging-conversation .chat-compose{
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  body.messaging.messaging-conversation .chat-compose textarea{
    min-width: 0;
    width: 100%;
  }

  body.messaging.messaging-conversation .chat-compose__actions{
    display: flex;
    flex: 0 0 auto;
    min-width: 96px;
    justify-content: flex-end;
  }

  body.messaging.messaging-conversation .chat-topbar__actions .btn:disabled{
    opacity: 1;
    color: var(--brand-900);
    background: rgba(255,255,255,0.66);
  }
}

@media (max-width: 560px){
  body.messaging.messaging-conversation .chat-topbar__actions{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  body.messaging.messaging-conversation .chat-topbar__actions .btn,
  body.messaging.messaging-conversation .chat-topbar__actions form .btn{
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.messaging.messaging-conversation #msgs.chat-box.chat-scroll{
    padding: 8px;
  }

  body.messaging.messaging-conversation .chat-topbar{
    gap: 6px;
  }

  body.messaging.messaging-conversation .chat-title-row{
    gap: 6px;
  }

  body.messaging.messaging-conversation .chat-title-avatar{
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
  }

  body.messaging.messaging-conversation .chat-count-pill{
    height: 22px;
    min-width: 22px;
    padding: 0 7px;
    font-size: 12px;
  }

  body.messaging.messaging-conversation .msg{
    margin-bottom: 8px;
    gap: 0;
  }

  body.messaging.messaging-conversation .msg .bubble{
    max-width: 92% !important;
    padding: 9px 10px;
    border-radius: 14px;
  }

  body.messaging.messaging-conversation .msg .meta{
    font-size: 11px;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
  }

  body.messaging.messaging-conversation .att-item{
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 6px;
    padding: 6px 7px;
    border-radius: 10px;
  }

  body.messaging.messaging-conversation .att-thumb,
  body.messaging.messaging-conversation .att-fileicon{
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
    flex: 0 0 56px !important;
  }

  body.messaging.messaging-conversation .att-name{
    font-size: 14px;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
  }

  body.messaging.messaging-conversation .chat-sendbar{
    padding-left: 6px;
    padding-right: 6px;
  }

  body.messaging.messaging-conversation .chat-compose{
    grid-template-columns: minmax(0, 1fr) 88px !important;
    gap: 6px;
    align-items: center;
  }

  body.messaging.messaging-conversation .chat-compose textarea{
    min-height: 42px;
    max-height: 92px;
    padding-top: 10px;
    padding-bottom: 10px;
    line-height: 1.2;
  }

  body.messaging.messaging-conversation .chat-compose__actions{
    min-width: 88px;
    width: 88px;
    gap: 6px;
    display: grid;
    grid-template-columns: repeat(2, 40px);
    align-items: center;
    justify-content: end;
  }

  body.messaging.messaging-conversation .chat-attach-btn,
  body.messaging.messaging-conversation .chat-send-btn{
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin: 0;
    transform: none !important;
  }

  body.messaging.messaging-conversation .chat-attach-btn svg,
  body.messaging.messaging-conversation .chat-send-btn svg{
    width: 18px;
    height: 18px;
  }

  body.messaging.messaging-conversation .chat-topbar__actions form .btn,
  body.messaging.messaging-conversation .chat-topbar__actions .btn{
    color: var(--brand-900) !important;
    -webkit-text-fill-color: var(--brand-900);
  }

  body.messaging.messaging-conversation .chat-topbar__actions button[disabled],
  body.messaging.messaging-conversation .chat-topbar__actions .btn[disabled]{
    opacity: 1 !important;
    color: var(--brand-900) !important;
    -webkit-text-fill-color: var(--brand-900);
    background: rgba(255,255,255,0.72) !important;
  }
}

/* ===== Messaging conversation: compact top spacing + taller chat (final override) ===== */
@media (max-width: 980px){
  body.messaging.messaging-conversation .page{
    padding-top: 4px !important;
    padding-bottom: 10px !important;
  }

  body.messaging.messaging-conversation .nav{
    padding-top: 2px !important;
    padding-bottom: 2px !important;
  }

  body.messaging.messaging-conversation .container{
    margin-top: 4px !important;
  }

  body.messaging.messaging-conversation .card.chat-page{
    height: calc(100dvh - 90px) !important;
    max-height: calc(100dvh - 90px) !important;
    min-height: calc(100dvh - 90px) !important;
  }

  @supports not (height: 100dvh){
    body.messaging.messaging-conversation .card.chat-page{
      height: calc(100vh - 90px) !important;
      max-height: calc(100vh - 90px) !important;
      min-height: calc(100vh - 90px) !important;
    }
  }
}

.btn-assistant-launch{
  border-color: rgba(124, 108, 245, 0.22);
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(242,240,255,0.92));
  color: #4d43a8;
}

.chat-row--assistant{
  background:
    radial-gradient(circle at top right, rgba(124,108,245,0.10), transparent 46%),
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(244,242,255,0.96));
  border-color: rgba(124,108,245,0.18);
}

.avatar--assistant{
  background: linear-gradient(135deg, #6b63d9, #9a8cff);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 24px rgba(100, 92, 199, 0.18);
}

.avatar--assistant span{
  font-size: 0.88rem;
}

.presence-pill--assistant{
  background: rgba(124, 108, 245, 0.12);
  color: #5a4dc1;
}

.presence-pill--assistant .presence-dot{
  background: #7c6cf5;
}

.chat-title-stack{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-ai-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(124, 108, 245, 0.12);
  color: #5b4ec0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chat-context-widget{
  position: relative;
  display: inline-flex;
  align-items: center;
}

.chat-context-badge{
  --context-percent: 0%;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 10px 24px rgba(82, 73, 179, 0.16);
  color: var(--brand-900);
  cursor: default;
}

.chat-context-badge__ring{
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    conic-gradient(#6c5de2 0 var(--context-percent), rgba(108, 93, 226, 0.18) var(--context-percent) 100%);
  -webkit-mask:
    radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
          mask:
    radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
}

.chat-context-badge__value{
  position: relative;
  z-index: 1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.chat-context-tooltip{
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  z-index: 12;
  width: min(280px, 72vw);
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(58,52,133,0.16);
  background: rgba(255,255,255,0.98);
  box-shadow: 0 18px 42px rgba(35,32,90,0.18);
  color: var(--text);
  transform: translateX(-50%) translateY(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.chat-context-tooltip:before{
  content:"";
  position:absolute;
  top:-7px;
  left:50%;
  width:14px;
  height:14px;
  border-left:1px solid rgba(58,52,133,0.16);
  border-top:1px solid rgba(58,52,133,0.16);
  background: rgba(255,255,255,0.98);
  transform: translateX(-50%) rotate(45deg);
}

.chat-context-widget:hover .chat-context-tooltip,
.chat-context-widget:focus-within .chat-context-tooltip{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.chat-context-tooltip__title{
  font-size: 12px;
  color: var(--muted);
}

.chat-context-tooltip__usage{
  margin-top: 6px;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.chat-context-tooltip__tokens{
  margin-top: 4px;
  font-size: 14px;
  color: var(--text);
}

.chat-context-tooltip__mode{
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(108, 93, 226, 0.10);
  color: #5b4ec0;
  font-size: 12px;
  font-weight: 700;
}

.chat-context-tooltip__note{
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(66, 63, 99, 0.82);
}

.chat-assistant-subtitle{
  color: rgba(66, 63, 99, 0.78);
  font-size: 14px;
}

.chat-assistant-topic{
  color: rgba(66, 63, 99, 0.64);
  font-size: 13px;
}

.assistant-session-actions{
  margin: 10px 0 12px;
}

.assistant-session-create{
  width: 100%;
}

.assistant-session-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assistant-session-item{
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(124, 108, 245, 0.16);
  background: rgba(255,255,255,0.84);
  color: var(--text);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

.assistant-session-item:hover{
  transform: translateY(-1px);
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(100, 92, 199, 0.10);
  border-color: rgba(124, 108, 245, 0.26);
}

.assistant-session-item.is-active{
  background: linear-gradient(180deg, rgba(246,244,255,0.98), rgba(239,237,255,0.94));
  border-color: rgba(108, 93, 226, 0.30);
  box-shadow: 0 16px 30px rgba(100, 92, 199, 0.14);
}

.assistant-session-item__title{
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-900);
  line-height: 1.35;
}

.assistant-session-item__meta{
  font-size: 12px;
  color: var(--muted);
}

.assistant-session-empty{
  padding: 8px 2px 2px;
}

.assistant-secondary-tab{
  margin-bottom: 10px;
}

.assistant-suggestions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}

.assistant-chip{
  border: 1px solid rgba(124, 108, 245, 0.18);
  background: rgba(255,255,255,0.86);
  color: #5649ba;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.assistant-chip:hover{
  transform: translateY(-1px);
  background: rgba(245,243,255,0.98);
  box-shadow: 0 10px 22px rgba(100, 92, 199, 0.12);
}

.msg-meta-author{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.msg-role-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(124, 108, 245, 0.12);
  color: #5b4ec0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.msg.bot .bubble{
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,244,255,0.98));
  border-color: rgba(124, 108, 245, 0.16);
  box-shadow: 0 14px 32px rgba(99, 92, 184, 0.10);
}

.msg--thinking .bubble{
  min-width: 180px;
}

.msg-text--thinking{
  min-height: 26px;
  display: flex;
  align-items: center;
}

.typing-dots{
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.typing-dots span{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(108, 93, 226, 0.68);
  animation: assistantTypingDot 1.15s ease-in-out infinite;
}

.typing-dots span:nth-child(2){
  animation-delay: 0.18s;
}

.typing-dots span:nth-child(3){
  animation-delay: 0.36s;
}

@keyframes assistantTypingDot{
  0%, 80%, 100%{
    transform: translateY(0) scale(0.72);
    opacity: 0.34;
  }
  40%{
    transform: translateY(-1px) scale(1);
    opacity: 1;
  }
}

@media (max-width: 560px){
  .chat-context-badge{
    width: 30px;
    height: 30px;
  }

  .chat-context-badge__value{
    font-size: 9px;
  }

  .chat-context-tooltip{
    left: auto;
    right: 0;
    transform: translateY(6px);
    width: min(250px, calc(100vw - 32px));
  }

  .chat-context-tooltip:before{
    left: auto;
    right: 11px;
    transform: rotate(45deg);
  }

  .chat-context-widget:hover .chat-context-tooltip,
  .chat-context-widget:focus-within .chat-context-tooltip{
    transform: translateY(0);
  }

  body.messaging.messaging-conversation .page{
    padding-top: 2px !important;
  }

  body.messaging.messaging-conversation .nav{
    padding-top: 1px !important;
    padding-bottom: 1px !important;
  }

  body.messaging.messaging-conversation .container{
    margin-top: 2px !important;
  }

  body.messaging.messaging-conversation .card.chat-page{
    height: calc(100dvh - 72px) !important;
    max-height: calc(100dvh - 72px) !important;
    min-height: calc(100dvh - 72px) !important;
  }

  @supports not (height: 100dvh){
    body.messaging.messaging-conversation .card.chat-page{
      height: calc(100vh - 72px) !important;
      max-height: calc(100vh - 72px) !important;
      min-height: calc(100vh - 72px) !important;
    }
  }
}

/* ===== Laptop workspace refresh: denser shell, wider messaging, smarter sidebar ===== */
@media (min-width: 981px) and (max-width: 1500px){
  .page{
    padding: 14px 18px 28px;
  }

  .nav{
    max-width: min(1400px, calc(100vw - 36px));
    gap: 14px;
    padding: 6px 4px 8px;
  }

  .container{
    max-width: min(1400px, calc(100vw - 36px));
    margin-top: 14px;
  }

  .brand{
    gap: 10px;
  }

  .brand img{
    width: 46px;
    height: 46px;
  }

  .brand-title b{
    font-size: 18px;
    line-height: 1.05;
  }

  .brand-title span{
    font-size: 12px;
  }

  .nav-actions{
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .pill{
    min-height: 44px;
    padding: 10px 14px;
    font-size: 15px;
  }
}

body.messaging .container{
  max-width: min(1500px, calc(100vw - 28px)) !important;
}

body.messaging.messaging-inbox .footer,
body.messaging.messaging-conversation .footer{
  display: none;
}

body.messaging.messaging-inbox .card.inbox-page{
  padding: 18px 20px 20px;
}

.messaging-inbox__header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.messaging-inbox__heading{
  min-width: 0;
}

.messaging-inbox__heading h1{
  font-size: clamp(34px, 3vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.messaging-inbox__actions{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.messaging-inbox__toolbar{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.messaging-inbox__search{
  width: 100%;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid rgba(58,52,133,0.12);
  background: rgba(255,255,255,0.82);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
  font-size: 15px;
  color: var(--text);
}

.messaging-inbox__search::placeholder{
  color: rgba(66, 63, 99, 0.48);
}

.messaging-inbox__list{
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100dvh - 280px);
  padding-right: 4px;
  overflow: auto;
}

@supports not (height: 100dvh){
  .messaging-inbox__list{
    max-height: calc(100vh - 280px);
  }
}

body.messaging.messaging-inbox .chat-row{
  padding: 14px 16px;
  border-radius: 20px;
  min-height: 78px;
  gap: 14px;
}

body.messaging.messaging-inbox .chat-row__meta{
  min-width: 190px;
  justify-content: flex-end;
}

body.messaging.messaging-inbox .chat-row__time{
  font-size: 12px;
}

body.messaging.messaging-conversation .page,
body.messaging.messaging-inbox .page{
  padding-top: 8px;
}

body.messaging.messaging-conversation .nav,
body.messaging.messaging-inbox .nav{
  padding-top: 4px;
  padding-bottom: 4px;
}

body.messaging.messaging-conversation .container,
body.messaging.messaging-inbox .container{
  margin-top: 6px !important;
}

body.messaging.messaging-conversation .card.chat-page{
  height: calc(100dvh - 92px) !important;
  max-height: calc(100dvh - 92px) !important;
  min-height: calc(100dvh - 92px) !important;
  padding: 12px 14px 14px !important;
  border-radius: 26px;
}

@supports not (height: 100dvh){
  body.messaging.messaging-conversation .card.chat-page{
    height: calc(100vh - 92px) !important;
    max-height: calc(100vh - 92px) !important;
    min-height: calc(100vh - 92px) !important;
  }
}

body.messaging.messaging-conversation .chat-topbar{
  align-items: flex-start;
  gap: 8px;
}

body.messaging.messaging-conversation .chat-topbar__title{
  min-width: 0;
  flex: 1 1 auto;
}

body.messaging.messaging-conversation .chat-topbar__actions{
  gap: 8px;
  justify-content: flex-end;
  flex: 0 0 auto;
}

body.messaging.messaging-conversation .chat-title-row{
  gap: 10px;
}

body.messaging.messaging-conversation .chat-title-avatar{
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

body.messaging.messaging-conversation .chat-title-row h1{
  font-size: clamp(28px, 2.2vw, 40px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

body.messaging.messaging-conversation .chat-assistant-subtitle{
  font-size: 12px;
}

body.messaging.messaging-conversation .chat-assistant-topic{
  font-size: 11px;
}

body.messaging.messaging-conversation .hr{
  margin: 8px 0 10px;
}

body.messaging.messaging-conversation .chat-layout{
  grid-template-columns: minmax(0, 1fr) 290px !important;
  gap: 14px;
  height: 100%;
  align-items: stretch;
}

body.messaging.messaging-conversation .chat-panel{
  min-height: 0 !important;
  height: 100% !important;
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  align-content: stretch;
}

body.messaging.messaging-conversation .chat-box.chat-scroll{
  height: 100% !important;
  max-height: none !important;
  min-height: 320px;
  padding-right: 6px;
}

body.messaging.messaging-conversation .chat-sidebar{
  padding: 14px;
  border-radius: 22px;
}

body.messaging.messaging-conversation .chat-participants-list{
  gap: 10px;
}

body.messaging.messaging-conversation .msg .bubble{
  max-width: min(820px, 88%);
}

body.messaging.messaging-conversation .chat-sendbar{
  margin-top: 8px;
  padding-top: 8px;
}

body.messaging.messaging-conversation .chat-compose textarea{
  min-height: 46px;
}

body.messaging.messaging-conversation .assistant-suggestions{
  margin: 8px 0 0;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

body.messaging.messaging-conversation .assistant-chip{
  flex: 0 0 auto;
  padding: 7px 11px;
  font-size: 12px;
}

.chat-sidebar-backdrop{
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(23, 27, 54, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.chat-sidebar-backdrop.is-open{
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 981px) and (max-width: 1360px){
  body.messaging.messaging-conversation .chat-sidebar-toggle{
    display: inline-flex;
  }

  body.messaging.messaging-conversation .chat-layout{
    grid-template-columns: 1fr !important;
  }

  body.messaging.messaging-conversation .chat-topbar__actions{
    flex-wrap: wrap;
  }

  body.messaging.messaging-conversation .chat-sidebar{
    position: fixed;
    top: 88px;
    right: 18px;
    bottom: 18px;
    width: min(336px, calc(100vw - 36px));
    margin: 0 !important;
    z-index: 140;
    background: rgba(248, 249, 255, 0.96);
    backdrop-filter: blur(12px);
    box-shadow: 0 24px 64px rgba(19, 23, 52, 0.24);
    transform: translateX(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
    transition: transform .2s ease, opacity .2s ease;
  }

  body.messaging.messaging-conversation .chat-sidebar.is-open{
    display: block;
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  body.chat-sidebar-open{
    overflow: hidden;
  }
}

@media (min-width: 981px) and (max-width: 1280px){
  body.messaging.messaging-conversation .card.chat-page{
    padding: 10px 12px 12px !important;
  }

  body.messaging.messaging-conversation .chat-title-row h1{
    font-size: 30px;
  }

  body.messaging.messaging-conversation .msg .bubble{
    max-width: 92%;
  }

  body.messaging.messaging-conversation .chat-box.chat-scroll{
    min-height: 360px;
  }
}

@media (min-width: 981px) and (max-width: 1180px){
  .messaging-inbox__header{
    align-items: stretch;
    flex-direction: column;
  }

  .messaging-inbox__actions{
    justify-content: flex-start;
  }

  body.messaging.messaging-inbox .chat-row{
    align-items: flex-start;
    flex-direction: column;
  }

  body.messaging.messaging-inbox .chat-row__meta{
    width: 100%;
    min-width: 0;
    justify-content: space-between;
  }
}

/* ===== Squirrel Web dedicated workspace ===== */
body.messaging.messaging-assistant .page{
  padding: 8px 12px 12px;
}

body.messaging.messaging-assistant .container{
  max-width: none !important;
  margin-top: 8px !important;
}

body.messaging.messaging-assistant .footer{
  display: none;
}

.assistant-appbar{
  max-width: min(1500px, calc(100vw - 18px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 4px;
}

.assistant-appbar__brand{
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--brand-900);
}

.assistant-appbar__brand:hover{
  text-decoration: none;
}

.assistant-appbar__brand img{
  width: 38px;
  height: 38px;
}

.assistant-appbar__brand-text{
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.assistant-appbar__brand-text strong{
  font-size: 16px;
  line-height: 1.05;
}

.assistant-appbar__brand-text span{
  font-size: 11px;
  color: rgba(66, 63, 99, 0.68);
}

.assistant-appbar__actions{
  display: flex;
  align-items: center;
  gap: 10px;
}

.assistant-shell{
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 10px;
  height: calc(100dvh - 70px);
  max-width: min(1500px, calc(100vw - 18px));
  margin: 0 auto;
}

@supports not (height: 100dvh){
  .assistant-shell{
    height: calc(100vh - 70px);
  }
}

.assistant-shell__sidebar{
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-radius: 24px;
  border: 1px solid rgba(58,52,133,0.12);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.94), rgba(245,246,255,0.9));
  box-shadow: 0 24px 60px rgba(53, 58, 118, 0.10);
  min-width: 0;
}

.assistant-sidebar__top{
  display: grid;
  gap: 10px;
}

.assistant-sidebar__identity{
  display: flex;
  align-items: center;
  gap: 12px;
}

.assistant-sidebar__avatar{
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}

.assistant-sidebar__identity-text{
  min-width: 0;
}

.assistant-sidebar__eyebrow{
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(90, 77, 193, 0.72);
}

.assistant-sidebar__title{
  font-size: 18px;
  font-weight: 800;
  line-height: 1.05;
  color: var(--brand-900);
}

.assistant-sidebar__new-chat{
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(58,52,133,0.12);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(54,45,137,0.98), rgba(45,38,118,0.98));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 18px 36px rgba(58, 52, 133, 0.18);
}

.assistant-sidebar__new-chat:hover{
  text-decoration: none;
  transform: translateY(-1px);
}

.assistant-sidebar__searchwrap{
  display: block;
}

.assistant-sidebar__search{
  width: 100%;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(58,52,133,0.12);
  background: rgba(255,255,255,0.82);
  color: var(--text);
  font-size: 13px;
}

.assistant-sidebar__section-title{
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(66, 63, 99, 0.56);
}

.assistant-session-nav{
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.assistant-session-nav__item{
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(58,52,133,0.08);
  background: rgba(255,255,255,0.68);
  color: var(--text);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.assistant-session-nav__item:hover{
  text-decoration: none;
  transform: translateY(-1px);
  border-color: rgba(108, 93, 226, 0.18);
  box-shadow: 0 14px 28px rgba(53, 58, 118, 0.10);
}

.assistant-session-nav__item.is-active{
  border-color: rgba(108, 93, 226, 0.26);
  background: linear-gradient(180deg, rgba(244,242,255,0.98), rgba(238,235,255,0.94));
  box-shadow: 0 18px 36px rgba(100, 92, 199, 0.12);
}

.assistant-session-nav__item-title{
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--brand-900);
}

.assistant-session-nav__item-meta{
  font-size: 11px;
  color: var(--muted);
}

.assistant-session-nav__empty{
  padding: 8px 2px;
  color: var(--muted);
  font-size: 13px;
}

.assistant-sidebar__footer{
  display: flex;
}

.assistant-sidebar__footer-card{
  width: 100%;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(58,52,133,0.10);
  background: rgba(255,255,255,0.65);
}

.assistant-sidebar__footer-title{
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-900);
}

.assistant-sidebar__footer-text{
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(66, 63, 99, 0.72);
}

.assistant-shell__backdrop{
  position: fixed;
  inset: 0;
  z-index: 139;
  background: rgba(18, 23, 52, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.assistant-shell__backdrop.is-open{
  opacity: 1;
  pointer-events: auto;
}

.assistant-workspace{
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  gap: 8px;
  padding: 12px 14px 14px;
  border-radius: 24px;
  border: 1px solid rgba(58,52,133,0.12);
  background:
    radial-gradient(circle at top right, rgba(124,108,245,0.08), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,248,255,0.92));
  box-shadow: 0 28px 70px rgba(53, 58, 118, 0.10);
}

.assistant-workspace__header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.assistant-workspace__header-left{
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.assistant-workspace__menu{
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(58,52,133,0.12);
  background: rgba(255,255,255,0.88);
  color: var(--brand-900);
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.assistant-workspace__menu span{
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.assistant-workspace__titleblock{
  min-width: 0;
}

.assistant-workspace__title-row{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.assistant-workspace__title{
  font-size: clamp(24px, 1.9vw, 34px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: #23203f;
}

.assistant-workspace__subtitle{
  margin-top: 4px;
  font-size: 11px;
  color: rgba(66, 63, 99, 0.66);
}

.assistant-workspace__header-actions{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.assistant-workspace__body{
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  align-items: stretch;
}

.assistant-workspace.is-empty .assistant-workspace__body{
  justify-content: center;
  align-items: center;
}

.assistant-empty{
  width: min(820px, 100%);
  text-align: center;
  margin: 0 auto;
}

.assistant-empty__eyebrow{
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(90, 77, 193, 0.78);
}

.assistant-empty__title{
  margin: 16px 0 12px;
  font-size: clamp(38px, 4vw, 58px);
  line-height: 0.98;
  letter-spacing: -0.05em;
  color: #1f1c39;
}

.assistant-empty__text{
  margin: 0 auto;
  max-width: 680px;
  font-size: 17px;
  line-height: 1.55;
  color: rgba(66, 63, 99, 0.72);
}

.assistant-thread{
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  align-self: stretch;
  overflow: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assistant-thread.is-hidden{
  display: none;
}

.assistant-thread .msg{
  width: 100%;
  display: flex;
  flex-direction: column;
}

.assistant-thread .msg.me{
  align-items: flex-end;
}

.assistant-thread .msg .bubble{
  max-width: min(920px, 92%);
  border-radius: 20px;
  padding: 12px 14px;
  border: 1px solid rgba(58,52,133,0.10);
}

.assistant-thread .msg.me .bubble{
  background: linear-gradient(180deg, rgba(242,241,255,0.98), rgba(234,233,250,0.96));
  box-shadow: 0 20px 40px rgba(53, 58, 118, 0.08);
}

.assistant-thread .msg.bot .bubble{
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,244,255,0.98));
}

.assistant-thread .msg .meta{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 12px;
  color: rgba(66, 63, 99, 0.68);
}

.assistant-thread .msg .msg-text{
  font-size: 14px;
  line-height: 1.5;
  color: #2a2847;
  white-space: pre-wrap;
  word-break: break-word;
}

.assistant-thread .msg .msg-text.msg-text--rich{
  white-space: normal;
}

.assistant-msg-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 10px;
}

.assistant-msg-actions__btn{
  border: 1px solid rgba(67,56,182,0.16);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.94);
  color: #4338b6;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.assistant-msg-actions__btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(79, 74, 154, 0.12);
  border-color: rgba(67,56,182,0.28);
}

.assistant-msg-part + .assistant-msg-part{
  margin-top: 12px;
}

.assistant-msg-part__label{
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(84, 77, 153, 0.84);
}

.assistant-rich-text{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assistant-rich-text p{
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #2a2847;
}

.assistant-code-block{
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(58,52,133,0.14);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,243,255,0.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.assistant-code-block__toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(58,52,133,0.10);
  background: rgba(243,241,255,0.88);
}

.assistant-code-block__title{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(56, 51, 118, 0.82);
}

.assistant-code-block__copy{
  border: 1px solid rgba(67,56,182,0.18);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.94);
  color: #4338b6;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.assistant-code-block__copy:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(79, 74, 154, 0.12);
  border-color: rgba(67,56,182,0.28);
}

.assistant-code-block__pre{
  margin: 0;
  padding: 12px 14px 14px;
  max-height: 420px;
  overflow: auto;
  background: rgba(247,247,252,0.96);
}

.assistant-code-block__code{
  display: block;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #1f2142;
}

.assistant-code-block__tok--comment{
  color: #7a809a;
  font-style: italic;
}

.assistant-code-block__tok--string{
  color: #0f766e;
}

.assistant-code-block__tok--keyword{
  color: #5b3fd1;
  font-weight: 700;
}

.assistant-code-block__tok--number{
  color: #b45309;
}

.assistant-code-block__tok--decorator,
.assistant-code-block__tok--symbol{
  color: #0f4fa8;
}

.assistant-suggestions--workspace{
  margin: 0;
  flex-wrap: wrap;
  overflow: visible;
}

.assistant-composer{
  margin-top: 2px;
}

.assistant-composer__inner{
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 8px 10px;
  border-radius: 22px;
  border: 1px solid rgba(58,52,133,0.12);
  background: rgba(255,255,255,0.94);
  box-shadow: 0 18px 44px rgba(53, 58, 118, 0.08);
}

.assistant-composer__textarea{
  width: 100%;
  min-height: 52px;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
  line-height: 1.42;
  color: var(--text);
  padding: 4px 2px;
}

.assistant-composer__textarea::placeholder{
  color: rgba(66, 63, 99, 0.42);
}

.assistant-composer__actions{
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.assistant-composer__send{
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(54,45,137,0.98), rgba(45,38,118,0.98));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 18px 36px rgba(58, 52, 133, 0.18);
}

.assistant-workspace__error{
  margin-top: 0;
}

.assistant-workspace .chat-ai-badge{
  height: 24px;
  padding: 0 10px;
  font-size: 11px;
}

.assistant-workspace .chat-context-badge{
  width: 30px;
  height: 30px;
}

.assistant-workspace .chat-context-badge__value{
  font-size: 9px;
}

.assistant-mode-group{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.88);
}

.assistant-mode-group__btn{
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: transparent;
  color: rgba(55, 50, 110, 0.78);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.assistant-mode-group__btn:hover{
  transform: translateY(-1px);
}

.assistant-mode-group__btn.is-active{
  background: linear-gradient(180deg, rgba(243,241,255,0.98), rgba(233,229,255,0.98));
  color: #4338b6;
  box-shadow: 0 10px 18px rgba(79, 74, 154, 0.12);
}

.assistant-web-toggle{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(58,52,133,0.16);
  background: rgba(255,255,255,0.88);
  color: rgba(48, 43, 96, 0.82);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.assistant-web-toggle:hover{
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(79, 74, 154, 0.12);
}

.assistant-web-toggle__dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(133, 139, 173, 0.86);
  box-shadow: 0 0 0 4px rgba(133, 139, 173, 0.12);
  transition: background .18s ease, box-shadow .18s ease;
}

.assistant-web-toggle[data-enabled="true"]{
  border-color: rgba(92, 82, 212, 0.26);
  background: linear-gradient(180deg, rgba(244,242,255,0.96), rgba(235,232,255,0.92));
  color: #4338b6;
}

.assistant-web-toggle[data-enabled="true"] .assistant-web-toggle__dot{
  background: #6b5df0;
  box-shadow: 0 0 0 4px rgba(107, 93, 240, 0.14);
}

.assistant-web-toggle[data-locked="true"]{
  border-color: rgba(92, 82, 212, 0.26);
  background: linear-gradient(180deg, rgba(244,242,255,0.96), rgba(235,232,255,0.92));
  color: #4338b6;
  cursor: default;
}

.assistant-thinking-group{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(58,52,133,0.14);
  background: rgba(255,255,255,0.88);
}

.assistant-thinking-group__btn{
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: transparent;
  color: rgba(55, 50, 110, 0.78);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.assistant-thinking-group__btn:hover{
  transform: translateY(-1px);
}

.assistant-thinking-group__btn.is-active{
  background: linear-gradient(180deg, rgba(243,241,255,0.98), rgba(233,229,255,0.98));
  color: #4338b6;
  box-shadow: 0 10px 18px rgba(79, 74, 154, 0.12);
}

.assistant-workspace .assistant-suggestions--workspace{
  gap: 6px;
}

.assistant-workspace .assistant-chip{
  padding: 6px 10px;
  font-size: 12px;
}

@media (max-width: 1080px){
  .assistant-appbar{
    max-width: calc(100vw - 18px);
    padding: 0 0 4px;
  }

  .assistant-shell{
    grid-template-columns: 1fr;
    gap: 0;
    max-width: calc(100vw - 18px);
    height: calc(100dvh - 82px);
  }

  @supports not (height: 100dvh){
    .assistant-shell{
      height: calc(100vh - 82px);
    }
  }

  .assistant-shell__sidebar{
    position: fixed;
    top: 78px;
    left: 10px;
    bottom: 10px;
    width: min(320px, calc(100vw - 20px));
    z-index: 140;
    transform: translateX(calc(-100% - 18px));
    transition: transform .2s ease;
  }

  .assistant-shell__sidebar.is-open{
    transform: translateX(0);
  }

  body.assistant-sidebar-open{
    overflow: hidden;
  }

  .assistant-workspace{
    padding: 14px;
    border-radius: 24px;
  }

  .assistant-workspace__menu{
    display: inline-flex;
  }

  .assistant-workspace__header{
    gap: 12px;
    flex-direction: column;
  }

  .assistant-workspace__header-actions{
    width: 100%;
    justify-content: flex-start;
  }

  .assistant-thread .msg .bubble{
    max-width: 100%;
  }
}

@media (max-width: 720px){
  body.messaging.messaging-assistant .page{
    padding: 6px;
  }

  body.messaging.messaging-inbox .page{
    padding: 8px 8px 18px;
  }

  body.messaging.messaging-inbox .container{
    max-width: none !important;
    margin-top: 4px !important;
  }

  body.messaging.messaging-inbox .card.inbox-page{
    padding: 14px 12px 14px;
    border-radius: 20px;
  }

  .messaging-inbox__header{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .messaging-inbox__heading h1{
    font-size: 30px;
  }

  .messaging-inbox__actions{
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }

  .messaging-inbox__actions .btn{
    width: 100%;
    justify-content: center;
  }

  .messaging-inbox__toolbar{
    margin-bottom: 0;
  }

  .messaging-inbox__search{
    min-height: 46px;
    padding: 0 14px;
    border-radius: 16px;
    font-size: 14px;
  }

  .messaging-inbox__list{
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  body.messaging.messaging-inbox .chat-row{
    padding: 12px;
    min-height: 0;
    border-radius: 18px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  body.messaging.messaging-inbox .chat-row__meta{
    width: 100%;
    min-width: 0;
    justify-content: space-between;
    align-items: center;
  }

  body.messaging.messaging-inbox .chat-row__time{
    font-size: 11px;
    white-space: normal;
  }

  body.messaging.messaging-inbox .item-title__text{
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .assistant-appbar__brand-text span{
    display: none;
  }

  .assistant-appbar{
    gap: 8px;
    align-items: center;
  }

  .assistant-appbar__actions .pill{
    padding: 9px 12px;
    font-size: 13px;
  }

  .assistant-workspace__title{
    font-size: 28px;
  }

  .assistant-empty__title{
    font-size: 34px;
  }

  .assistant-empty__text{
    font-size: 15px;
  }

  .assistant-workspace{
    padding: 12px 10px 12px;
    border-radius: 20px;
  }

  .assistant-workspace__header-left{
    width: 100%;
  }

  .assistant-workspace__titleblock{
    width: 100%;
  }

  .assistant-workspace__title-row{
    gap: 8px;
  }

  .assistant-workspace__header-actions{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .assistant-workspace__header-actions .btn{
    width: 100%;
    justify-content: center;
  }

  .assistant-thread{
    padding-right: 0;
  }

  .assistant-suggestions--workspace{
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .assistant-composer__inner{
    grid-template-columns: 1fr;
  }

  .assistant-composer__actions{
    justify-content: flex-end;
  }

  .assistant-composer__textarea{
    min-height: 88px;
    font-size: 16px;
  }

  .assistant-thread .msg .meta{
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media (max-width: 560px){
  .assistant-appbar{
    max-width: calc(100vw - 12px);
  }

  .assistant-appbar__brand{
    gap: 8px;
    min-width: 0;
  }

  .assistant-appbar__brand img{
    width: 34px;
    height: 34px;
  }

  .assistant-appbar__brand-text strong{
    font-size: 14px;
  }

  .assistant-shell{
    max-width: calc(100vw - 12px);
    height: calc(100dvh - 68px);
  }

  @supports not (height: 100dvh){
    .assistant-shell{
      height: calc(100vh - 68px);
    }
  }

  .assistant-shell__sidebar{
    top: 66px;
    left: 6px;
    bottom: 6px;
    width: min(300px, calc(100vw - 12px));
    border-radius: 18px;
  }

  .assistant-sidebar__footer{
    display: none;
  }

  .assistant-workspace__title{
    font-size: 24px;
  }

  .assistant-workspace__subtitle{
    font-size: 12px;
  }

  .assistant-workspace__title-row{
    align-items: flex-start;
  }

  .assistant-workspace .chat-ai-badge,
  .assistant-workspace .chat-context-widget,
  .assistant-mode-group,
  .assistant-web-toggle{
    flex: 0 0 auto;
  }

  .assistant-mode-group,
  .assistant-thinking-group{
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
  }

  .assistant-mode-group__btn,
  .assistant-thinking-group__btn{
    flex: 1 0 auto;
    padding: 7px 9px;
    font-size: 11px;
  }

  .assistant-thread .msg .bubble{
    max-width: 100%;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .assistant-thread .msg .meta{
    font-size: 11px;
  }

  .assistant-rich-text p,
  .assistant-thread .msg .msg-text{
    font-size: 13px;
    line-height: 1.45;
  }

  .assistant-composer__inner{
    padding: 6px 8px;
    border-radius: 18px;
  }

  .assistant-composer__textarea{
    min-height: 80px;
  }

  .assistant-composer__send{
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }
}
