/* AI Academic Assistant — minimal, AI-style UI */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f8;
  --bg-side: #f4f4f5;
  --border: #e5e7eb;
  --border-soft: #ececef;
  --text: #18181b;
  --text-muted: #71717a;
  --text-soft: #a1a1aa;
  --primary: #18181b;
  --primary-fg: #ffffff;
  --hover: rgba(0, 0, 0, 0.04);
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --sidebar-w: 260px;
}

[data-theme="dark"] {
  --bg: #0b0b0c;
  --bg-soft: #131316;
  --bg-side: #0f0f11;
  --border: #27272a;
  --border-soft: #1f1f22;
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-soft: #71717a;
  --primary: #f4f4f5;
  --primary-fg: #18181b;
  --hover: rgba(255, 255, 255, 0.05);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100%;
  height: 100%;
  width: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ui-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ====================== AUTH ====================== */
.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1000px 600px at 10% -10%, rgba(99, 102, 241, 0.08), transparent 60%),
    radial-gradient(800px 600px at 110% 110%, rgba(236, 72, 153, 0.06), transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
  text-align: center;
}

.auth-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.auth-card h1 {
  font-size: 22px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.auth-card p {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.btn-google {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 500;
  transition: background .15s;
}

.btn-google:hover {
  background: var(--hover);
}

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

.auth-foot {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-soft);
}

.auth-error {
  color: #dc2626;
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--text-soft);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--border-soft);
  flex: 1;
}

.auth-manual {
  text-align: left;
}

.auth-manual .field {
  margin-bottom: 10px;
}

.auth-manual-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 0;
}

/* ====================== APP LAYOUT ====================== */
.backdrop {
  display: none;
}

.app-view {
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
  width: 100%;
  transition: grid-template-columns .2s ease;
}

.app-view.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

/* ====================== SIDEBAR ====================== */
.sidebar {
  border: 1px solid var(--border-soft);
  display: flex;
  background-color: var(--bg-side);
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.sidebar-head {
  padding: 12px 12px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.brand-mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 6px 8px;
}

.brand-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  font-size: 11px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.icon-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.icon-btn.danger-soft:hover {
  background: rgba(220, 38, 38, .08);
  color: #dc2626;
}

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

.sidebar-links {
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  width: 100%;
  transition: background .12s;
}

.side-link:hover {
  background: var(--hover);
}

.side-link.active {
  background: var(--hover);
}

.side-link svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-section {
  padding: 14px 14px 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-list {
  padding: 0 8px 8px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  margin-bottom: 1px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .12s;
}

.sidebar-item:hover {
  background: var(--hover);
}

.sidebar-item.active {
  background: var(--hover);
  font-weight: 500;
}

.sidebar-empty {
  padding: 8px 10px;
  color: var(--text-soft);
  font-size: 12.5px;
}

.sidebar-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--border-soft);
  background: var(--panel);
  position: relative;
  z-index: 5;
  margin-top: auto;
  bottom: 0;
  background: var(--panel);
  z-index: 5;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-radius: 8px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
}

.user-chip:hover {
  background: var(--hover);
}

.user-chip .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
}

.user-chip .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-chip .meta {
  min-width: 0;
  flex: 1;
}

.user-chip .meta strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip .meta span {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ====================== MAIN ====================== */
.main {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  min-height: 48px;
}

.topbar h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.topbar .spacer {
  flex: 1;
}

.model-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 12.5px;
}

.topbar-profile {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  padding: 0;
  overflow: hidden;
  background: var(--bg);
  display: grid;
  place-items: center;
}

.topbar-profile:hover {
  background: var(--hover);
}

.topbar-profile .avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
}

.topbar-profile .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar-share {
  border: 1px solid var(--border);
  background: var(--bg);
}

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

@media (max-width: 720px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.profile-hero .profile-row {
  align-items: flex-start;
}

.profile-name {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.profile-email {
  font-size: 14px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.profile-meta {
  font-size: 12px;
  color: var(--text-soft);
  margin: 6px 0 0;
}

/* ====================== LANDING ====================== */
.page {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px 80px;
}

.container {
  max-width: 880px;
  margin: 0 auto;
}

.hero {
  text-align: left;
  margin-bottom: 32px;
}

.hero h1 {
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-fg);
  border: none;
  font-weight: 500;
  font-size: 14px;
  margin-top: 18px;
  transition: opacity .15s;
}

.btn-primary:hover {
  opacity: .88;
}

.btn-secondary {
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  margin-top: 18px;
  font-size: 13px;
}

.btn-secondary:hover {
  background: var(--hover);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 720px) {

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

.card {
  border: 1px solid var(--border-soft);
  background: var(--bg);
  border-radius: 12px;
  padding: 18px;
}

.card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-soft);
}

.metric .v {
  font-size: 22px;
  font-weight: 600;
}

.metric .l {
  font-size: 12px;
  color: var(--text-muted);
}

.bar {
  height: 6px;
  background: var(--bg-soft);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}

.bar>span {
  display: block;
  height: 100%;
  background: var(--primary);
  transition: width .3s;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  font-size: 12px;
  cursor: default;
  color: var(--text);
}

.badge.locked {
  color: var(--text-soft);
  opacity: .55;
}

button.badge:disabled {
  cursor: help;
  pointer-events: auto;
}

.badge-icon {
  width: 14px;
  height: 14px;
}

.user-line {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-line .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 22px;
  overflow: hidden;
}

.user-line .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-line .name {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.user-line .email {
  font-size: 13px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* ====================== PROFILE PAGE ====================== */
.profile-row {
  display: flex;
  gap: 18px;
  align-items: center;
}

.profile-avatar-lg {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 36px;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12px;
  color: var(--text-muted);
}

.field input,
.field select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

/* ====================== CHAT ====================== */
.chat-page {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding: 24px 0;
}

.chat-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

.katex {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
}

.msg {
  contain: content;
  display: flex;
  gap: 10px;
  padding: 2px 0 10px;
  align-items: flex-start;
}

.msg .text p {
  margin: 5px;
}

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

.msg.user .av {
  display: none;
}

.msg.ai {
  justify-content: flex-start;
}

.msg.ai .av {
  margin-top: 6px;
}

.msg.user .body {
  width: fit-content;
  max-width: 65%;
  padding: 8px 12px;
  background: linear-gradient(
    135deg,
    #2563eb,
    #1d4ed8
  );
  color: white;
  border-bottom-right-radius: 6px;
}

.msg.ai .body {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 8px;
}

.msg .av {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
}

.msg .av.user {
  background: var(--primary);
  color: var(--primary-fg);
}

.msg .av.ai {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  color: var(--text);
}

.msg .body {
  min-width: 0;
  max-width: min(72%, 720px);
  padding: 9px 13px;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}

.msg.user .who {
  font-size: 11px;
  margin-bottom: 3px;
  opacity: .7;
  color: rgba(255,255,255,.7);
}

.msg.user .text {
  color: white;
}

.msg .body .who {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 5px;
  margin-bottom: 2px;
}

.msg .body .text {
  margin-top: 0;
  line-height: 1.45;
  word-wrap: break-word;
}

.msg .attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.attachment-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  font-size: 12px;
}

.text {
  overflow-wrap: break-word;
  line-height: 1.7;
}

.text h1,
.text h2,
.text h3,
.text h4 {
  margin-top: 1.2rem;
  margin-bottom: 0.6rem;
}

.text ul,
.text ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.text li {
  margin: 0.25rem 0;
}

.text br {
  line-height: 1.2;
}

.chat-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.chat-empty h2 {
  font-size: 22px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 600;
}

.suggest {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-width: 560px;
  margin: 24px auto 0;
}

@media (max-width: 600px) {
  .suggest {
    grid-template-columns: 1fr;
  }
}

.suggest button {
  padding: 12px 14px;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-size: 13px;
}

.suggest button:hover {
  background: var(--hover);
}

.composer-wrap {
  position: sticky;
  inset-inline: 0;
  bottom: 0;
  z-index: 50;
  width: 100%;
  padding: 11px 20px;
  display: flex;
  justify-content: center;
  background: var(--bg);
  border-top: 1px solid var(--border-soft);
}

.composer {
  width: min(100%, 760px);
  position: relative;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 8px 8px 14px;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.composer.dragover {
  border-color: #6ea8fe;
  background: rgba(110, 168, 254, 0.08);
}

.composer.dragover textarea {
  opacity: 0.8;
}

.composer.dragover::after {
  content: "Drop file di sini";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  font-size: 14px;
  font-weight: 600;
  z-index: 50;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.composer-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.composer-files:empty {
  display: none;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 99px;
  font-size: 12px;
}

.file-pill button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
}

.composer-row {
  display: flex;
  align-items: end;
  gap: 8px;
}

.composer textarea {
  flex: 1;
  resize: none;
  max-height: 200px;
  min-height: 24px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 6px 0;
}

.composer .icon-btn.send {
  background: var(--primary);
  color: var(--primary-fg);
  border-radius: 8px;
}

.composer .icon-btn.send:hover {
  opacity: .88;
  background: var(--primary);
  color: var(--primary-fg);
}

.composer .icon-btn.send:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.mode-tabs {
  scrollbar-width: none;
  display: flex;
  gap: 4px;
  padding: 0 20px 8px;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.mode-tabs::-webkit-scrollbar {
  display: none;
}

.mode-tab {
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
}

.mode-tab:hover {
  background: var(--hover);
}

.mode-tab.active {
  background: var(--bg-soft);
  border-color: var(--border-soft);
  color: var(--text);
}

/* mobile */
@media (max-width: 768px) {
  .app-view {
    grid-template-columns: auto;
    min-height: var(--app-height, 100dvh);
  }

  .app-view.sidebar-open {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, calc(100vw - 48px));
    max-width: calc(100vw - 48px);
    z-index: 30;
    transform: translateX(-100%);
    transition: transform .2s;
  }

  .main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100dvh;
    overflow: hidden;
  }

  .topbar {
    padding: 8px 10px;
    gap: 6px;
  }

  .topbar>* {
    min-width: 0;
  }

  .topbar h2 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .model-select {
    max-width: 34vw;
    min-width: 96px;
    padding: 6px 7px;
  }

  .page {
    padding: 22px 14px 72px;
  }

  .chat-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 0;
  }

  .chat-inner {
    padding: 0 14px;
  }

  .mode-tabs,
  .example-picker {
    overflow-x: auto;
    padding-left: 14px;
    padding-right: 14px;
    -webkit-overflow-scrolling: touch;
  }

  .mode-tab,
  .pick-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .mode-hint {
    margin-left: 14px;
    margin-right: 14px;
    padding: 7px 10px;
  }

  .composer-wrap {
    position: sticky;
    bottom: 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    z-index: 20;
    padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  }

  .composer {
    border-radius: 14px;
    padding-left: 10px;
  }

  .composer-row {
    min-width: 0;
  }

  .composer textarea {
    min-width: 0;
  }

  .sidebar-item-more {
    display: grid;
  }

  .app-view.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 20;
  }

  .app-view.sidebar-open .backdrop {
    display: block;
  }
}

/* toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 100;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* ====================== DASHBOARD (pelajarin-style) ====================== */

/* Welcome header */
.dash-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.dash-welcome h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.dash-date {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* Stats grid - 4 cols */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .dash-stats {
    grid-template-columns: 1fr 1fr;
  }
}

.stat-card {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 16px 18px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .15s, transform .15s;
}

.stat-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, .06);
  transform: translateY(-1px);
}

.stat-icon {
  font-size: 22px;
  margin-bottom: 8px;
  line-height: 1;
  color: var(--text-muted);
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--text-soft);
  margin-top: 2px;
}

/* Subtle colored accents */
.stat-xp {
  border-left: 3px solid #f59e0b;
}

.stat-streak {
  border-left: 3px solid #ef4444;
}

.stat-session {
  border-left: 3px solid #6366f1;
}

.stat-badge {
  border-left: 3px solid #10b981;
}

/* Progress card */
.dash-progress-card {
  margin-bottom: 24px;
}

.dash-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-progress-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Section titles */
.dash-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 10px;
}

/* Quick actions */
.dash-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.dash-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .12s, box-shadow .12s, transform .12s;
}

.dash-action-btn:hover {
  background: var(--hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  transform: translateY(-1px);
}

.dash-action-icon {
  font-size: 17px;
  display: inline-flex;
}

/* Recent sessions grid */
.dash-recent {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}

@media (max-width: 600px) {
  .dash-recent {
    grid-template-columns: 1fr;
  }
}

.dash-recent-card {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  transition: background .12s, box-shadow .12s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.dash-recent-card:hover {
  background: var(--hover);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}

.dash-recent-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-mark {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

.page-head p {
  margin: 0;
  color: var(--text-muted);
}

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

.bookmark-card {
  width: 100%;
  border: 1px solid var(--border-soft);
  background: var(--bg);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bookmark-card:hover {
  background: var(--hover);
}

.bookmark-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 600;
}

.bookmark-card-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
  min-height: 220px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
}

.empty-state h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.empty-state p {
  margin: 0;
}

.empty-icon {
  width: 30px;
  height: 30px;
}

@media (max-width: 640px) {
  .page-head {
    flex-direction: column;
  }

  .bookmark-grid {
    grid-template-columns: 1fr;
  }
}

.dash-recent-meta {
  font-size: 11.5px;
  color: var(--text-soft);
  display: flex;
  gap: 8px;
  align-items: center;
}

.dash-recent-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-soft);
  flex-shrink: 0;
}

/* ============================================================
   LANDING PAGE  (lp-*)
   ============================================================ */

/* ── Reset the old auth-view for landing ── */
.lp-view {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
}

/* ── NAVBAR ── */
.lp-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  transition: background .2s;
}

[data-theme="dark"] .lp-nav {
  background: rgba(11, 11, 12, 0.85);
}

.lp-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.lp-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}

.lp-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.lp-brand-name {
  font-weight: 600;
}

.lp-nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.lp-nav-link {
  padding: 6px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  transition: color .12s, background .12s;
}

.lp-nav-link:hover {
  color: var(--text);
  background: var(--hover);
}

.lp-cta-nav {
  padding: 8px 18px;
  border-radius: 9px;
  background: var(--primary);
  color: var(--primary-fg);
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
  flex-shrink: 0;
}

.lp-cta-nav:hover {
  opacity: .88;
}

@media (max-width: 600px) {
  .lp-nav-links {
    display: none;
  }

  .lp-nav-inner {
    gap: 10px;
    height: 54px;
    padding: 0 14px;
  }

  .lp-brand {
    min-width: 0;
  }

  .lp-brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .lp-cta-nav {
    padding: 8px 12px;
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  .lp-brand-name {
    display: none;
  }
}

/* ── HERO ── */
.lp-hero {
  padding: 80px 24px 64px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 10% -10%, rgba(99, 102, 241, .07), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(16, 185, 129, .05), transparent 60%),
    var(--bg);
}

@media (max-width: 600px) {
  .lp-hero {
    padding: 48px 16px 44px;
  }

  .lp-hero-h1 {
    font-size: 38px;
  }

  .lp-hero-sub {
    font-size: 15px;
  }

  .lp-hero-actions {
    flex-direction: column;
  }

  .lp-btn-hero,
  .lp-btn-ghost {
    width: 100%;
    justify-content: center;
  }

  .lp-hero-perks {
    gap: 8px 14px;
    margin-bottom: 26px;
  }

  .lp-demo-user {
    max-width: 92%;
  }

  .lp-demo-ai {
    display: block;
  }

  .lp-demo-ai-av {
    margin-bottom: 8px;
  }

  .lp-section,
  .lp-cta-band {
    padding-left: 16px;
    padding-right: 16px;
  }

  .lp-modal-overlay {
    padding: 14px;
  }

  .lp-modal {
    padding: 32px 20px 24px;
    border-radius: 14px;
  }
}

.lp-hero-inner {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

.lp-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 99px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.lp-hero-h1 {
  font-size: clamp(36px, 6vw, 58px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
}

.lp-hero-grad {
  background: linear-gradient(135deg, #6366f1 0%, #10b981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lp-hero-sub {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto 30px;
  line-height: 1.65;
}

.lp-hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.lp-btn-hero {
  padding: 13px 26px;
  border-radius: 11px;
  background: var(--primary);
  color: var(--primary-fg);
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .15s;
}

.lp-btn-hero:hover {
  opacity: .88;
  transform: translateY(-1px);
}

.lp-btn-ghost {
  padding: 13px 22px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}

.lp-btn-ghost:hover {
  background: var(--hover);
}

.lp-hero-perks {
  display: flex;
  gap: 20px;
  justify-content: center;
  font-size: 13px;
  color: var(--text-soft);
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.lp-hero-perks span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Chat demo bubble */
.lp-chat-demo {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.lp-demo-msg {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
}

.lp-demo-user {
  background: var(--primary);
  color: var(--primary-fg);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  max-width: 75%;
}

.lp-demo-ai {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.lp-demo-ai-av {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── STATS BAND ── */
.lp-stats-band {
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-soft);
  padding: 32px 24px;
}

.lp-stats-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 24px;
  flex-wrap: wrap;
}

.lp-stat-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lp-stat-num {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.lp-stat-suf {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-muted);
}

.lp-stat-lbl {
  font-size: 13px;
  color: var(--text-muted);
}

.lp-stat-sep {
  width: 1px;
  height: 40px;
  background: var(--border-soft);
}

@media (max-width: 600px) {
  .lp-stat-sep {
    display: none;
  }

  .lp-stats-inner {
    gap: 32px;
  }
}

/* ── GENERIC SECTION ── */
.lp-section {
  padding: 72px 24px;
}

.lp-section-soft {
  background: var(--bg-soft);
}

.lp-section-inner {
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}

.lp-eyebrow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6366f1;
  margin: 0 0 10px;
}

.lp-section-h2 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.lp-section-sub {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 48px;
  line-height: 1.65;
}

/* ── FEATURES GRID ── */
.lp-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: left;
}

@media (max-width: 860px) {
  .lp-features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .lp-features-grid {
    grid-template-columns: 1fr;
  }
}

.lp-feat-card {
  padding: 22px 20px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--bg);
  transition: box-shadow .15s, transform .15s;
}

.lp-feat-card:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, .07);
  transform: translateY(-2px);
}

.lp-feat-icon {
  font-size: 28px;
  margin-bottom: 12px;
  color: var(--primary);
}

.lp-feat-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 8px;
}

.lp-feat-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* ── FORMAT FILE ── */
.lp-formats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 640px) {
  .lp-formats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.lp-format-card {
  padding: 24px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: box-shadow .15s, transform .15s;
}

.lp-format-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, .06);
  transform: translateY(-2px);
}

.lp-format-icon {
  font-size: 32px;
  color: var(--primary);
}

.lp-format-card strong {
  font-size: 14px;
  font-weight: 600;
}

.lp-format-card span {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ── HOW IT WORKS / STEPS ── */
.lp-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.lp-step {
  flex: 1;
  min-width: 200px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.lp-step-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}

.lp-step-body h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px;
}

.lp-step-body p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

.lp-step-arrow {
  font-size: 22px;
  color: var(--text-soft);
  margin-top: 14px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .lp-step-arrow {
    display: none;
  }

  .lp-steps {
    flex-direction: column;
    align-items: center;
  }

  .lp-step {
    max-width: 100%;
  }
}

/* ── TESTIMONIALS ── */
.lp-testi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: left;
}

@media (max-width: 760px) {
  .lp-testi-grid {
    grid-template-columns: 1fr;
  }
}

.lp-testi-card {
  padding: 22px 20px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lp-testi-stars {
  color: #f59e0b;
  font-size: 14px;
  display: flex;
  gap: 3px;
}

.lp-testi-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
  flex: 1;
}

.lp-testi-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lp-testi-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.lp-testi-author div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.lp-testi-author strong {
  font-size: 13px;
  font-weight: 600;
}

.lp-testi-author span {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── FAQ ── */
.lp-faq-wrap {
  max-width: 680px;
}

.lp-faq-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.lp-faq-item {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}

.lp-faq-q {
  width: 100%;
  padding: 16px 18px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background .12s;
}

.lp-faq-q:hover {
  background: var(--hover);
}

.lp-faq-arrow {
  font-size: 20px;
  font-weight: 400;
  color: var(--text-muted);
  transition: transform .2s;
  flex-shrink: 0;
}

.lp-faq-item.open .lp-faq-arrow {
  transform: rotate(45deg);
}

.lp-faq-a {
  max-height: 0;
  overflow: hidden;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  padding: 0 18px;
  transition: max-height .28s ease, padding .28s ease;
}

.lp-faq-item.open .lp-faq-a {
  max-height: 200px;
  padding: 0 18px 16px;
}

/* ── BOTTOM CTA BAND ── */
.lp-cta-band {
  padding: 80px 24px;
  background:
    radial-gradient(800px 500px at 50% 120%, rgba(99, 102, 241, .08), transparent 60%),
    var(--bg);
  text-align: center;
}

.lp-cta-inner {
  max-width: 560px;
  margin: 0 auto;
}

.lp-cta-band h2 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.lp-cta-band p {
  font-size: 16px;
  color: var(--text-muted);
  margin: 0 0 28px;
  line-height: 1.6;
}

.lp-cta-note {
  margin-top: 12px !important;
  font-size: 12.5px !important;
  color: var(--text-soft) !important;
  margin-bottom: 0 !important;
}

/* ── FOOTER ── */
.lp-footer {
  border-top: 1px solid var(--border-soft);
  padding: 28px 24px;
  background: var(--bg-soft);
}

.lp-footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.lp-footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lp-footer-copy {
  font-size: 12.5px;
  color: var(--text-soft);
  margin: 0;
}

/* ── AUTH MODAL ── */
.lp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.lp-modal-overlay.hidden {
  display: none !important;
}

.lp-modal {
  width: 100%;
  max-width: 400px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 28px 28px;
  position: relative;
  animation: modalIn .22s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(.96) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.lp-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 6px;
}

.lp-modal-close:hover {
  background: var(--hover);
  color: var(--text);
}

/* smooth scroll */
html {
  scroll-behavior: smooth;
}

/* ============================================================
   FEATURE STYLES — mode tabs, explain, summary, example, quiz
   ============================================================ */

.mode-picker {
  position: relative;
}

.mode-picker-trigger {
  width: 220px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: var(--bg);
  cursor: pointer;
}

.mode-picker-current {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.mode-picker-current span {
  align-self: center;
}

.mode-icon,
.mode-option-icon {
  display: inline-flex;
  color: var(--text-muted);
  font-size: 18px;
}

.mode-picker-current strong {
  text-align: left;
  display: block;
  font-size: 14px;
}

.mode-picker-current small {
  display: block;
  font-size: 11px;
  opacity: .7;
}

.mode-picker.open .mode-caret {
  transform: rotate(180deg);
}

.mode-caret {
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform .2s ease;
}

.mode-caret svg {
  width: 18px;
  height: 18px;
}

.mode-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  padding: 8px;
  border-radius: 18px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  z-index: 100;
}

.mode-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: none;
  background: transparent;
  border-radius: 14px;
  text-align: left;
  cursor: pointer;
}

.mode-option:hover {
  background: rgba(255,255,255,.06);
}

.mode-option.active {
  background: rgba(255,255,255,.08);
}

.mode-option strong {
  display: block;
}

.mode-option small {
  display: block;
  opacity: .7;
  font-size: 12px;
}

.mode-hint {
  padding: 7px 20px;
  max-width: 760px;
  margin: 0 auto;
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-radius: 8px;
  margin-bottom: 4px;
}

/* ── Pickers (example / quiz count) ── */
.example-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  max-width: 760px;
  margin: 0 auto 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.pick-btn {
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.pick-btn.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}

/* ── Mode tab icons ── */
.mode-tab-icon {
  margin-right: 4px;
}

/* ── Mode tag on message ── */
.msg-mode-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  vertical-align: middle;
}

/* ── AI typing animation ── */
.ai-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-soft);
  animation: typingBounce 1.2s infinite ease-in-out;
}

.ai-typing span:nth-child(2) {
  animation-delay: .2s;
}

.ai-typing span:nth-child(3) {
  animation-delay: .4s;
}

@keyframes typingBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-6px);
  }
}

/* ── Error message ── */
.ai-error {
  color: #dc2626;
  font-size: 13.5px;
}

/* ─────────────────────────────────────────────
   EXPLAIN RENDERER
 */
.explain-section {
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  margin-bottom: 10px;
  overflow: hidden;
}

.explain-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-soft);
  font-size: 13px;
}

.explain-section-body {
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.7;
}

.explain-def .explain-section-header {
  background: rgba(99, 102, 241, .07);
}

.explain-detail .explain-section-header {
  background: rgba(16, 185, 129, .07);
}

.explain-points .explain-section-header {
  background: rgba(245, 158, 11, .07);
}

.explain-tips .explain-section-header {
  background: rgba(236, 72, 153, .07);
}

/* ─────────────────────────────────────────────
   SUMMARY RENDERER
 */
.summary-section {
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  margin-bottom: 10px;
  overflow: hidden;
}

.summary-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-soft);
  font-size: 13px;
}

.summary-section-body {
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.7;
}

.summary-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.summary-copy-btn:hover {
  background: var(--hover);
  color: var(--text);
}

/* ─────────────────────────────────────────────
   EXAMPLE RENDERER
 */
.example-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.example-card {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow: hidden;
}

.example-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-soft);
  gap: 8px;
}

.example-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.example-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.example-toggle.open,
.example-toggle:hover {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}

.example-toggle-arrow {
  font-size: 10px;
  display: inline-flex;
  transition: transform .15s;
}

.example-toggle.open .example-toggle-arrow {
  transform: rotate(180deg);
}

.example-soal {
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
  border-bottom: 1px solid var(--border-soft);
}

.example-pembahasan {
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
  background: rgba(99, 102, 241, .04);
}

.example-pembahasan-label {
  font-size: 12px;
  font-weight: 600;
  color: #6366f1;
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ─────────────────────────────────────────────
   QUIZ RENDERER
 */
.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-progress-bar {
  height: 5px;
  background: var(--bg-soft);
  border-radius: 99px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width .3s ease;
}

.quiz-progress-label {
  font-size: 12px;
  color: var(--text-muted);
}

.quiz-questions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-q-card {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px;
  background: var(--bg);
}

.quiz-q-num {
  font-size: 12px;
  font-weight: 600;
  color: #6366f1;
  margin-bottom: 8px;
}

.quiz-q-total {
  color: var(--text-soft);
  font-weight: 400;
}

.quiz-q-text {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.6;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s;
}

.quiz-option:hover:not(.selected) {
  background: var(--hover);
  transform: translateX(2px);
}

.quiz-option.selected {
  background: rgba(99, 102, 241, .1);
  border-color: #6366f1;
  color: var(--text);
}

.quiz-opt-key {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid var(--border-soft);
}

.quiz-option.selected .quiz-opt-key {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
}

.quiz-submit-btn {
  padding: 11px 22px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-fg);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: opacity .15s, transform .15s;
}

.quiz-submit-btn:hover:not(:disabled) {
  opacity: .88;
  transform: translateY(-1px);
}

.quiz-submit-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ── Quiz Result Overlay ── */
.quiz-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg);
  padding: 26px 20px 80px;
}

.quiz-shell {
  max-width: 880px;
  margin: 0 auto;
}

.quiz-topline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.quiz-topline .icon-btn {
  transform: rotate(180deg);
}

.quiz-kicker {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.quiz-topline h1 {
  margin: 0;
  font-size: 24px;
}

.quiz-page-progress {
  margin-left: auto;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.quiz-empty-state {
  min-height: 380px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}

.quiz-empty-state .ui-icon {
  width: 36px;
  height: 36px;
}

.quiz-empty-state h2 {
  margin: 0;
  color: var(--text);
}

.quiz-empty-state p {
  margin: 0;
}

.quiz-page-container {
  gap: 16px;
}

.quiz-page-card {
  padding: 18px;
}

.quiz-launch-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px;
  background: var(--bg);
}

.quiz-launch-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.quiz-launch-card p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.quiz-open-btn {
  margin-top: 0;
}

@media (max-width: 640px) {
  .quiz-launch-card {
    grid-template-columns: 1fr;
  }

  .quiz-page-progress {
    display: none;
  }
}

.quiz-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
}

.quiz-overlay.hidden {
  display: none !important;
}

.quiz-result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  animation: modalIn .22s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.quiz-result-icon {
  font-size: 48px;
  margin-bottom: 8px;
  color: var(--primary);
  display: inline-flex;
}

.quiz-result-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: -.02em;
}

/* Score ring */
.quiz-score-ring {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
}

.quiz-score-ring svg {
  position: absolute;
  inset: 0;
}

.quiz-score-ring circle {
  transition: stroke-dashoffset .8s ease, stroke .5s;
}

#quizScoreText {
  font-size: 15px;
  font-weight: 800;
  position: relative;
  z-index: 1;
}

.quiz-result-msg {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 20px;
}

.quiz-review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.quiz-review-item {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid var(--border-soft);
}

.quiz-review-item.correct {
  background: rgba(16, 185, 129, .06);
  border-color: rgba(16, 185, 129, .2);
}

.quiz-review-item.wrong {
  background: rgba(239, 68, 68, .05);
  border-color: rgba(239, 68, 68, .2);
}

.quiz-review-q {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 500;
}

.quiz-review-badge {
  flex-shrink: 0;
  display: inline-flex;
  margin-top: 2px;
}

.quiz-review-ans {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
  font-size: 12px;
}

.wrong-ans {
  color: #dc2626;
}

.correct-ans {
  color: #10b981;
  font-weight: 500;
}

.quiz-review-expl {
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-soft);
  padding-top: 6px;
  margin-top: 4px;
  display: flex;
  gap: 6px;
}

.quiz-result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─────────────────────────────────────────────
   FOLLOW-UP CHIPS
 */
.followup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.followup-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-soft);
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s, color .12s, transform .1s;
}

.followup-chip:hover {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────
   MESSAGE ACTIONS (copy / export)
 */
.msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity .15s;
}

.msg:hover .msg-actions,
.msg-actions:focus-within {
  opacity: 1;
}

.msg-action-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--text-soft);
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.msg-action-btn:hover {
  background: var(--hover);
  color: var(--text);
}


/* ============================================================
   ANIMATIONS — landing page
   ============================================================ */

/* Hero entrance */
@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(32px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-hero {
  animation: heroIn .7s cubic-bezier(.22, 1, .36, 1) forwards;
}

/* Chat demo delayed entrance */
@keyframes chatDemoIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-chat-demo {
  opacity: 0;
  animation: chatDemoIn .6s cubic-bezier(.22, 1, .36, 1) .5s forwards;
}

/* Scroll reveal */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .55s cubic-bezier(.22, 1, .36, 1), transform .55s cubic-bezier(.22, 1, .36, 1);
}

.animate-on-scroll.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delay for grid children */
.lp-features-grid .animate-on-scroll:nth-child(2) {
  transition-delay: .07s;
}

.lp-features-grid .animate-on-scroll:nth-child(3) {
  transition-delay: .14s;
}

.lp-features-grid .animate-on-scroll:nth-child(4) {
  transition-delay: .21s;
}

.lp-features-grid .animate-on-scroll:nth-child(5) {
  transition-delay: .28s;
}

.lp-features-grid .animate-on-scroll:nth-child(6) {
  transition-delay: .35s;
}

.lp-steps .animate-on-scroll:nth-child(3) {
  transition-delay: .1s;
}

.lp-steps .animate-on-scroll:nth-child(5) {
  transition-delay: .2s;
}

.lp-testi-grid .animate-on-scroll:nth-child(2) {
  transition-delay: .1s;
}

.lp-testi-grid .animate-on-scroll:nth-child(3) {
  transition-delay: .2s;
}

.lp-formats-grid .animate-on-scroll:nth-child(2) {
  transition-delay: .07s;
}

.lp-formats-grid .animate-on-scroll:nth-child(3) {
  transition-delay: .14s;
}

.lp-formats-grid .animate-on-scroll:nth-child(4) {
  transition-delay: .21s;
}

/* Floating gradient orbs in hero */
.lp-hero::before,
.lp-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: orbFloat 8s ease-in-out infinite;
}

.lp-hero::before {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, .12) 0%, transparent 70%);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.lp-hero::after {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(16, 185, 129, .10) 0%, transparent 70%);
  bottom: -80px;
  right: -80px;
  animation-delay: -4s;
}

.lp-hero {
  position: relative;
  overflow: hidden;
}

@keyframes orbFloat {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -20px) scale(1.05);
  }

  66% {
    transform: translate(-20px, 15px) scale(.97);
  }
}

/* Shimmer on nav brand */
@keyframes brandPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, .4);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0);
  }
}

.lp-brand-mark {
  animation: brandPulse 3s ease-in-out infinite;
}

/* Context menu */
.ctx-menu {
  position: fixed;
  z-index: 500;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  min-width: 192px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);
  animation: ctxIn .15s cubic-bezier(.22, 1, .36, 1);
}

@keyframes ctxIn {
  from {
    opacity: 0;
    transform: scale(.95) translateY(-4px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  border-radius: 7px;
  cursor: pointer;
  transition: background .1s;
}

.ctx-item:hover {
  background: var(--hover);
}

.ctx-item.ctx-danger {
  color: #dc2626;
}

.ctx-item.ctx-danger:hover {
  background: rgba(220, 38, 38, .07);
}

.ctx-sep {
  height: 1px;
  background: var(--border-soft);
  margin: 4px 6px;
}

/* Sidebar item with more button */
.sidebar-item-wrap {
  display: flex;
  align-items: center;
  border-radius: 6px;
  margin-bottom: 1px;
  transition: background .12s;
}

.sidebar-item-wrap:hover,
.sidebar-item-wrap.active {
  background: var(--hover);
}

.sidebar-item-btn {
  flex: 1;
  text-align: left;
  padding: 7px 6px 7px 10px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-item-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item-wrap.active .sidebar-item-btn {
  font-weight: 500;
}

.sidebar-item-more {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: none;
  place-items: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  margin-right: 4px;
  transition: background .1s, color .1s;
}

.sidebar-item-wrap:hover .sidebar-item-more {
  display: grid;
}

.sidebar-item-more:hover {
  background: var(--hover);
  color: var(--text);
}

/* Final mobile hardening overrides */
@media (max-width: 768px) {

  .app-view,
  .app-view.sidebar-open {
    grid-template-columns: 1fr;
    min-height: var(--app-height, 100dvh);
  }

  .sidebar {
    width: min(280px, calc(100vw - 48px));
    max-width: calc(100vw - 48px);
  }

  .main,
  .composer-row,
  .composer textarea {
    min-width: 0;
  }

  .mode-tabs,
  .example-picker {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mode-tab,
  .pick-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .sidebar-item-more {
    display: grid;
  }
}

@media (max-width: 600px) {
  .lp-demo-user {
    max-width: 92%;
  }

  .lp-demo-ai {
    display: block;
  }

  .lp-demo-ai-av {
    margin-bottom: 8px;
  }
}
