:root {
  --bg-main: #131314;
  --bg-elevated: #1b1c1d;
  --bg-surface: #1e1f20;
  --bg-surface-2: #282a2c;
  --bg-hover: #333537;
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #e3e3e3;
  --text-secondary: #9aa0a6;
  --text-muted: #70757a;
  --accent: #a8c7fa;
  --accent-strong: #4c8df6;
  --accent-bg: rgba(0, 74, 119, 0.52);
  --purple: #c58af9;
  --danger: #f28b82;
  --success: #81c995;
  --warning: #fdd663;
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
  font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Roboto, Tahoma, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100dvh;
  background: var(--bg-main);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes sparkleSpin {
  0% { transform: rotate(0deg) scale(1); filter: hue-rotate(0deg); }
  50% { transform: rotate(180deg) scale(1.16); filter: hue-rotate(42deg); }
  100% { transform: rotate(360deg) scale(1); filter: hue-rotate(0deg); }
}
@keyframes shimmerMove {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}
@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 139, 130, 0.55); }
  50% { box-shadow: 0 0 0 10px rgba(242, 139, 130, 0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 16px) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.sparkle-grad {
  background: linear-gradient(90deg, #4285f4 0%, #9b72cb 50%, #d96570 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gem-sparkle {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gem-sparkle.thinking svg { animation: sparkleSpin 2.1s ease-in-out infinite; }

.svg-ic {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex-shrink: 0;
  fill: currentColor;
}
.svg-ic.sm { width: 16px; height: 16px; }
.svg-ic.xs { width: 14px; height: 14px; }
.svg-ic.lg { width: 22px; height: 22px; }
.spin-ic { animation: spin 0.9s linear infinite; }

.btn {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 9px 15px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.16s, transform 0.14s var(--spring), border-color 0.16s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg-hover); }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }
.btn-primary { background: var(--accent-strong); color: #131314; border: none; font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: #669df6; }
.btn-danger { background: rgba(242, 139, 130, 0.14); color: var(--danger); border-color: rgba(242, 139, 130, 0.3); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 10px; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s, transform 0.14s var(--spring);
  flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.del:hover { color: var(--danger); background: rgba(242, 139, 130, 0.14); }
.icon-btn.active-state { background: rgba(168, 199, 250, 0.18); color: var(--accent); }

input.field, textarea.field, select.field {
  background: var(--bg-surface-2);
  color: #fff;
  border: 1px solid var(--border);
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input.field:focus, textarea.field:focus, select.field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 199, 250, 0.14);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(129, 201, 149, 0.7);
}
.status-dot.warn { background: var(--warning); box-shadow: 0 0 8px rgba(253, 214, 99, 0.6); }
.status-dot.err { background: var(--danger); box-shadow: 0 0 8px rgba(242, 139, 130, 0.6); }

.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: #282a2c;
  color: #fff;
  border: 1px solid var(--border-strong);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  z-index: 500;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.58);
  display: none;
  align-items: center;
  gap: 8px;
  max-width: 92vw;
  animation: toastIn 0.26s var(--spring);
}
.toast.show { display: inline-flex; }
