:root {
  --crimson:      #7A1C2A;
  --crimson-dark: #5C1220;
  --crimson-light:#9E2438;
  --gold:         #C9A227;
  --gold-bright:  #E0B830;
  --gold-pale:    #FBF5DC;
  --bg:           #EDE8DF;
  --surface:      #FEFCF8;
  --surface-alt:  #F5F0E8;
  --border:       rgba(90,35,25,0.09);
  --border-strong:rgba(90,35,25,0.18);
  --text:         #1C0E0A;
  --text-muted:   #7A5C54;
  --radius-sm:    8px;
  --radius:       16px;
  --radius-lg:    24px;
  --shadow-sm:    0 2px 14px rgba(90,35,25,0.08);
  --shadow-md:    0 6px 28px rgba(90,35,25,0.13);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── ANIMATIONS ── */
@keyframes splashLogoIn {
  0%   { opacity: 0; transform: scale(0.5) rotate(-10deg); }
  60%  { transform: scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes splashTextIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes authBoxIn {
  from { opacity: 0; transform: translateY(32px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes msgBounceIn {
  0%   { opacity: 0; transform: translateY(14px) scale(0.93); }
  55%  { transform: translateY(-3px) scale(1.015); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes panelSpring {
  0%   { opacity: 0; transform: translateY(-14px) scale(0.96); }
  65%  { transform: translateY(3px) scale(1.006); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modalIn {
  0%   { opacity: 0; transform: scale(0.88) translateY(24px); }
  65%  { transform: scale(1.02) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes wave {
  0%,80%,100% { transform: translateY(0); opacity: 0.4; }
  40%          { transform: translateY(-7px); opacity: 1; }
}
@keyframes splashPulse {
  0%,100% { box-shadow: 0 8px 30px rgba(201,162,39,0.4); transform: scale(1); }
  50%      { box-shadow: 0 8px 55px rgba(201,162,39,0.65); transform: scale(1.05); }
}
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 2px rgba(74,222,128,0.25); }
  50%      { box-shadow: 0 0 0 5px rgba(74,222,128,0.10); }
}
@keyframes drift1 { from { transform: translate(0,0) scale(1); } to { transform: translate(-40px,40px) scale(1.08); } }
@keyframes drift2 { from { transform: translate(0,0) scale(1); } to { transform: translate(30px,-30px) scale(1.05); } }
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes usageFill {
  from { width: 0%; }
}
@keyframes chipPop {
  0%   { opacity: 0; transform: scale(0.75) translateY(6px); }
  70%  { transform: scale(1.06) translateY(-1px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── SPLASH ── */
#splash-screen {
  position: fixed; inset: 0; z-index: 1100;
  background: linear-gradient(160deg, var(--crimson-dark) 0%, var(--crimson) 55%, #9E2438 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: opacity 0.5s ease;
}
#splash-screen.fade-out { opacity: 0; pointer-events: none; }
#splash-screen.gone { display: none; }
.splash-logo {
  width: 72px; height: 72px; border-radius: 20px;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 30px rgba(201,162,39,0.4);
  animation: splashLogoIn 0.7s cubic-bezier(0.34,1.56,0.64,1) both, splashPulse 2s ease-in-out 0.7s infinite;
}
.splash-logo svg { width: 38px; height: 38px; fill: var(--crimson-dark); }
.splash-title {
  font-family: 'Libre Baskerville', serif; font-size: 27px; color: #fff; font-weight: 700;
  animation: splashTextIn 0.5s ease 0.4s both;
}
.splash-sub {
  font-size: 11.5px; color: rgba(255,255,255,0.45); letter-spacing: 0.12em; text-transform: uppercase;
  animation: splashTextIn 0.5s ease 0.55s both;
}
.splash-dots { display: flex; gap: 9px; animation: splashTextIn 0.5s ease 0.7s both; }
.splash-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.3);
  animation: wave 1.4s ease-in-out infinite;
}
.splash-dots span:nth-child(2) { animation-delay: 0.18s; }
.splash-dots span:nth-child(3) { animation-delay: 0.36s; }

/* ── AUTH SCREEN ── */
#auth-screen {
  position: fixed; inset: 0; z-index: 999;
  background: linear-gradient(160deg, var(--crimson-dark) 0%, var(--crimson) 55%, #9E2438 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
#auth-screen.hidden { display: none; }

.auth-box {
  background: var(--surface); border-radius: 26px;
  padding: 38px 34px; width: 100%; max-width: 400px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.35);
  animation: authBoxIn 0.45s cubic-bezier(0.34,1.3,0.64,1) both;
}
.auth-logo { display: flex; align-items: center; gap: 13px; margin-bottom: 28px; }
.auth-logo-mark {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(201,162,39,0.4);
}
.auth-logo-mark svg { width: 23px; height: 23px; fill: var(--crimson-dark); }
.auth-logo-text { font-family: 'Libre Baskerville', serif; font-size: 20px; font-weight: 700; color: var(--crimson); }

.auth-tabs {
  display: flex; background: var(--surface-alt);
  border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 24px;
}
.auth-tab {
  flex: 1; padding: 9px; border-radius: 9px; border: none;
  font-size: 13px; font-weight: 600; font-family: 'Inter', sans-serif;
  cursor: pointer; transition: all 0.2s; color: var(--text-muted);
  background: transparent;
}
.auth-tab.active { background: var(--surface); color: var(--crimson); box-shadow: 0 1px 8px rgba(90,35,25,0.12); }

.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: 11.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.auth-field input {
  width: 100%; padding: 11px 14px; border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  font-size: 14px; font-family: 'Inter', sans-serif;
  background: var(--surface-alt); color: var(--text);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.auth-field input:focus { border-color: var(--crimson-light); background: var(--surface); box-shadow: 0 0 0 4px rgba(122,28,42,0.08); }

#pwd-strength { display: none; margin-top: 8px; }
.pwd-bars { display: flex; gap: 4px; margin-bottom: 6px; }
.pwd-bar { flex: 1; height: 3px; border-radius: 3px; background: var(--border-strong); transition: background 0.25s; }
.pwd-bar.active-1 { background: #DC2626; }
.pwd-bar.active-2 { background: #D97706; }
.pwd-bar.active-3 { background: #2563EB; }
.pwd-bar.active-4 { background: #16A34A; }
.pwd-rules { display: flex; flex-direction: column; gap: 3px; }
.pwd-rule { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); transition: color 0.2s; }
.pwd-rule.ok { color: #16A34A; }
.pwd-rule svg { width: 12px; height: 12px; flex-shrink: 0; }

.auth-btn {
  width: 100%; padding: 13px; border-radius: 12px;
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-dark) 100%);
  color: #fff; border: none; font-size: 14px; font-weight: 700;
  font-family: 'Inter', sans-serif; cursor: pointer;
  transition: all 0.22s; box-shadow: 0 4px 18px rgba(122,28,42,0.3);
  margin-top: 6px; position: relative; overflow: hidden;
}
.auth-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.12) 50%, transparent 100%);
  background-size: 200% auto;
  opacity: 0; transition: opacity 0.2s;
}
.auth-btn:hover { box-shadow: 0 8px 28px rgba(122,28,42,0.40); transform: translateY(-1px); }
.auth-btn:hover::after { opacity: 1; animation: shimmer 1s linear infinite; }
.auth-btn:active { transform: translateY(0); box-shadow: 0 3px 10px rgba(122,28,42,0.25); }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-error {
  background: rgba(220,38,38,0.07); border: 1px solid rgba(220,38,38,0.22);
  color: #DC2626; border-radius: 10px; padding: 10px 14px;
  font-size: 12.5px; margin-bottom: 14px; display: none;
  animation: fadeSlideUp 0.2s ease;
}
.auth-error.show { display: block; }
.auth-note { font-size: 11.5px; color: var(--text-muted); text-align: center; margin-top: 16px; line-height: 1.65; }

/* ── USAGE BAR ── */
#usage-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 18px; background: var(--surface-alt);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  font-size: 11.5px;
}
.usage-plan { font-weight: 700; color: var(--crimson); text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; }
.usage-track { flex: 1; height: 4px; background: var(--border-strong); border-radius: 4px; overflow: hidden; }
.usage-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--crimson-light), var(--gold)); transition: width 0.5s ease; animation: usageFill 0.8s ease; }
.usage-fill.warn { background: linear-gradient(90deg, #D97706, #F59E0B); }
.usage-fill.full { background: linear-gradient(90deg, #DC2626, #EF4444); }
.usage-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── USER MENU ── */
.user-menu-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18);
  border-radius: 22px; padding: 4px 10px 4px 4px;
  cursor: pointer; transition: background 0.2s, transform 0.15s; flex-shrink: 0;
  max-width: 160px;
}
.user-menu-btn:hover { background: rgba(255,255,255,0.20); transform: scale(1.02); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: var(--crimson-dark); flex-shrink: 0;
}
.user-email { font-size: 11px; color: rgba(255,255,255,0.78); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-dropdown {
  position: absolute; top: 62px; right: 16px; z-index: 200;
  background: var(--surface); border-radius: 14px;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  min-width: 190px; overflow: hidden; display: none;
  animation: fadeSlideUp 0.18s ease;
}
.user-dropdown.open { display: block; }
.user-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: 13px; color: var(--text);
  cursor: pointer; transition: background 0.15s; border: none;
  background: none; width: 100%; text-align: left; font-family: 'Inter', sans-serif;
}
.user-dropdown-item:hover { background: var(--surface-alt); }
.user-dropdown-item svg { width: 15px; height: 15px; fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-linecap: round; }
.user-dropdown-item.danger { color: #DC2626; }
.user-dropdown-item.danger svg { stroke: #DC2626; }
.user-dropdown-item.upgrade { color: var(--gold); font-weight: 600; }
.user-dropdown-item.upgrade svg { stroke: var(--gold); }

/* ── MODAL PLANES ── */
#plans-modal {
  display: none; position: fixed; inset: 0; z-index: 1200;
  background: rgba(30,8,6,0.65); backdrop-filter: blur(8px);
  align-items: center; justify-content: center; padding: 20px;
}
#plans-modal.open { display: flex; }
.plans-box {
  background: var(--surface); border-radius: 24px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,0.4);
  animation: modalIn 0.38s cubic-bezier(0.34,1.4,0.64,1);
}
.plans-header {
  background: linear-gradient(135deg, var(--crimson-dark) 0%, var(--crimson) 100%);
  border-radius: 24px 24px 0 0;
  padding: 24px 28px; display: flex; align-items: center; justify-content: space-between;
  position: relative; overflow: hidden;
}
.plans-header::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(201,162,39,0.12) 0%, transparent 60%);
  pointer-events: none;
}
.plans-header h2 { font-family: 'Libre Baskerville',serif; font-size: 19px; color: #fff; position: relative; }
.plans-header p { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 3px; position: relative; }
.plans-close {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); border-radius: 9px;
  width: 34px; height: 34px; cursor: pointer; color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.18s, transform 0.15s; position: relative;
}
.plans-close:hover { background: rgba(255,255,255,0.22); transform: rotate(90deg); }
.plans-body { padding: 22px 24px; }
.plans-current {
  background: linear-gradient(135deg, rgba(122,28,42,0.06) 0%, rgba(201,162,39,0.06) 100%);
  border-radius: 12px;
  padding: 12px 16px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid rgba(201,162,39,0.25);
}
.plans-current-label { font-size: 12px; color: var(--text-muted); }
.plans-current-plan { font-size: 13px; font-weight: 700; color: var(--crimson); text-transform: uppercase; }
.plans-current-msgs { font-size: 11.5px; color: var(--text-muted); margin-left: auto; }

.plan-card {
  border: 2px solid var(--border); border-radius: 16px;
  padding: 18px 20px; margin-bottom: 12px; cursor: pointer;
  transition: all 0.22s; position: relative; overflow: hidden;
}
.plan-card:hover { border-color: var(--crimson-light); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(122,28,42,0.12); }
.plan-card.selected { border-color: var(--crimson); background: rgba(122,28,42,0.04); box-shadow: 0 0 0 3px rgba(122,28,42,0.08); }
.plan-card.popular { border-color: var(--gold); }
.plan-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.plan-card-name { font-size: 15px; font-weight: 700; color: var(--crimson); }
.plan-card-price { font-size: 23px; font-weight: 800; color: var(--text); }
.plan-card-price span { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.plan-badge {
  position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  color: var(--crimson-dark);
  font-size: 9px; font-weight: 800; padding: 3px 12px; border-radius: 0 0 9px 9px;
  text-transform: uppercase; letter-spacing: 0.07em; white-space: nowrap;
}
.plan-card-feats { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.plan-card-feats li {
  font-size: 11px; color: var(--text-muted);
  background: var(--surface-alt); border-radius: 20px; padding: 3px 10px;
  border: 1px solid var(--border);
}
.plan-select-radio {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-strong); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
}
.plan-card.selected .plan-select-radio { border-color: var(--crimson); background: var(--crimson); }
.plan-select-radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; display: none; }
.plan-card.selected .plan-select-radio::after { display: block; }

.payment-methods { margin-top: 20px; }
.payment-methods h3 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.pay-method {
  border: 2px solid var(--border); border-radius: 12px; padding: 14px 16px;
  margin-bottom: 10px; cursor: pointer; transition: border-color 0.18s, transform 0.15s;
  display: flex; align-items: center; gap: 12px;
}
.pay-method:hover:not(.soon) { transform: translateX(2px); }
.pay-method.active { border-color: var(--crimson); }
.pay-method.soon { opacity: 0.5; cursor: not-allowed; }
.pay-method-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pay-method-info { flex: 1; }
.pay-method-name { font-size: 13px; font-weight: 600; color: var(--text); }
.pay-method-desc { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.pay-soon-tag { font-size: 9px; font-weight: 700; background: var(--border); color: var(--text-muted); padding: 2px 7px; border-radius: 20px; text-transform: uppercase; }

.pay-manual-details {
  background: linear-gradient(135deg, rgba(122,28,42,0.04) 0%, rgba(201,162,39,0.04) 100%);
  border-radius: 12px;
  padding: 16px; margin-top: 12px; border: 1.5px solid rgba(201,162,39,0.2);
  display: none;
}
.pay-manual-details.show { display: block; animation: fadeSlideUp 0.22s ease; }
.pay-manual-details h4 { font-size: 12px; font-weight: 700; color: var(--crimson); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.pay-detail-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.pay-detail-row:last-child { border-bottom: none; }
.pay-detail-row span:first-child { color: var(--text-muted); }
.pay-detail-row strong { color: var(--text); font-weight: 600; }
.pay-qr { text-align: center; margin-top: 12px; }
.pay-qr-box {
  width: 120px; height: 120px; margin: 0 auto 8px;
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-dark) 100%);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.4); font-size: 11px; text-align: center; padding: 10px;
}
.pay-qr p { font-size: 11px; color: var(--text-muted); }

.pay-confirm-btn {
  width: 100%; padding: 13px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-dark) 100%);
  color: #fff; font-size: 14px; font-weight: 600;
  font-family: 'Inter', sans-serif; cursor: pointer; margin-top: 16px;
  transition: all 0.22s; box-shadow: 0 4px 16px rgba(122,28,42,0.25);
}
.pay-confirm-btn:hover { transform: translateY(-1px); box-shadow: 0 7px 22px rgba(122,28,42,0.35); }
.pay-confirm-btn:disabled { background: #C5BDB8; cursor: not-allowed; transform: none; box-shadow: none; }
.pay-note { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 10px; line-height: 1.65; }

/* ── BODY ── */
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow-x: hidden;
}
body::before, body::after {
  content: ''; position: fixed; border-radius: 50%;
  pointer-events: none; z-index: 0;
}
body::before {
  width: 700px; height: 700px; top: -200px; right: -200px;
  background: radial-gradient(circle, rgba(122,28,42,0.05) 0%, transparent 70%);
  animation: drift1 20s ease-in-out infinite alternate;
}
body::after {
  width: 500px; height: 500px; bottom: -150px; left: -100px;
  background: radial-gradient(circle, rgba(201,162,39,0.05) 0%, transparent 70%);
  animation: drift2 25s ease-in-out infinite alternate;
}

#wrapper {
  position: relative; z-index: 1;
  width: 100%; max-width: 820px;
  display: flex; flex-direction: column;
}

/* ── HEADER ── */
#top-header {
  background: linear-gradient(135deg, var(--crimson-dark) 0%, var(--crimson) 65%, #9E2438 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 14px 20px;
  display: flex; align-items: center; gap: 12px;
  position: relative; overflow: hidden;
  flex-wrap: nowrap; min-width: 0;
}
#top-header::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(201,162,39,0.10) 0%, transparent 55%);
  pointer-events: none;
}
#top-header::after {
  content: ''; position: absolute;
  right: -40px; top: -40px; width: 220px; height: 220px;
  border-radius: 50%; border: 1px solid rgba(201,162,39,0.12);
}

.logo-mark {
  width: 48px; height: 48px; border-radius: 13px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-bright) 100%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 4px 16px rgba(201,162,39,0.4);
  transition: transform 0.2s;
}
.logo-mark:hover { transform: scale(1.05) rotate(-2deg); }
.logo-mark svg { width: 26px; height: 26px; fill: var(--crimson-dark); }

.brand { flex: 1; min-width: 0; overflow: hidden; }
.brand h1 {
  font-family: 'Libre Baskerville', serif;
  font-size: 19px; font-weight: 700;
  color: #fff; letter-spacing: -0.01em; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand p {
  font-size: 10px; color: rgba(255,255,255,0.45);
  margin-top: 3px; letter-spacing: 0.06em;
  text-transform: uppercase; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

.status-pill {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.13);
  border-radius: 20px; padding: 5px 13px; flex-shrink: 0;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4ADE80; box-shadow: 0 0 0 2px rgba(74,222,128,0.25);
  animation: pulse-dot 2s ease-in-out infinite;
}
.status-pill span { font-size: 11px; color: rgba(255,255,255,0.65); font-weight: 500; }

/* ── AREA SELECTOR BAR ── */
#area-selector-bar {
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
}
#area-toggle-btn {
  display: flex; align-items: center; gap: 9px;
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-dark) 100%);
  color: #fff; border: none; border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px; font-weight: 600; font-family: 'Inter', sans-serif;
  cursor: pointer; transition: all 0.2s; flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(122,28,42,0.22);
}
#area-toggle-btn:hover { box-shadow: 0 5px 18px rgba(122,28,42,0.32); transform: translateY(-1px); }
#area-toggle-btn:active { transform: scale(0.97) translateY(0); }
#area-toggle-btn svg { width: 15px; height: 15px; fill: none; stroke: white; stroke-width: 2; stroke-linecap: round; flex-shrink: 0; transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1); }
#area-toggle-btn.open svg { transform: rotate(180deg); }
#current-area-label {
  font-size: 12.5px; font-weight: 500; color: var(--text-muted);
  display: flex; align-items: center; gap: 7px;
}
#current-area-label svg { width: 14px; height: 14px; fill: var(--gold); flex-shrink: 0; }
#current-area-label span { color: var(--crimson); font-weight: 600; }

/* ── AREA PANEL ── */
#area-panel {
  position: absolute; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
  border: 1px solid var(--border-strong); border-top: none;
  box-shadow: var(--shadow-md);
  padding: 16px; display: none;
  grid-template-columns: repeat(3, 1fr); gap: 8px;
  animation: panelSpring 0.32s cubic-bezier(0.34,1.3,0.64,1);
}
#area-panel.open { display: grid; }

.area-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface-alt);
  cursor: pointer; transition: all 0.2s ease; text-align: left;
}
.area-card:hover {
  border-color: rgba(122,28,42,0.3); background: rgba(122,28,42,0.04);
  transform: translateY(-2px); box-shadow: var(--shadow-sm);
}
.area-card.active { border-color: var(--crimson); background: var(--crimson); }
.area-card.active .card-label { color: #fff; }
.area-card.active .card-icon svg { fill: var(--gold-bright); }
.card-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(122,28,42,0.07);
  display: flex; align-items: center; justify-content: center; transition: background 0.18s;
}
.area-card.active .card-icon { background: rgba(255,255,255,0.15); }
.card-icon svg { width: 16px; height: 16px; fill: var(--crimson-light); }
.card-label { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.2; }

/* ── APP CONTAINER ── */
#app {
  background: var(--surface);
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 580px;
  overflow: hidden; position: relative;
}
@media (max-height: 750px) { #app { height: calc(100vh - 180px); } }

/* ── MESSAGES ── */
#messages {
  flex: 1; overflow-y: auto; padding: 22px;
  display: flex; flex-direction: column; gap: 15px; scroll-behavior: smooth;
}
#messages::-webkit-scrollbar { width: 4px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.msg {
  display: flex; flex-direction: column; gap: 5px; max-width: 76%;
  animation: msgBounceIn 0.35s cubic-bezier(0.34,1.4,0.64,1) both;
}
.msg.user { align-self: flex-end; }
.msg.bot  { align-self: flex-start; }

.area-tag {
  font-size: 10px; color: var(--gold);
  font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.bubble {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.65; white-space: pre-wrap;
}
.msg.user .bubble {
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-dark) 100%);
  color: rgba(255,255,255,0.93);
  border-bottom-right-radius: var(--radius-sm);
  box-shadow: 0 4px 18px rgba(122,28,42,0.25);
}
.msg.bot .bubble {
  background: var(--surface-alt); color: var(--text);
  border-bottom-left-radius: var(--radius-sm);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.welcome-bubble {
  background: linear-gradient(135deg, rgba(122,28,42,0.04) 0%, rgba(201,162,39,0.05) 100%) !important;
  border-color: rgba(201,162,39,0.2) !important;
}
.ts { font-size: 10px; color: var(--text-muted); }
.msg.user .ts { text-align: right; }

.typing-wrap { align-self: flex-start; animation: fadeSlideUp 0.22s ease; }
.typing {
  display: flex; align-items: center; gap: 5px;
  padding: 13px 17px; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: var(--radius);
  border-bottom-left-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--crimson-light); opacity: 0.5;
  animation: wave 1.4s ease-in-out infinite;
}
.dot:nth-child(2) { animation-delay: 0.18s; }
.dot:nth-child(3) { animation-delay: 0.36s; }

/* ── CHIPS ── */
#chips {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 9px 18px 5px; border-top: 1px solid var(--border);
  background: var(--surface);
}
.chip {
  font-size: 11.5px; padding: 6px 14px; border-radius: 20px;
  background: var(--gold-pale); border: 1px solid rgba(201,162,39,0.28);
  color: #6B4A00; cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500;
  white-space: nowrap; transition: all 0.18s;
  animation: chipPop 0.3s cubic-bezier(0.34,1.5,0.64,1) both;
}
.chip:nth-child(1) { animation-delay: 0.05s; }
.chip:nth-child(2) { animation-delay: 0.1s; }
.chip:nth-child(3) { animation-delay: 0.15s; }
.chip:nth-child(4) { animation-delay: 0.2s; }
.chip:hover {
  background: rgba(201,162,39,0.2); border-color: rgba(201,162,39,0.55);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 12px rgba(201,162,39,0.18);
  color: #5A3800;
}
.chip:active { transform: translateY(0) scale(0.98); }

/* ── INPUT ── */
#input-area {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-end; background: var(--surface);
}
#user-input {
  flex: 1; border: 1.5px solid var(--border-strong); border-radius: 14px;
  padding: 11px 15px; font-size: 13.5px; font-family: 'Inter', sans-serif;
  resize: none; min-height: 44px; max-height: 110px;
  background: var(--surface-alt); color: var(--text); outline: none; line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
#user-input:focus {
  border-color: var(--crimson-light); background: var(--surface);
  box-shadow: 0 0 0 4px rgba(122,28,42,0.07);
}
#user-input::placeholder { color: var(--text-muted); }

#send-btn {
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-dark) 100%);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(122,28,42,0.28);
}
#send-btn:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 7px 22px rgba(122,28,42,0.38); }
#send-btn:active { transform: translateY(0) scale(0.97); }
#send-btn:disabled { background: #C5BDB8; cursor: not-allowed; transform: none; box-shadow: none; }
#send-btn svg { width: 18px; height: 18px; fill: none; stroke: white; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s; }
#send-btn:not(:disabled):hover svg { transform: translateX(2px) rotate(-5deg); }

#new-chat-btn {
  width: 44px; height: 44px; border-radius: 13px;
  background: var(--surface-alt); border: 1.5px solid var(--border-strong);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text-muted); transition: all 0.2s;
}
#new-chat-btn:hover { background: var(--gold-pale); border-color: rgba(201,162,39,0.4); color: var(--gold); transform: rotate(5deg) scale(1.05); }
#new-chat-btn svg { width: 18px; height: 18px; }

.session-divider {
  display: flex; align-items: center; gap: 10px; margin: 4px 0;
  font-size: 10.5px; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase;
}
.session-divider::before, .session-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── FOOTER ── */
#footer-bar {
  background: linear-gradient(135deg, var(--crimson-dark) 0%, var(--crimson) 100%);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: 11px 24px; text-align: center;
}
#footer-bar p { font-size: 10.5px; color: rgba(255,255,255,0.30); letter-spacing: 0.04em; }

/* ── OVERLAY ── */
#overlay { display: none; position: fixed; inset: 0; z-index: 99; }
#overlay.open { display: block; }

/* ── HISTORIAL DRAWER ── */
#history-drawer {
  position: absolute; top: 0; left: 0; bottom: 0; width: 280px; z-index: 101;
  background: var(--surface); border-right: 1px solid var(--border-strong);
  box-shadow: 4px 0 28px rgba(122,28,42,0.14);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.34,1.2,0.64,1);
  display: flex; flex-direction: column;
}
#history-drawer.open { transform: translateX(0); }
.hist-header {
  background: linear-gradient(135deg, var(--crimson-dark) 0%, var(--crimson) 100%);
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.hist-header span { font-size: 13px; font-weight: 600; color: #fff; }
.hist-close { background: none; border: none; cursor: pointer; color: rgba(255,255,255,0.6); display: flex; align-items: center; transition: color 0.15s, transform 0.2s; }
.hist-close:hover { color: #fff; transform: rotate(90deg); }
.hist-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#history-panel { flex: 1; overflow-y: auto; padding: 8px; }
#history-panel::-webkit-scrollbar { width: 3px; }
#history-panel::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.hist-item {
  padding: 11px 12px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid transparent; background: var(--surface-alt);
  margin-bottom: 6px; transition: all 0.18s;
}
.hist-item:hover { border-color: rgba(122,28,42,0.18); background: rgba(122,28,42,0.04); transform: translateX(2px); }
.hist-area { font-size: 10px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.hist-preview { font-size: 12.5px; color: var(--text); line-height: 1.4; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hist-meta { display: flex; align-items: center; justify-content: space-between; }
.hist-meta span { font-size: 10.5px; color: var(--text-muted); }
.hist-del { background: none; border: none; cursor: pointer; padding: 2px; color: var(--text-muted); display: flex; align-items: center; transition: color 0.15s, transform 0.15s; border-radius: 4px; }
.hist-del:hover { color: #DC2626; background: rgba(220,38,38,0.08); transform: scale(1.15); }
.hist-del svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

#hist-btn {
  width: 44px; height: 44px; border-radius: 13px;
  background: var(--surface-alt); border: 1.5px solid var(--border-strong);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text-muted); transition: all 0.2s; position: relative;
}
#hist-btn:hover { background: var(--gold-pale); border-color: rgba(201,162,39,0.4); color: var(--gold); }
#hist-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hist-count {
  position: absolute; top: -4px; right: -4px; width: 17px; height: 17px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright)); color: var(--crimson-dark);
  font-size: 9px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}

/* ── VIEW TOGGLE ── */
#view-toggle {
  display: flex; background: rgba(255,255,255,0.10); border-radius: 10px;
  padding: 3px; gap: 2px; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.14);
}
.vt-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 11px; border-radius: 8px; border: none;
  font-size: 11.5px; font-weight: 600; font-family: 'Inter', sans-serif;
  cursor: pointer; transition: all 0.2s;
  color: rgba(255,255,255,0.55); background: transparent; white-space: nowrap;
}
.vt-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.vt-btn.active { background: rgba(255,255,255,0.18); color: #fff; box-shadow: 0 1px 8px rgba(0,0,0,0.25); }
.vt-btn:hover:not(.active) { color: rgba(255,255,255,0.82); background: rgba(255,255,255,0.08); }

/* ── BIBLIOTECA ── */
#lib-view { display: none; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }
#lib-view.active { display: flex !important; }
#chat-view { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }
#chat-view.hidden { display: none !important; }

#lib-search-bar {
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface); display: flex; gap: 10px; align-items: center; flex-shrink: 0;
}
#lib-search-input {
  flex: 1; border: 1.5px solid var(--border-strong); border-radius: 10px;
  padding: 9px 14px; font-size: 13px; font-family: 'Inter', sans-serif;
  background: var(--surface-alt); color: var(--text); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#lib-search-input:focus { border-color: var(--crimson-light); background: var(--surface); box-shadow: 0 0 0 4px rgba(122,28,42,0.07); }
#lib-search-input::placeholder { color: var(--text-muted); }
.lib-search-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-alt); border: 1.5px solid var(--border-strong); border-radius: 10px;
}
.lib-search-icon svg { width: 16px; height: 16px; fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-linecap: round; }

#lib-body { display: flex; flex: 1; overflow: hidden; }
#lib-sidebar {
  width: 195px; flex-shrink: 0; border-right: 1px solid var(--border);
  overflow-y: auto; background: var(--surface-alt); padding: 10px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
#lib-sidebar::-webkit-scrollbar { width: 3px; }
#lib-sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.lib-cat-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 9px; border: none;
  background: transparent; cursor: pointer; font-size: 12px; font-weight: 500;
  font-family: 'Inter', sans-serif; color: var(--text-muted); text-align: left; width: 100%;
  transition: all 0.18s;
}
.lib-cat-btn svg { width: 15px; height: 15px; fill: var(--text-muted); flex-shrink: 0; transition: fill 0.18s; }
.lib-cat-btn:hover { background: rgba(122,28,42,0.06); color: var(--text); transform: translateX(2px); }
.lib-cat-btn.active { background: var(--crimson); color: #fff; }
.lib-cat-btn.active svg { fill: var(--gold-bright); }

#lib-list {
  width: 220px; flex-shrink: 0; border-right: 1px solid var(--border);
  overflow-y: auto; background: var(--surface); padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
#lib-list::-webkit-scrollbar { width: 3px; }
#lib-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.lib-item {
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid transparent; transition: all 0.18s; background: var(--surface-alt);
}
.lib-item:hover { border-color: rgba(122,28,42,0.15); background: rgba(122,28,42,0.04); transform: translateX(2px); }
.lib-item.active { border-color: var(--crimson); background: rgba(122,28,42,0.06); }
.lib-item-name { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.3; margin-bottom: 3px; }
.lib-item-law { font-size: 10.5px; color: var(--gold); font-weight: 700; letter-spacing: 0.04em; }
.lib-item-desc { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

#lib-detail { flex: 1; overflow-y: auto; padding: 20px 22px; background: var(--surface); }
#lib-detail::-webkit-scrollbar { width: 4px; }
#lib-detail::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.lib-detail-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-muted); }
.lib-detail-empty svg { width: 40px; height: 40px; fill: var(--border-strong); }
.lib-detail-empty p { font-size: 13px; text-align: center; }

.lib-detail-header { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); animation: fadeSlideUp 0.25s ease; }
.lib-detail-law { font-size: 11px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.lib-detail-title { font-family: 'Libre Baskerville', serif; font-size: 17px; font-weight: 700; color: var(--crimson); line-height: 1.25; margin-bottom: 8px; }
.lib-detail-meta { font-size: 11.5px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 12px; }
.lib-detail-meta span { display: flex; align-items: center; gap: 4px; }

.lib-ask-btn {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 14px;
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-dark) 100%);
  color: #fff; border: none; border-radius: 9px; padding: 8px 16px;
  font-size: 12px; font-weight: 600; font-family: 'Inter', sans-serif;
  cursor: pointer; transition: all 0.2s; box-shadow: 0 3px 12px rgba(122,28,42,0.25);
}
.lib-ask-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 18px rgba(122,28,42,0.35); }
.lib-ask-btn svg { width: 13px; height: 13px; fill: none; stroke: white; stroke-width: 2; stroke-linecap: round; }

.lib-section { margin-bottom: 20px; animation: fadeSlideUp 0.3s ease; }
.lib-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.lib-section p { font-size: 13px; color: var(--text); line-height: 1.7; margin-bottom: 10px; }

.arts-grid { display: flex; flex-direction: column; gap: 8px; }
.art-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; transition: box-shadow 0.18s, transform 0.18s; }
.art-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.art-card-num { font-size: 10.5px; font-weight: 700; color: var(--crimson-light); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.art-card-text { font-size: 12.5px; color: var(--text); line-height: 1.6; }

.lib-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lib-tag {
  font-size: 11px; padding: 4px 11px; border-radius: 10px;
  background: var(--gold-pale); color: #6B4A00;
  border: 1px solid rgba(201,162,39,0.25); font-weight: 500;
  cursor: pointer; transition: all 0.18s;
}
.lib-tag:hover { background: rgba(201,162,39,0.22); transform: scale(1.04); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  #lib-sidebar { width: 150px; }
  #lib-list { width: 180px; }
  body { padding: 16px 12px; align-items: flex-start; }
  #app { height: calc(100svh - 220px); min-height: 360px; }
  #area-panel { grid-template-columns: repeat(3, 1fr); }
  .msg { max-width: 86%; }
}
@media (max-width: 560px) {
  #lib-sidebar { display: none; }
  #lib-list { width: 140px; }
  .lib-detail-title { font-size: 15px; }
  body { padding: 0; align-items: stretch; min-height: 100svh; background: var(--crimson-dark); }
  body::before, body::after { display: none; }
  #wrapper { max-width: 100%; min-height: 100svh; flex-direction: column; }
  #top-header { border-radius: 0; padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); flex-shrink: 0; }
  .logo-mark { width: 40px; height: 40px; border-radius: 10px; }
  .logo-mark svg { width: 22px; height: 22px; }
  .brand h1 { font-size: 17px; }
  .brand p { font-size: 10px; }
  .status-pill { display: none; }
  #area-selector-bar { border-left: none; border-right: none; padding: 9px 12px; flex-shrink: 0; }
  #area-toggle-btn { padding: 8px 13px; font-size: 12.5px; }
  #area-panel { grid-template-columns: repeat(2, 1fr); border-radius: 0 0 14px 14px; padding: 12px; }
  .area-card { padding: 10px 11px; gap: 6px; }
  .card-icon { width: 28px; height: 28px; }
  .card-label { font-size: 11.5px; }
  #app { flex: 1; border-left: none; border-right: none; height: auto; min-height: 0; border-radius: 0; }
  #messages { flex: 1; padding: 14px 12px; gap: 12px; overscroll-behavior: contain; }
  .msg { max-width: 90%; }
  .bubble { font-size: 13px; padding: 10px 13px; border-radius: 14px; }
  .msg.user .bubble { border-bottom-right-radius: 5px; }
  .msg.bot .bubble { border-bottom-left-radius: 5px; }
  .ts { font-size: 9.5px; }
  #chips { flex-shrink: 0; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 8px 12px 6px; }
  #chips::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; font-size: 11px; padding: 5px 11px; }
  #input-area { flex-shrink: 0; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); gap: 9px; }
  #user-input { font-size: 16px; padding: 10px 13px; border-radius: 12px; min-height: 42px; }
  #send-btn { width: 42px; height: 42px; border-radius: 12px; }
  #new-chat-btn { width: 42px; height: 42px; border-radius: 12px; }
  #footer-bar { display: none; }
}
@media (max-width: 560px) {
  #top-header { gap: 8px; padding: 12px 14px; }
  .logo-mark { width: 36px; height: 36px; border-radius: 9px; }
  .logo-mark svg { width: 20px; height: 20px; }
  .brand h1 { font-size: 16px; }
  .brand p { display: none; }
  .user-email { display: none; }
  .user-menu-btn { padding: 4px; border-radius: 50%; max-width: none; }
  .vt-btn { padding: 5px 8px; font-size: 11px; gap: 4px; }
}
@media (max-width: 360px) {
  .brand h1 { font-size: 14px; }
  #area-panel { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .bubble { font-size: 12.5px; }
}
