::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 25%, transparent);
  border-radius: 10px;
  transition: background var(--t-base);
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--muted) 45%, transparent);
}
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; background: var(--bg); }
body { height: 100%; font-family: 'Vazir', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.55; background: var(--bg); color: var(--fg); overflow: hidden; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration: none; }
button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}
.hidden { display: none !important; }
.ic {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  pointer-events: none;
}
.ico {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
  stroke-width: 1.5;
  flex-shrink: 0;
  pointer-events: none;
}
.glass { background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow), inset 0 1px 1px rgba(255, 255, 255, 0.08); backdrop-filter: blur(40px) saturate(200%); -webkit-backdrop-filter: blur(40px) saturate(200%); }
body.noglass .glass { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: var(--shadow2); }
.in, .ta { 
  width: 100%; 
  border: 1px solid var(--line); 
  background: var(--glass2); 
  color: var(--fg); 
  border-radius: 12px; 
  padding: 12px 16px; 
  font-size: 14.5px; 
  font-family: inherit; 
  outline: none; 
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.25s ease; 
  appearance: none; 
  caret-color: var(--accent); 
}
.in:focus, .ta:focus { 
  border-color: var(--accent); 
  background: var(--glass); 
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.in:focus-visible, .ta:focus-visible, button:focus-visible, a:focus-visible { outline: none; }
.in::placeholder, .ta::placeholder { color: var(--muted2); }
.ta { resize: none; min-height: 46px; max-height: 140px; line-height: 1.5; scrollbar-width: none; -ms-overflow-style: none; }
.ta::-webkit-scrollbar { display: none; }
.btn:not(.tab) {
  border: 1px solid var(--line);
  background: var(--glass2);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: all var(--t-base);
  white-space: nowrap;
  user-select: none;
  outline: none;
}
.btn:not(.tab) { 
  background: linear-gradient(135deg, var(--out1) 0%, var(--out2) 100%); 
  border: 0; 
  color: #fff; 
  font-weight: 650; 
  box-shadow: 0 4px 14px color-mix(in srgb, var(--out1) 30%, transparent); 
  letter-spacing: .02em; 
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, filter 0.2s ease;
}
.btn:not(.tab):hover { 
  transform: translateY(-3px) scale(1.02); 
  filter: brightness(1.1); 
  box-shadow: 0 12px 24px color-mix(in srgb, var(--out1) 45%, transparent); 
}
.btn:not(.tab):active { 
  transform: translateY(1px) scale(0.96); 
  box-shadow: 0 4px 8px color-mix(in srgb, var(--out1) 35%, transparent); 
  filter: brightness(0.9);
}
.btn:not(.tab):disabled { opacity: .6; cursor: default; box-shadow: none; transform: none; filter: none; }
.iconbtn { 
  width: 34px; 
  height: 34px; 
  padding: 0; 
  border-radius: 50%; 
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-base);
  color: var(--fg);
  border: none;
  background: none;
}
.iconbtn:hover { background: var(--tap); }
.iconbtn:active { background: var(--tap2); transform: translateY(1px) scale(0.97); }
.tag { padding: 4px 8px; border-radius: 999px; background: var(--glass3); color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
@media (hover: hover) {
  .iconbtn.danger:hover { background: color-mix(in srgb, #FF4444 24%, var(--glass2)); }
}
.iconbtn.danger { background: color-mix(in srgb, #FF4444 14%, var(--glass2)); border-color: color-mix(in srgb, #FF4444 30%, transparent); color: #FF6060; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(30px) scale(0.9);
  z-index: 2000;
  border-radius: 999px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  background: var(--glass2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--fg);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, filter 0.3s ease;
  backdrop-filter: blur(30px) saturate(150%);
  filter: blur(5px);
}
.toast.toast-error { background: rgb(255, 77, 79) !important; border-color: rgb(207, 19, 34) !important; color: #fff !important; }
.toast.toast-success { background: rgb(82, 196, 26) !important; border-color: rgb(56, 158, 13) !important; color: #fff !important; }
.toast.show { 
  opacity: 1; 
  transform: translateX(-50%) translateY(0) scale(1); 
  filter: blur(0);
}
.chat-loader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 100%;
  color: var(--muted);
}
.chat-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes spin { 
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); } 
}
.offline-banner {
  background: #ffb700;
  color: #000;
  text-align: center;
  padding: 4px;
  font-size: 12px;
  font-weight: 600;
  display: none;
}
body.offline .offline-banner { display: block; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 25%, transparent); border-radius: 10px; transition: background var(--t-base); }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 45%, transparent); }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }