:root {
  color-scheme: dark;
  --ink: #edf3ef;
  --muted: #91a9a1;
  --deep: #031217;
  --navy: #071f2a;
  --green: #0d352e;
  --mint: #89bd9e;
  --gold: #d9b76f;
  --line: rgba(224, 236, 231, 0.13);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.44);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 8%, rgba(40, 110, 82, 0.24), transparent 29rem),
    radial-gradient(circle at 5% 88%, rgba(17, 65, 90, 0.42), transparent 36rem),
    linear-gradient(145deg, var(--deep), #061d24 48%, #07191f);
}
body::before {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.24;
  background-image: radial-gradient(circle, rgba(255,255,255,0.16) 0 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}
a { color: inherit; text-decoration: none; }
button, textarea { font: inherit; }

.topbar {
  position: relative;
  z-index: 2;
  width: min(980px, calc(100% - 40px));
  min-height: 72px;
  margin: 22px auto 0;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(4, 25, 29, 0.72);
  backdrop-filter: blur(18px);
}
.brand, .topbar-actions { display: flex; align-items: center; gap: 10px; }
.brand { font-size: 1.08rem; font-weight: 760; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; color: #08211b; background: linear-gradient(145deg, #cbdcc9, #79b18f); }
.account { max-width: 250px; overflow: hidden; color: var(--muted); font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.quiet-link, .all-tickets { min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 999px; color: #c8d5d0; }
.all-tickets { margin-left: auto; font-size: 0.78rem; }

.page-shell { position: relative; z-index: 1; width: min(980px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 70px; }
.page-heading { padding: 52px 4px 26px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 12px; color: var(--gold); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.15em; text-transform: uppercase; }
.page-heading h1 { margin: 0; font: 500 clamp(2.5rem, 7vw, 4.8rem)/0.98 Georgia, serif; letter-spacing: -0.045em; }
.page-heading > div > p:last-child { max-width: 680px; margin: 16px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.ticket-chip { flex: 0 0 auto; min-height: 42px; padding: 0 15px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(137,189,158,0.22); border-radius: 999px; color: #bfd1c9; background: rgba(137,189,158,0.07); font-size: 0.8rem; }
.ticket-chip[hidden] { display: none; }
.ticket-dot, .online-dot { display: inline-block; border-radius: 50%; background: #80cf9d; box-shadow: 0 0 10px rgba(128,207,157,0.62); }
.ticket-dot { width: 7px; height: 7px; }

.hotline-card {
  min-height: min(660px, calc(100vh - 250px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 100% 0%, rgba(217,183,111,0.08), transparent 24rem),
    linear-gradient(145deg, rgba(11, 49, 40, 0.82), rgba(6, 27, 38, 0.93));
  box-shadow: var(--shadow);
}
.hotline-card[hidden] { display: none; }
.hotline-header { min-height: 86px; padding: 17px 22px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); }
.assistant-avatar { display: grid; flex: 0 0 50px; width: 50px; height: 50px; place-items: center; border-radius: 17px; color: #11231c; background: linear-gradient(145deg, #e0cb91, #b69858); box-shadow: 0 10px 28px rgba(217,183,111,0.18); font-size: 1.2rem; }
.hotline-header h2 { margin: 0; font: 500 1.35rem/1.2 Georgia, serif; }
.hotline-header p { margin: 5px 0 0; color: var(--muted); font-size: 0.78rem; }
.online-dot { width: 6px; height: 6px; margin-right: 6px; }

.messages { min-height: 0; padding: 26px; display: flex; flex-direction: column; gap: 11px; overflow-y: auto; scrollbar-gutter: stable; }
.welcome-message { margin: auto; max-width: 430px; display: grid; justify-items: center; gap: 9px; color: var(--muted); text-align: center; }
.welcome-message > span { display: grid; width: 56px; height: 56px; place-items: center; border: 1px solid rgba(217,183,111,0.25); border-radius: 18px; color: var(--gold); background: rgba(217,183,111,0.07); font-size: 1.25rem; }
.welcome-message strong { color: #dce7e2; font: 500 1.28rem/1.3 Georgia, serif; }
.welcome-message p { margin: 0; line-height: 1.55; }
.message { width: fit-content; max-width: min(78%, 650px); padding: 12px 15px; border: 1px solid var(--line); border-radius: 17px 17px 17px 5px; color: #dce7e2; background: rgba(255,255,255,0.055); line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.message.is-mine { align-self: flex-end; border-color: rgba(137,189,158,0.18); border-radius: 17px 17px 5px 17px; color: #082019; background: linear-gradient(145deg, #c8dbc8, #84b596); }
.message a { color: inherit; text-decoration: underline; font-weight: 720; }
.message-meta { display: block; margin-top: 5px; color: #78928a; font-size: 0.68rem; }
.message.is-mine .message-meta { color: rgba(8,32,25,0.62); text-align: right; }
.thinking { align-self: flex-start; display: inline-flex; gap: 5px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 17px 17px 17px 5px; background: rgba(255,255,255,0.04); }
.thinking span { width: 6px; height: 6px; border-radius: 50%; background: #9ab0a8; animation: breathe 1s ease-in-out infinite; }
.thinking span:nth-child(2) { animation-delay: 0.15s; }
.thinking span:nth-child(3) { animation-delay: 0.3s; }
@keyframes breathe { 0%, 100% { opacity: 0.35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.status-row { min-height: 29px; padding: 5px 22px; color: #79928a; background: rgba(2,16,20,0.28); font-size: 0.73rem; }
.status-row.is-error { color: #efb4ab; }
.composer { padding: 12px 18px 17px; display: grid; grid-template-columns: 46px minmax(0, 1fr) 50px; align-items: end; gap: 9px; background: rgba(2,16,20,0.28); }
.attach-button { width: 46px; height: 50px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 15px; color: #b7cac2; background: rgba(255,255,255,0.035); cursor: pointer; font-size: 1.35rem; }
.composer textarea { width: 100%; min-height: 50px; max-height: 150px; padding: 14px 15px; resize: none; overflow-y: auto; outline: none; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: rgba(255,255,255,0.055); font-size: 16px; line-height: 1.4; }
.composer textarea:focus { border-color: rgba(217,183,111,0.52); box-shadow: 0 0 0 3px rgba(217,183,111,0.07); }
.composer button { width: 50px; height: 50px; border: 0; border-radius: 15px; color: #11231c; background: linear-gradient(145deg, #dfca91, #b59757); cursor: pointer; font-weight: 900; }
.composer button:disabled, .attach-button.is-disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.auth-gate { max-width: 550px; margin: 42px auto 80px; padding: 34px; border: 1px solid var(--line); border-radius: 28px; background: rgba(9,39,38,0.78); box-shadow: var(--shadow); text-align: center; }
.auth-gate[hidden] { display: none; }
.gate-mark { width: 56px; height: 56px; margin: 0 auto 19px; display: grid; place-items: center; border-radius: 18px; color: #11231c; background: linear-gradient(145deg, #dfca91, #b59757); }
.auth-gate h2 { margin: 0; font: 500 clamp(2rem, 7vw, 3rem)/1 Georgia, serif; }
.auth-gate p { margin: 16px auto 23px; color: var(--muted); line-height: 1.65; }
.gate-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.primary-action, .secondary-action { min-height: 46px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-weight: 730; }
.primary-action { color: #11231c; background: linear-gradient(145deg, #dfca91, #b59757); }
.secondary-action { border: 1px solid var(--line); color: #d4dfda; background: rgba(255,255,255,0.035); }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 20px; max-width: min(430px, calc(100% - 30px)); padding: 11px 16px; border: 1px solid var(--line); border-radius: 999px; color: #e8efeb; background: rgba(4,24,29,0.96); box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: 180ms ease; text-align: center; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 700px) {
  .topbar, .page-shell { width: min(100% - 24px, 980px); }
  .topbar { margin-top: 12px; border-radius: 22px; }
  .account { display: none; }
  .page-heading { padding: 38px 2px 22px; align-items: flex-start; flex-direction: column; }
  .hotline-card { min-height: calc(100dvh - 226px); border-radius: 22px; }
  .hotline-header { padding: 14px; }
  .all-tickets { padding: 0 12px; }
  .messages { padding: 18px 13px; }
  .message { max-width: 89%; }
  .composer { padding: 10px; grid-template-columns: 46px minmax(0, 1fr) 48px; }
  .status-row { padding-left: 12px; }
}
@media (max-width: 430px) {
  .brand > span:last-child { display: none; }
  .quiet-link { padding: 0 13px; }
  .hotline-header h2 { font-size: 1.12rem; }
  .all-tickets { width: 42px; padding: 0; overflow: hidden; color: transparent; }
  .all-tickets::after { content: "↗"; color: #c8d5d0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
