/* ==========================================================================
   Marquis AI — ai.markquis.cv
   Palet: biru-putih Marquis One. Tanpa emas, tanpa dark mode.
   Mobile-first, tanpa dependensi eksternal.
   ========================================================================== */

/* ------------------------------- 1. Reset ------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #0f172a;
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
textarea,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.32);
  border-radius: 10px;
}

::selection {
  background: #bfdbfe;
  color: #1e3a8a;
}

.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;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: #1e40af;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  text-decoration: none;
  transition: top 0.18s ease;
}

.skip-link:focus {
  top: 10px;
}

/* ------------------------------ 2. Token ------------------------------- */
:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1e40af;
  --blue-800: #1e3a8a;

  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-400: #94a3b8;

  --line: #e5edf9;
  --line-strong: #d6e3f6;
  --surface: #ffffff;
  --surface-soft: #f7faff;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 12px 30px -18px rgba(30, 64, 175, 0.35), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 30px 60px -30px rgba(30, 64, 175, 0.35), 0 8px 20px rgba(15, 23, 42, 0.06);

  --font-mono: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace;
}

/* ----------------------------- 3. Kerangka ----------------------------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(1100px 480px at 50% -160px, #e6f0ff 0%, rgba(239, 246, 255, 0) 70%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

/* Topbar */
.topbar {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  min-width: 0;
  flex: 0 0 auto;
  order: 1;
}

.brand__logo {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 11px;
  overflow: hidden;
  background: linear-gradient(150deg, var(--blue-600), var(--blue-700));
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08), 0 6px 14px -8px rgba(30, 64, 175, 0.55);
  display: grid;
  place-items: center;
}

.brand__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

/* Placeholder kalau marquis-one-logo.jpg belum di-upload */
.brand__logo-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand__logo img.is-missing {
  display: none;
}

.brand__text {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.brand__name {
  font-size: 15.5px;
  font-weight: 750;
  letter-spacing: -0.2px;
  color: var(--ink-900);
  white-space: nowrap;
}

.brand__tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--blue-700);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  padding: 2px 6px;
  border-radius: 7px;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 0 0 auto;
  order: 3;
}

.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  order: 2;
  flex: 1 1 auto;
  max-width: 260px;
  padding: 8px 10px 8px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-900);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}

.model-pill:hover {
  border-color: var(--blue-300);
  box-shadow: 0 3px 10px -4px rgba(37, 99, 235, 0.35);
}

.model-pill:active {
  transform: scale(0.985);
}

.model-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  flex: 0 0 auto;
}

.model-pill__dot.is-off {
  background: var(--ink-400);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.18);
}

.model-pill__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-pill__chev {
  width: 14px;
  height: 14px;
  color: var(--ink-500);
  flex: 0 0 auto;
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 650;
  transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn--ghost {
  color: var(--blue-700);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
}

.btn--ghost:hover {
  background: #e3eeff;
  border-color: var(--blue-200);
}

.btn--ghost:active {
  transform: scale(0.98);
}

/* Stage + thread */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cddcf3 transparent;
  -webkit-overflow-scrolling: touch;
}

.thread::-webkit-scrollbar {
  width: 8px;
}

.thread::-webkit-scrollbar-thumb {
  background: #cddcf3;
  border-radius: 99px;
}

.thread::-webkit-scrollbar-track {
  background: transparent;
}

.thread__inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 14px 8px;
}

/* ----------------------------- 4. Welcome ------------------------------ */
.welcome {
  padding: 10px 2px 4px;
  animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.welcome__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 6px 12px 6px 10px;
  background: var(--surface);
  border: 1px solid var(--blue-100);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.1px;
  color: var(--blue-700);
  box-shadow: var(--shadow-xs);
}

.pulse {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue-600);
  flex: 0 0 auto;
}

.pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(37, 99, 235, 0.45);
  animation: pulse-ring 2.4s ease-out infinite;
}

.welcome__title {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.9px;
  font-weight: 800;
  color: var(--ink-900);
}

.welcome__accent {
  background: linear-gradient(100deg, var(--blue-600) 10%, var(--blue-700) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.welcome__lede {
  margin: 0 0 20px;
  max-width: 58ch;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink-500);
}

.chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.chip {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  align-items: start;
  gap: 5px;
  padding: 12px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.16s ease, box-shadow 0.18s ease, transform 0.14s ease;
}

.chip:hover {
  border-color: var(--blue-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.chip:active {
  transform: translateY(0) scale(0.99);
}

.chip__icon {
  width: 30px;
  height: 30px;
  margin-bottom: 3px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--blue-50);
  color: var(--blue-600);
  border: 1px solid #e0ecff;
}

.chip__icon svg {
  width: 17px;
  height: 17px;
}

.chip__title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.1px;
}

.chip__text {
  font-size: 11.5px;
  color: var(--ink-500);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-500);
}

.facts li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.facts svg {
  width: 13px;
  height: 13px;
  color: var(--blue-600);
}

/* ----------------------------- 5. Messages ----------------------------- */
.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0 8px;
}

.msg {
  animation: rise 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.msg--user {
  display: flex;
  justify-content: flex-end;
}

.msg--user .msg__bubble {
  max-width: 84%;
  padding: 11px 15px;
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(160deg, var(--blue-600), #1d4ed8);
  color: #fff;
  font-size: 14.8px;
  line-height: 1.6;
  box-shadow: 0 8px 18px -12px rgba(29, 78, 216, 0.9);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.msg--ai {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.msg__avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-top: 2px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(150deg, var(--blue-600), var(--blue-700));
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08), 0 6px 14px -10px rgba(30, 64, 175, 0.8);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.msg__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg__avatar img.is-missing {
  display: none;
}

.msg--ai .msg__body {
  min-width: 0;
  flex: 1 1 auto;
}

.msg--ai .msg__bubble {
  display: inline-block;
  max-width: 100%;
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px 18px 18px 18px;
  box-shadow: var(--shadow-sm);
  font-size: 14.8px;
  line-height: 1.68;
  color: var(--ink-900);
  overflow-wrap: anywhere;
}

.msg__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding-left: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.msg--ai:hover .msg__foot,
.msg--ai:focus-within .msg__foot,
.msg__foot.is-visible {
  opacity: 1;
}

.msg__meta {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-400);
  letter-spacing: 0.1px;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--ink-500);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.copy-btn:hover {
  color: var(--blue-700);
  border-color: var(--blue-200);
  background: var(--blue-50);
}

.copy-btn svg {
  width: 11px;
  height: 11px;
}

/* Indikator mengetik */
.typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
}

.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue-300);
  animation: blink 1.25s ease-in-out infinite;
}

.typing i:nth-child(2) {
  animation-delay: 0.18s;
}

.typing i:nth-child(3) {
  animation-delay: 0.36s;
}

.typing__label {
  margin-left: 4px;
  font-size: 12px;
  color: var(--ink-400);
}

/* Nota sistem: limit, error, info */
.notice {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  color: var(--blue-800);
  font-size: 13px;
  line-height: 1.55;
}

.notice--warn {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: var(--ink-700);
}

.notice svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--blue-600);
}

.notice__title {
  display: block;
  font-weight: 700;
  margin-bottom: 1px;
}

/* Nota (limit/error) tampil tanpa kartu ganda */
.msg__bubble.is-notice {
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}

/* Prosa di dalam bubble AI */
.prose > *:first-child {
  margin-top: 0;
}

.prose > *:last-child {
  margin-bottom: 0;
}

.prose p {
  margin: 0 0 10px;
}

.prose h3,
.prose h4 {
  margin: 16px 0 7px;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.15px;
  color: var(--ink-900);
}

.prose h4 {
  font-size: 14.2px;
}

.prose ul,
.prose ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.prose li {
  margin: 3px 0;
}

.prose li::marker {
  color: var(--blue-600);
}

.prose strong {
  font-weight: 750;
  color: var(--ink-900);
}

.prose em {
  font-style: italic;
}

.prose a {
  color: var(--blue-600);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1.5px 5px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #e6ecf4;
  color: #1e3a8a;
  overflow-wrap: anywhere;
}

.prose pre {
  margin: 10px 0;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.prose pre code {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  font-size: 12.5px;
  line-height: 1.6;
  color: #0f172a;
  white-space: pre;
  overflow-wrap: normal;
}

.prose blockquote {
  margin: 10px 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--blue-200);
  color: var(--ink-500);
}

/* ------------------------------ 6. Footer ------------------------------ */
.site-footer {
  margin: 30px 0 6px;
  padding: 24px 0 4px;
  border-top: 1px solid var(--line);
}

.footer__grid {
  display: grid;
  gap: 16px;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__logo--sm {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.footer__name {
  margin: 0;
  font-size: 13.5px;
  font-weight: 750;
  color: var(--ink-900);
}

.footer__tagline {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-500);
}

.footer__links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.footer__links a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.14s ease;
}

.footer__links a:hover {
  border-color: var(--blue-200);
  background: var(--blue-50);
  transform: translateY(-1px);
}

.footer__ico {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue-50);
  color: var(--blue-700);
  flex: 0 0 auto;
}

.footer__ico svg {
  width: 15px;
  height: 15px;
}

.footer__label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.footer__label strong {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-900);
}

.footer__label span {
  font-size: 10.5px;
  color: var(--ink-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footer__copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 16px 0 0;
  font-size: 10.5px;
  color: var(--ink-400);
}

.footer__dot {
  color: var(--blue-200);
}

/* ----------------------------- 7. Composer ----------------------------- */
.dock {
  flex: 0 0 auto;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(248, 251, 255, 0) 0%, #f8fbff 38%, #f8fbff 100%);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 820px;
  margin: 0 auto;
  padding: 6px 6px 6px 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.composer:focus-within {
  border-color: var(--blue-300);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), var(--shadow-md);
}

.composer__input {
  flex: 1 1 auto;
  min-height: 42px;
  max-height: 148px;
  padding: 9px 0;
  border: 0;
  background: transparent;
  resize: none;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-900);
  overflow-y: auto;
}

.composer__input::placeholder {
  color: var(--ink-400);
}

.composer__input:focus {
  outline: none;
  box-shadow: none;
}

.send {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(160deg, var(--blue-600), #1d4ed8);
  box-shadow: 0 10px 20px -12px rgba(29, 78, 216, 0.95);
  transition: transform 0.14s ease, filter 0.16s ease, background 0.16s ease;
}

.send:hover {
  filter: brightness(1.06);
}

.send:active {
  transform: scale(0.94);
}

.send:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
  color: #fff;
}

.send__icon {
  width: 20px;
  height: 20px;
}

.send__icon--stop {
  display: none;
  width: 18px;
  height: 18px;
}

.composer.is-streaming .send__icon--arrow {
  display: none;
}

.composer.is-streaming .send__icon--stop {
  display: block;
}

.composer.is-streaming .send {
  background: #f1f5f9;
  color: var(--blue-700);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.dock__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 820px;
  margin: 6px auto 0;
  padding: 0 6px;
}

.dock__hint {
  margin: 0;
  font-size: 10.5px;
  color: var(--ink-400);
  line-height: 1.4;
}

/* Petunjuk keyboard tidak relevan di layar sentuh */
.dock__keys {
  display: none;
}

@media (min-width: 641px) {
  .dock__keys {
    display: inline;
  }
}

.dock__kbd {
  display: inline-block;
  padding: 0 4px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-500);
}

.dock__counter {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-400);
  flex: 0 0 auto;
}

.dock__counter.is-warning {
  color: #b91c1c;
  font-weight: 700;
}

/* ------------------------ 8. Akun, gerbang, riwayat -------------------- */

.icon-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-500);
}

.icon-btn--ghost:hover {
  background: var(--blue-50);
  border-color: var(--blue-100);
  color: var(--blue-700);
}

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.account-btn:hover {
  border-color: var(--blue-300);
  box-shadow: 0 3px 10px -4px rgba(37, 99, 235, 0.35);
}

.account-btn__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--blue-600), var(--blue-700));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 auto;
}

.account-btn__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-btn__name {
  display: none;
  padding-right: 7px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-700);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 980px) {
  .account-btn__name {
    display: inline;
  }
}

/* Menu akun */
.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 14px;
  z-index: 45;
  min-width: 226px;
  max-width: min(88vw, 300px);
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.16s ease both;
}

.menu__user {
  padding: 8px 10px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.menu__name {
  margin: 0;
  font-size: 13.5px;
  font-weight: 720;
  color: var(--ink-900);
}

.menu__email {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--ink-500);
  word-break: break-all;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 620;
  color: var(--ink-700);
  text-align: left;
}

.menu__item:hover {
  background: var(--blue-50);
  color: var(--blue-700);
}

.menu__item svg {
  width: 16px;
  height: 16px;
}

/* Gerbang login */
.boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 45vh;
  padding: 24px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-400);
}

.boot__spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--blue-100);
  border-top-color: var(--blue-600);
  animation: spin 0.8s linear infinite;
}

.boot.is-error {
  color: #b91c1c;
  font-weight: 600;
}

.boot.is-error .boot__spinner {
  display: none;
}

.gate {
  display: grid;
  place-items: center;
  padding: 10px 0 26px;
}

.gate__card {
  width: 100%;
  max-width: 470px;
  padding: 26px 22px 22px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gate__logo {
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
  border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08), 0 16px 30px -20px rgba(15, 23, 42, 0.8);
}

.gate__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  margin-bottom: 16px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue-700);
}

.gate__title {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.18;
  letter-spacing: -0.8px;
  font-weight: 800;
  color: var(--ink-900);
}

.gate__lede {
  margin: 0 auto 18px;
  max-width: 38ch;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-500);
}

.btn--google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid #d9e2f0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-900);
  box-shadow: var(--shadow-xs);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease,
    transform 0.12s ease;
}

.btn--google:hover {
  background: #f8fafc;
  border-color: #c3d2e8;
  box-shadow: var(--shadow-sm);
}

.btn--google:active {
  transform: scale(0.99);
}

.btn--google svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.gate__note {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-400);
}

.gate__note.is-error {
  color: #b91c1c;
  font-weight: 600;
}

.gate__facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
}

/* Drawer riwayat */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade 0.2s ease both;
}

.drawer__panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(88vw, 340px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 0 20px 20px 0;
  box-shadow: var(--shadow-lg);
  animation: slide-in 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
  outline: none;
}

.drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 14px 12px 16px;
  border-bottom: 1px solid var(--line);
}

.drawer__title {
  margin: 0;
  font-size: 16px;
  font-weight: 780;
  letter-spacing: -0.3px;
}

.drawer__sub {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--ink-500);
}

.drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px;
}

.drawer__foot {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--ink-400);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.history-item:hover {
  background: var(--blue-50);
}

.history-item.is-active {
  background: var(--blue-50);
  border-color: var(--blue-100);
}

.history-item__open {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 0;
  text-align: left;
}

.history-item__title {
  display: block;
  font-size: 12.8px;
  font-weight: 650;
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--ink-400);
}

.history-item__del {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--ink-400);
  opacity: 0;
  flex: 0 0 auto;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.history-item:hover .history-item__del,
.history-item__del:focus-visible {
  opacity: 1;
}

.history-item__del:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.history-item__del svg {
  width: 14px;
  height: 14px;
}

.history-item__del.is-armed {
  opacity: 1;
  width: auto;
  padding: 0 8px;
  background: #fee2e2;
  color: #b91c1c;
}

.history-item__confirm {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.history-empty {
  padding: 26px 14px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-400);
}

@media (max-width: 560px) {
  .history-item__del {
    opacity: 1;
  }
}

/* Composer terkunci saat belum masuk */
.dock.is-locked .composer {
  opacity: 0.7;
}

.composer__input:disabled {
  cursor: not-allowed;
}

/* ---------------------------- 9. Model sheet --------------------------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade 0.2s ease both;
}

.sheet__panel {
  position: relative;
  width: 100%;
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-lg);
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  animation: sheet-up 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  outline: none;
}

.sheet__grip {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: #dbe4f0;
  margin: 9px auto 2px;
  flex: 0 0 auto;
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px 12px;
  flex: 0 0 auto;
}

.sheet__title {
  margin: 0;
  font-size: 17px;
  font-weight: 780;
  letter-spacing: -0.3px;
}

.sheet__sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-500);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--ink-500);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.icon-btn:hover {
  color: var(--blue-700);
  background: var(--blue-50);
  border-color: var(--blue-200);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.sheet__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 14px 8px;
  overscroll-behavior: contain;
}

.model-group {
  margin-bottom: 12px;
}

.model-group__title {
  margin: 6px 4px 7px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--ink-400);
}

.model-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease,
    transform 0.12s ease;
}

.model-card:hover:not(:disabled) {
  border-color: var(--blue-200);
  box-shadow: var(--shadow-sm);
}

.model-card:active:not(:disabled) {
  transform: scale(0.995);
}

.model-card.is-selected {
  border-color: var(--blue-500);
  background: linear-gradient(180deg, #f5f9ff, var(--surface));
  box-shadow: 0 0 0 1px var(--blue-500), 0 10px 24px -20px rgba(37, 99, 235, 0.9);
}

.model-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #fbfcfe;
}

.model-card__radio {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  display: grid;
  place-items: center;
  transition: border-color 0.16s ease;
}

.model-card.is-selected .model-card__radio {
  border-color: var(--blue-600);
  border-width: 5px;
}

.model-card__main {
  flex: 1 1 auto;
  min-width: 0;
}

.model-card__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.model-card__name {
  font-size: 14px;
  font-weight: 720;
  color: var(--ink-900);
  letter-spacing: -0.15px;
}

.tag {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.tag--brand {
  color: var(--blue-700);
  background: var(--blue-100);
  border-color: var(--blue-200);
}

.tag--muted {
  color: var(--ink-500);
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.model-card__provider {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 600;
  color: var(--blue-600);
}

.model-card__desc {
  display: block;
  margin-top: 3px;
  font-size: 11.8px;
  line-height: 1.5;
  color: var(--ink-500);
}

.model-card__check {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  color: var(--blue-600);
  opacity: 0;
  transition: opacity 0.16s ease;
}

.model-card.is-selected .model-card__check {
  opacity: 1;
}

.model-skeleton {
  height: 72px;
  margin: 0 0 8px;
  border-radius: var(--radius-md);
  background: linear-gradient(100deg, #f1f5fb 20%, #f8fbff 40%, #f1f5fb 60%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}

.sheet__foot {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 20px 2px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-400);
}

.sheet__empty {
  margin: 8px 4px 14px;
}

/* ------------------------------- 10. Toast ------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 8px);
  z-index: 80;
  max-width: min(92vw, 420px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--blue-700);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 16px 30px -16px rgba(15, 23, 42, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------------------- 11. Animasi ------------------------------ */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes sheet-up {
  from {
    opacity: 0.6;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes pulse-ring {
  0% {
    opacity: 0.7;
    transform: scale(0.7);
  }
  70% {
    opacity: 0;
    transform: scale(1.5);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

@keyframes slide-in {
  from {
    opacity: 0.5;
    transform: translateX(-18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------- 12. Breakpoint ---------------------------- */
@media (min-width: 520px) {
  .thread__inner {
    padding: 24px 20px 10px;
  }

  .welcome__title {
    font-size: 34px;
  }

  .footer__links {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dock {
    padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 560px) {
  .model-pill {
    flex: 0 0 auto;
    font-size: 13px;
  }
}

@media (min-width: 900px) {
  .topbar__inner {
    padding: 12px 22px;
  }

  .model-pill {
    max-width: 260px;
    font-size: 13.5px;
  }

  .thread__inner {
    padding: 30px 24px 12px;
  }

  .welcome {
    padding: 22px 4px 8px;
  }

  .welcome__title {
    font-size: 40px;
    letter-spacing: -1.3px;
  }

  .welcome__lede {
    font-size: 15.5px;
  }

  .chips {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }

  .chip {
    padding: 13px 13px;
    gap: 6px;
  }

  .chip__icon {
    width: 32px;
    height: 32px;
  }

  .chip__title {
    font-size: 13px;
  }

  .chip__text {
    font-size: 12px;
  }

  .msg--user .msg__bubble,
  .msg--ai .msg__bubble {
    font-size: 15.2px;
  }

  .msg__foot {
    opacity: 0;
  }

  .site-footer {
    margin-top: 34px;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .footer__links {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dock {
    padding-bottom: 16px;
  }

  .composer {
    padding: 7px 7px 7px 18px;
  }

  /* Sheet jadi modal tengah di desktop */
  .sheet {
    align-items: center;
    padding: 24px;
  }

  .sheet__panel {
    max-width: 540px;
    max-height: 80vh;
    border-radius: var(--radius-xl);
    animation: pop 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
    padding-bottom: 14px;
  }

  .sheet__grip {
    display: none;
  }

  .sheet__head {
    padding-top: 18px;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Layar HP sempit: rapikan topbar supaya tidak berdesakan */
@media (max-width: 560px) {
  .brand__text {
    display: none;
  }

  .btn--ghost {
    padding: 9px;
  }

  .btn__label {
    display: none;
  }

  .model-pill {
    font-size: 12.5px;
    padding: 8px 9px 8px 10px;
  }
}

@media (max-width: 380px) {
  .brand__tag,
  .dock__kbd {
    display: none;
  }

  .welcome__title {
    font-size: 26px;
  }

  .chip {
    padding: 11px 10px;
  }

  .chip__title {
    font-size: 12px;
  }

  .chip__text {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
