.web-chat-page { overflow: hidden; background: #f7f9fc; }
.web-chat-page .site-footer,
.web-chat-page .mobile-telegram-cta { display: none; }
.web-chat-page .site-header { position: relative; z-index: 90; box-shadow: 0 1px 0 rgba(6,40,90,.08); }
.chat-inline-brand { display:none; }

.web-chat-shell {
  --chat-sidebar: 310px;
  position: relative;
  display: grid;
  grid-template-columns: var(--chat-sidebar) minmax(0,1fr);
  height: calc(100vh - 88px);
  height: calc(100dvh - 88px);
  min-height: 560px;
  color: #122d53;
  background: #f7f9fc;
  font-family: "Cairo", sans-serif;
  font-size: 16px;
}

.web-chat-sidebar {
  position: relative;
  z-index: 30;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid rgba(6,40,90,.1);
  background: #fff;
}
.chat-sidebar-head { display: flex; gap: 8px; padding: 19px 17px 13px; }
.chat-new-button {
  min-height: 48px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: #06285a;
  font: 700 14px "Cairo",sans-serif;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}
.chat-new-button:hover { background: #0d3f7c; transform: translateY(-1px); }
.chat-new-button span { font-size: 18px; line-height: 1; }
.chat-sidebar-close { display: none; width: 45px; border: 1px solid rgba(6,40,90,.12); border-radius: 13px; color: #61708a; background: #fff; font-size: 22px; cursor: pointer; }
.chat-history-heading { display: grid; gap: 3px; padding: 12px 20px 8px; }
.chat-history-heading span { color: #52637c; font-size: 13px; font-weight: 800; }
.chat-history-heading small { color: #61708a; font-size: 11px; }
.chat-history { flex: 1; overflow-y: auto; padding: 5px 10px 16px; scrollbar-width: thin; }
.chat-history-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  border: 0;
  border-radius: 12px;
  color: #263f64;
  background: transparent;
  text-align: right;
  font-family: "Cairo",sans-serif;
  cursor: pointer;
  transition: background .18s ease;
}
.chat-history-item:hover,
.chat-history-item.active { background: #f1f5fa; }
.history-icon { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: #0d3f7c; background: #e9f0f9; font-size: 13px; }
.chat-history-item > span:last-child { min-width: 0; display: grid; flex: 1; gap: 2px; }
.chat-history-item strong { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-item small { overflow: hidden; color: #61708a; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-empty { margin: 18px 10px; padding: 16px; border: 1px dashed rgba(6,40,90,.16); border-radius: 12px; color: #61708a; background: #fafbfd; font-size: 12px; line-height: 1.8; text-align: center; }
.chat-account-card { display: flex; align-items: center; gap: 10px; margin: 10px; padding: 12px; border: 1px solid rgba(6,40,90,.1); border-radius: 15px; background: #f9fbfd; }
.account-avatar { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: #06285a; background: #efc65f; font-size: 14px; font-weight: 800; }
.account-avatar.guest { color: #fff; background: #7790b4; }
.account-copy { min-width: 0; display: grid; flex: 1; gap: 2px; }
.account-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { overflow: hidden; color: #61708a; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.account-action { padding: 7px 10px; border: 0; border-radius: 8px; color: #0d3f7c; background: #e9f0f9; font: 700 12px "Cairo",sans-serif; cursor: pointer; }

.web-chat-main { min-width: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; }
.web-chat-topbar { min-height: 67px; display: flex; align-items: center; gap: 14px; padding: 10px clamp(16px,3vw,38px); border-bottom: 1px solid rgba(6,40,90,.08); background: rgba(255,255,255,.9); backdrop-filter: blur(12px); }
.chat-menu-button { display: none; width: 38px; height: 38px; border: 1px solid rgba(6,40,90,.12); border-radius: 11px; color: #06285a; background: #fff; cursor: pointer; }
.chat-university-select { position: relative; min-width: 260px; display: flex; align-items: center; gap: 9px; }
.chat-university-select select { max-width: 320px; appearance: none; padding: 8px 4px; border: 0; outline: 0; color: #122d53; background: transparent; font: 700 14px "Cairo",sans-serif; cursor: pointer; text-overflow: ellipsis; }
.selected-university-mark { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(6,40,90,.1); border-radius: 11px; color: #06285a; background: #fff1ce; font-size: 12px; font-weight: 800; }
.chat-university-select > span:last-child { color: #61708a; font-size: 12px; }
.chat-topbar-status { display: flex; align-items: center; gap: 7px; margin-right: auto; color: #52637c; font-size: 12px; }
.chat-topbar-status i { width: 7px; height: 7px; border-radius: 50%; background: #dda62f; box-shadow: 0 0 0 4px rgba(221,166,47,.12); }
.chat-login-button { padding: 9px 14px; border: 1px solid rgba(6,40,90,.17); border-radius: 11px; color: #06285a; background: #fff; font: 700 13px "Cairo",sans-serif; cursor: pointer; white-space: nowrap; }

.chat-thread { min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.chat-welcome { min-height: 100%; display: grid; place-content: center; justify-items: center; padding: 44px 24px 28px; text-align: center; }
.welcome-logo { width: 62px; height: 62px; display: grid; place-items: center; margin-bottom: 15px; border-radius: 20px; color: #06285a; background: #efc65f; box-shadow: 0 14px 30px rgba(221,166,47,.22); font-size: 29px; font-weight: 800; }
.welcome-kicker { color: #9a6809; font-size: 13px; font-weight: 800; }
.chat-welcome h1 { margin: 7px 0 10px; color: #0b2447; font-size: clamp(25px,3vw,40px); line-height: 1.45; letter-spacing: 0; }
.chat-welcome h1 em { color: #0d3f7c; font-style: normal; }
.chat-welcome > p { max-width: 700px; margin: 0; color: #5f7088; font-size: 15px; line-height: 1.9; }
.chat-suggestions-title { margin-top: 25px; color: #263f64; font-size: 14px; }
.chat-suggestions { width: min(780px,100%); display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 10px; }
.chat-suggestions button { min-height: 60px; display: flex; align-items: center; gap: 10px; padding: 13px 16px; border: 1px solid rgba(6,40,90,.11); border-radius: 14px; color: #263f64; background: #fff; box-shadow: 0 7px 22px rgba(6,40,90,.035); text-align: right; font: 600 14px/1.7 "Cairo",sans-serif; cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.chat-suggestions button:hover { transform: translateY(-2px); border-color: rgba(221,166,47,.65); box-shadow: 0 10px 28px rgba(6,40,90,.08); }
.chat-suggestions button span { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: #0d3f7c; background: #e9f0f9; }

.chat-messages { width: min(940px,calc(100% - 40px)); display: grid; align-content: start; gap: 26px; margin: 0 auto; padding: 36px 0 30px; }
.chat-message { display: grid; grid-template-columns: 36px minmax(0,1fr); align-items: start; gap: 11px; }
.chat-message.user { direction: ltr; }
.message-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: #06285a; background: #efc65f; font-size: 12px; font-weight: 800; }
.chat-message.user .message-avatar { color: #fff; background: #0d3f7c; }
.message-content { min-width: 0; direction: rtl; }
.message-bubble { width: max-content; max-width: min(780px,100%); padding: 15px 18px; border: 1px solid rgba(6,40,90,.1); border-radius: 5px 18px 18px 18px; color: #1f385d; background: #fff; box-shadow: 0 7px 24px rgba(6,40,90,.045); font-size: 16px; font-weight: 500; line-height: 1.9; white-space: normal; overflow-wrap: anywhere; }
.message-bubble.is-typing,.chat-message.user .message-bubble { white-space: pre-wrap; }
.chat-message.user .message-bubble { margin-right: auto; border-color: #0d3f7c; border-radius: 16px 16px 4px 16px; color: #fff; background: #0d3f7c; }
.message-bubble > :first-child { margin-top: 0; }
.message-bubble > :last-child { margin-bottom: 0; }
.message-bubble p { margin: .5em 0; }
.message-bubble .message-heading { margin: 1em 0 .35em; color: #0b2447; font-size: 1.08em; font-weight: 800; line-height: 1.65; }
.message-bubble ul,.message-bubble ol { margin: .5em 0; padding-right: 1.45em; }
.message-bubble li + li { margin-top: .3em; }
.message-bubble strong { color: #0b2447; font-weight: 800; }
.message-bubble code { padding: .08em .38em; border-radius: 5px; color: #173a68; background: #eef3f9; font: 600 .9em/1.7 monospace; direction: ltr; unicode-bidi: embed; }
.message-bubble .message-link { color:#0d3f7c; font-weight:800; text-decoration:underline; text-decoration-thickness:1.5px; text-underline-offset:3px; overflow-wrap:anywhere; }
.message-bubble .message-link:hover { color:#9a6809; }
.message-bubble .message-link:focus-visible { border-radius:4px; outline:3px solid rgba(221,166,47,.55); outline-offset:3px; }
.message-suggestions { max-width: 780px; display: grid; gap: 4px; margin-top: 13px; padding: 14px; border: 1px solid rgba(6,40,90,.1); border-radius: 15px; background: #fff; box-shadow: 0 7px 24px rgba(6,40,90,.035); }
.message-suggestions-title { color: #0b2447; font-size: 14px; }
.message-suggestions-hint { color: #61708a; font-size: 11px; }
.message-suggestions-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 7px; }
.message-suggestions-list button { min-height: 48px; position: relative; padding: 10px 13px 10px 34px; border: 1px solid rgba(6,40,90,.1); border-radius: 11px; color: #173a68; background: #f7f9fc; text-align: right; font: 600 13px/1.65 "Cairo",sans-serif; cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.message-suggestions-list button::after { content: "←"; position: absolute; left: 12px; top: 50%; color: #b57b0d; font-size: 15px; transform: translateY(-50%); }
.message-suggestions-list button:hover { border-color: rgba(221,166,47,.65); background: #fff9e9; transform: translateY(-1px); }
.message-feedback { display: flex; gap: 6px; margin-top: 9px; }
.message-feedback button { width: 34px; height: 32px; border: 1px solid rgba(6,40,90,.1); border-radius: 9px; color: #6d7b90; background: #fff; cursor: pointer; }
.message-feedback button.active { color: #0d3f7c; border-color: rgba(221,166,47,.5); background: #fff1ce; }
.chat-typing { width:min(640px,70vw); display:grid; gap:11px; color:#52637c; }
.chat-search-progress { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:0; padding:0; list-style:none; }
.chat-search-progress li { display:flex; align-items:center; gap:7px; min-width:0; padding:9px; border:1px solid rgba(6,40,90,.09); border-radius:10px; color:#61708a; background:#f7f9fc; font-size:11px; }
.chat-search-progress li > span { width:23px; height:23px; display:grid; place-items:center; flex:0 0 auto; border-radius:7px; color:#61708a; background:#e9f0f9; font-size:9px; font-weight:800; }
.chat-search-progress li strong { min-width:0; font-weight:700; line-height:1.6; }
.chat-search-progress li.is-active { color:#0d3f7c; border-color:rgba(221,166,47,.48); background:#fff9e9; }
.chat-search-progress li.is-active > span { color:#06285a; background:#efc65f; }
.chat-search-progress li.is-complete { color:#0c695b; background:#effaf6; }
.chat-search-progress li.is-complete > span { color:#fff; background:#0c695b; font-size:0; }
.chat-search-progress li.is-complete > span::after { content:"✓"; font-size:11px; }
.chat-typing > small { display:flex; align-items:center; gap:8px; color:#52637c; font-size:11px; line-height:1.7; }
.chat-typing-dots { display: inline-flex; align-items: center; gap: 4px; direction: ltr; }
.chat-typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: #8694a8; animation: chat-dot 1.1s infinite ease-in-out; }
.chat-typing-dots i:nth-child(2) { animation-delay: .14s; }
.chat-typing-dots i:nth-child(3) { animation-delay: .28s; }
@keyframes chat-dot { 0%,60%,100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
.chat-retry-button { min-height:40px; margin-top:9px; padding:8px 14px; border:1px solid rgba(6,40,90,.16); border-radius:10px; color:#0d3f7c; background:#fff; font:700 13px "Cairo",sans-serif; cursor:pointer; }
.chat-retry-button:hover { border-color:rgba(221,166,47,.6); background:#fff9e9; }

.chat-composer-wrap { padding: 7px clamp(16px,3vw,38px) 12px; background: linear-gradient(180deg,rgba(247,249,252,0),#f7f9fc 18%); }
.chat-limit-note { width: min(940px,100%); margin: 0 auto 6px; color: #52637c; font-size: 12px; text-align: left; }
.chat-composer { width: min(940px,100%); min-height: 60px; display: flex; align-items: end; gap: 10px; margin: 0 auto; padding: 9px 10px 9px 15px; border: 1px solid rgba(6,40,90,.15); border-radius: 18px; background: #fff; box-shadow: 0 15px 40px rgba(6,40,90,.09); }
.chat-composer:focus-within { border-color: rgba(221,166,47,.65); box-shadow: 0 0 0 4px rgba(221,166,47,.1),0 15px 40px rgba(6,40,90,.09); }
.chat-composer textarea { min-height: 38px; max-height: 150px; flex: 1; resize: none; padding: 7px 4px; border: 0; outline: 0; color: #122d53; background: transparent; font: 500 16px/1.75 "Cairo",sans-serif; }
.chat-composer textarea::placeholder { color: #61708a; }
.chat-composer button { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border: 0; border-radius: 12px; color: #fff; background: #06285a; font-size: 19px; cursor: pointer; }
.chat-composer button:disabled { opacity: .5; cursor: wait; }
.chat-composer button span { transform: rotate(-45deg); }
.chat-disclaimer { margin: 7px auto 0; color: #61708a; font-size: 11px; text-align: center; }

.chat-sidebar-backdrop { position: fixed; inset: 0; z-index: 24; border: 0; background: rgba(4,24,52,.4); backdrop-filter: blur(2px); }
.auth-modal { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; }
.auth-modal[hidden] { display: none; }
.auth-backdrop { position: absolute; inset: 0; border: 0; background: rgba(4,24,52,.58); backdrop-filter: blur(5px); cursor: pointer; }
.auth-dialog { position: relative; z-index: 1; width: min(470px,100%); padding: 30px; border-radius: 24px; background: #fff; box-shadow: 0 35px 90px rgba(4,24,52,.28); text-align: center; }
.auth-close { position: absolute; top: 14px; left: 14px; width: 34px; height: 34px; border: 0; border-radius: 10px; color: #6d7b90; background: #f1f5fa; font-size: 20px; cursor: pointer; }
.auth-brand { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 16px; color: #06285a; background: #efc65f; font-size: 23px; font-weight: 800; }
.auth-dialog h2 { margin: 0; color: #0b2447; font-size: 21px; }
.auth-dialog > p { margin: 9px auto 20px; color: #5f7088; font-size: 14px; line-height: 1.9; }
.google-login { min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid rgba(6,40,90,.15); border-radius: 13px; color: #263f64; background: #fff; font-size: 14px; font-weight: 700; }
.google-login span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #4285f4; font-family: Arial,sans-serif; font-weight: 700; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 17px 0; color: #61708a; font-size: 12px; }
.auth-divider::before,.auth-divider::after { content: ""; height: 1px; flex: 1; background: rgba(6,40,90,.1); }
.email-auth-form { display: grid; gap: 7px; text-align: right; }
.email-auth-form label { color: #52637c; font-size: 13px; font-weight: 700; }
.email-field-row { display: flex; gap: 7px; }
.email-field-row input { min-width: 0; min-height: 48px; flex: 1; padding: 9px 12px; border: 1px solid rgba(6,40,90,.14); border-radius: 12px; outline: 0; color: #122d53; background: #fbfcfe; font: 500 16px "Cairo",sans-serif; }
.email-field-row input:focus { border-color: rgba(221,166,47,.7); box-shadow: 0 0 0 3px rgba(221,166,47,.1); }
.email-field-row button { padding: 0 16px; border: 0; border-radius: 12px; color: #fff; background: #06285a; font: 700 13px "Cairo",sans-serif; cursor: pointer; }
.auth-text-button { justify-self: start; padding: 5px 0; border: 0; color: #0d3f7c; background: transparent; font: 700 12px "Cairo",sans-serif; cursor: pointer; }
.auth-status { min-height: 18px; margin: 10px 0 0 !important; color: #0d3f7c !important; font-weight: 700; }
.auth-status.error { color: #a33b3b !important; }
.auth-unavailable { padding: 13px; border-radius: 12px; color: #765e2d; background: #fff7df; font-size: 13px; line-height: 1.8; }
.auth-legal { display: block; margin-top: 12px; color: #61708a; font-size: 11px; }
.auth-legal a { color: #0d3f7c; text-decoration: underline; }

@media (max-width: 980px) {
  .web-chat-shell { grid-template-columns: 1fr; height: calc(100dvh - 76px); }
  .web-chat-page .site-header { min-height: 76px; }
  .web-chat-sidebar { position: fixed; top: 0; right: 0; bottom: 0; width: min(330px,88vw); z-index: 35; box-shadow: -20px 0 55px rgba(4,24,52,.2); transform: translateX(105%); transition: transform .24s ease; }
  .web-chat-shell.sidebar-open .web-chat-sidebar { transform: translateX(0); }
  .chat-sidebar-close,.chat-menu-button { display: block; }
  .web-chat-topbar { padding-inline: 14px; }
}

@media (max-width: 680px) {
  .web-chat-page { overflow: hidden; }
  .web-chat-page .site-header { display:none; }
  .web-chat-shell { height: 100dvh; min-height: 430px; }
  .web-chat-topbar { min-height: 64px; gap: 8px; padding-inline:10px; }
  .chat-inline-brand { order:1; display:flex; align-items:center; flex:0 0 auto; }
  .chat-inline-brand img { width:74px; height:auto; display:block; }
  .chat-menu-button { order:3; flex:0 0 auto; }
  .chat-university-select { min-width: 0; flex: 1; }
  .chat-university-select { order:2; }
  .chat-university-select select { min-width: 0; width: 100%; font-size: 14px; }
  .selected-university-mark { width: 31px; height: 31px; }
  .chat-topbar-status { display: none; }
  .chat-login-button { display:none; }
  .chat-welcome { justify-content: stretch; align-content: center; padding: 30px 16px 18px; }
  .welcome-logo { width: 52px; height: 52px; font-size: 24px; }
  .chat-welcome h1 { font-size: 23px; }
  .chat-welcome > p { font-size: 14px; }
  .chat-suggestions { grid-template-columns: 1fr; gap: 7px; margin-top: 20px; }
  .chat-suggestions button { min-height: 52px; font-size: 14px; }
  .chat-messages { width: calc(100% - 22px); gap: 18px; padding-block: 20px; }
  .chat-message { grid-template-columns: 30px minmax(0,1fr); gap: 8px; }
  .message-avatar { width: 30px; height: 30px; border-radius: 9px; font-size: 10px; }
  .message-bubble { font-size: 15px; padding: 13px 14px; line-height: 1.85; }
  .message-suggestions-list { grid-template-columns: 1fr; }
  .message-suggestions-list button { font-size: 13px; }
  .chat-typing { width:min(100%,calc(100vw - 75px)); }
  .chat-search-progress { grid-template-columns:1fr; }
  .chat-search-progress li { min-height:43px; font-size:12px; }
  .chat-composer-wrap { padding: 5px 9px calc(8px + env(safe-area-inset-bottom)); }
  .chat-composer { min-height: 52px; border-radius: 15px; }
  .chat-composer button { width: 37px; height: 37px; }
  .chat-disclaimer { display: none; }
  .auth-dialog { padding: 27px 18px 21px; }
  .email-field-row { display: grid; }
  .email-field-row button { min-height: 43px; }
}
