* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  color-scheme: dark;
  --bg: #212121;
  --bg-elevated: #2a2a2a;
  --panel: #171717;
  --panel-strong: #1e1e1e;
  --surface: #2f2f2f;
  --surface-hover: #3a3a3a;
  --surface-active: #444;
  --text: #ececec;
  --text-soft: #d1d1d1;
  --muted: #8e8ea0;
  --border: rgba(255,255,255,.09);
  --border-strong: rgba(255,255,255,.16);
  --accent: #10a37f;
  --accent-hover: #0d8f6f;
  --accent-soft: rgba(16,163,127,.14);
  --danger: #ef4444;
  --success: #10a37f;
  --code: #0d0d0d;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.28);
  --shadow-lg: 0 16px 60px rgba(0,0,0,.45);
  --focus: 0 0 0 3px rgba(16,163,127,.25);
  --top: 60px;
  --left: 260px;
  --right: 280px;
  --chat-width: 760px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elevated: #f7f7f8;
  --panel: #f9f9f9;
  --panel-strong: #ffffff;
  --surface: #efefef;
  --surface-hover: #e5e5e5;
  --surface-active: #d9d9d9;
  --text: #0d0d0d;
  --text-soft: #353535;
  --muted: #6e6e80;
  --border: rgba(0,0,0,.08);
  --border-strong: rgba(0,0,0,.14);
  --accent: #10a37f;
  --accent-hover: #0d8f6f;
  --accent-soft: rgba(16,163,127,.1);
  --danger: #ef4444;
  --success: #10a37f;
  --code: #f4f4f4;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.06);
  --shadow-lg: 0 16px 60px rgba(0,0,0,.1);
  --focus: 0 0 0 3px rgba(16,163,127,.2);
}

html {
  height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv01", "cv02", "cv03", "cv04", "ss03";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

button,
a,
input,
textarea,
select {
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease, opacity .18s ease, transform .18s ease;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 999;
  top: -64px;
  left: 14px;
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

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

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

.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  color: var(--accent-hover);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
}

.wide {
  width: 100%;
}

.primary {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  padding: 10px 15px;
  box-shadow: inset 0 1px rgba(255, 255, 255, .16);
}

.primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.primary:active {
  transform: translateY(0);
}

.icon-btn,
.tiny-btn {
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 18px;
}

.tiny-btn {
  min-width: 29px;
  height: 29px;
  border-radius: 9px;
}

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

.login-view {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(124, 108, 255, .17), transparent 34%),
    radial-gradient(circle at 85% 80%, rgba(60, 167, 255, .1), transparent 30%),
    var(--bg);
}

.login-card {
  position: relative;
  width: min(420px, 100%);
  padding: 40px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: color-mix(in srgb, var(--panel-strong) 94%, transparent);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .32), transparent);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: linear-gradient(145deg, #6958ec, #9185ff);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 25px rgba(124, 108, 255, .28);
}

.login-card > .brand-mark {
  width: 52px;
  height: 52px;
  margin-bottom: 28px;
  border-radius: 16px;
  font-size: 18px;
}

.login-card h1 {
  margin: 7px 0 6px;
  font-size: 29px;
  line-height: 1.2;
  letter-spacing: -.03em;
}

.login-card form {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.login-card label {
  margin-top: 9px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.login-card input,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface);
  padding: 10px 12px;
}

.login-card input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: var(--focus);
}

.login-card .primary {
  min-height: 44px;
  margin-top: 14px;
}

.form-error {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--danger);
}

.app {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.offline-banner {
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  right: 0;
  padding: 8px 16px;
  background: #b91c1c;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.install-pwa-btn,
.ios-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.install-pwa-btn:hover,
.ios-install-btn:hover {
  background: var(--surface-active);
  border-color: var(--accent);
}

.empty-chat-placeholder {
  flex: 1;
  min-height: 20px;
}

.topbar {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  height: var(--top);
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: var(--left) minmax(260px, 600px) auto;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(22px) saturate(140%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.brand strong {
  font-size: 13px;
  letter-spacing: .05em;
}

.brand small {
  color: var(--muted);
  font-size: 10px;
}

.search-trigger {
  justify-self: center;
  width: min(100%, 440px);
  height: 36px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  text-align: left;
}

.search-trigger:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text-soft);
}

.search-trigger kbd {
  margin-left: auto;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 10px;
}

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 7px;
}

.avatar-btn,
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid rgba(124, 108, 255, .35);
  border-radius: 50%;
  background: var(--accent-soft);
  color: #a69dff;
  font-size: 10px;
  font-weight: 750;
}

.avatar-btn:hover {
  background: rgba(124, 108, 255, .22);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}

.status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #737b8e;
}

.status-pill i.online {
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 14%, transparent);
}

.shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--left) minmax(380px, 1fr) var(--right);
  padding-top: var(--top);
  overflow: hidden;
}

.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-color: var(--border);
  background: var(--panel);
}

.sidebar.left {
  padding: 14px 11px;
  border-right: 1px solid var(--border);
}

.new-chat {
  min-height: 42px;
  margin-bottom: 12px;
  text-align: left;
}

.left nav {
  display: grid;
  gap: 2px;
}

.left nav button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.left nav button:hover {
  background: var(--surface-hover);
  color: var(--text-soft);
}

.left nav button.active {
  background: var(--surface-active);
  color: var(--text);
}

.left nav button span {
  width: 18px;
  color: currentColor;
  text-align: center;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 8px 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .13em;
}

.history {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-active) transparent;
}

.history-group h3 {
  margin: 12px 8px 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.history-item {
  position: relative;
}

.history-item > button:first-child {
  width: 100%;
  min-height: 36px;
  overflow: hidden;
  padding: 8px 34px 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item:hover > button:first-child,
.history-item.active > button:first-child {
  background: var(--surface-hover);
  color: var(--text);
}

.history-item.active > button:first-child {
  box-shadow: inset 2px 0 var(--accent);
}

.history-menu {
  position: absolute;
  top: 4px;
  right: 3px;
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
}

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

.history-menu:hover {
  background: var(--surface-active);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 13px 5px 1px;
  border-top: 1px solid var(--border);
}

.user-card > span:nth-child(2) {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.user-card small {
  color: var(--muted);
  font-size: 10px;
}

.main {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.page {
  height: 100%;
  min-height: 0;
}

.chat-page{height:100%;min-height:0;display:grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  overflow: hidden;
}

.chat-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 3vw, 34px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.title-line {
  display: flex;
  align-items: center;
  gap: 5px;
}

.title-line h1 {
  max-width: min(48vw, 520px);
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-chip {
  margin-top: 2px;
  padding: 1px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.model-chip:hover {
  color: var(--text-soft);
}

.model-chip span {
  color: var(--accent-hover);
}

.model-chip b {
  margin-left: 3px;
  font-size: 10px;
}

.messages{min-height:0;overflow-y:auto;overflow-x:hidden;touch-action:pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 34px clamp(18px, 5vw, 70px) 22px;
  scroll-behavior:auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-active) transparent;
}

.messages::-webkit-scrollbar,
.history::-webkit-scrollbar,
.content-page::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-thumb,
.history::-webkit-scrollbar-thumb,
.content-page::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--surface-active);
}

.welcome {
  width: min(100%, 680px);
  margin: clamp(54px, 12vh, 130px) auto 30px;
  text-align: center;
}

.orb {
  position: relative;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  border: 1px solid rgba(153, 143, 255, .34);
  border-radius: 20px;
  background: linear-gradient(145deg, #282248, #5b4fca);
  color: #d2ceff;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 16px 50px rgba(95, 80, 210, .23);
}

.orb::after {
  content: "";
  position: absolute;
  inset: -14px;
  z-index: -1;
  border-radius: 30px;
  background: rgba(124, 108, 255, .1);
  filter: blur(14px);
}

.welcome h2 {
  margin: 9px 0 5px;
  font-size: clamp(25px, 3vw, 32px);
  line-height: 1.2;
  letter-spacing: -.04em;
}

.welcome > p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
}

.starter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 30px;
}

.starter-grid button,
.quick-prompts button {
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
  text-align: left;
}

.starter-grid button {
  min-height: 48px;
  padding: 12px 14px;
}

.starter-grid button:hover,
.quick-prompts button:hover {
  border-color: rgba(124, 108, 255, .38);
  background: var(--surface-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.message {
  width: min(100%, var(--chat-width));
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 13px;
  margin: 0 auto 32px;
  animation: message-in .2s ease-out both;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.message > div:nth-child(2) {
  min-width: 0;
}

.message-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 750;
}

.message.assistant .message-avatar {
  border-color: rgba(124, 108, 255, .3);
  background: var(--accent-soft);
  color: #aaa2ff;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 32px;
}

.message.user .message-avatar {
  grid-column: 2;
  grid-row: 1;
  border-color: rgba(124, 108, 255, .3);
  background: #413b7c;
  color: #fff;
}

.message.user > div:nth-child(2) {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  max-width: min(86%, 620px);
}

.message-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.message.user .message-head {
  justify-content: flex-end;
}

.message-head strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.message-head time {
  color: var(--muted);
  font-size: 9px;
}

.message-body {
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 14.5px;
  line-height: 1.75;
}

.message.user .message-body {
  display: inline-block;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 17px 5px 17px 17px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.58;
  text-align: left;
}

.message-body > :first-child {
  margin-top: 0;
}

.message-body > :last-child {
  margin-bottom: 0;
}

.message-body p,
.message-body ul,
.message-body ol,
.message-body blockquote {
  margin: 0 0 13px;
}

.message-body h1,
.message-body h2,
.message-body h3 {
  margin: 24px 0 9px;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -.02em;
}

.message-body h1 {
  font-size: 22px;
}

.message-body h2 {
  font-size: 18px;
}

.message-body h3 {
  font-size: 15px;
}

.message-body ul,
.message-body ol {
  padding-left: 22px;
}

.message-body li + li {
  margin-top: 4px;
}

.message-body blockquote {
  padding-left: 14px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.message-actions {
  min-height: 24px;
  display: flex;
  gap: 3px;
  margin-top: 5px;
  opacity: .15;
}

.message.user .message-actions {
  justify-content: flex-end;
}

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

.message-actions button {
  padding: 3px 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
}

.message-actions button:hover {
  background: var(--surface-hover);
  color: var(--text-soft);
}

.message-actions .copy-message,
.code-copy {
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.message-actions .copy-message:hover,
.code-copy:hover {
  border-color: var(--border);
  background: var(--surface-hover);
  color: var(--text);
}

.message-actions .copy-message[data-copy-state="success"],
.code-copy[data-copy-state="success"] {
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
  background: color-mix(in srgb, var(--success) 10%, transparent);
  color: var(--success);
}

.message-actions .copy-message[data-copy-state="error"],
.code-copy[data-copy-state="error"] {
  color: var(--danger);
}

.thinking {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-style: normal;
}

.thinking::after {
  content: "";
  width: 18px;
  height: 5px;
  background:
    radial-gradient(circle, currentColor 2px, transparent 2.5px) 0 50% / 6px 6px repeat-x;
  animation: thinking-pulse 1.1s ease-in-out infinite;
}

@keyframes thinking-pulse {
  0%, 100% { opacity: .25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-1px); }
}

.error-card {
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 11px;
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  color: color-mix(in srgb, var(--danger) 74%, white);
}

.code-wrap {
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  background: var(--code);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .16);
}

.code-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: #11151e;
  color: #929aac;
  font: 10px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: .04em;
}

.code-head button {
  padding: 4px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #aeb6c8;
}

.code-head button:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.code-head .code-copy {
  border-color: rgba(255, 255, 255, .08);
  color: #aeb6c8;
}

.code-head .code-copy[data-copy-state="success"] {
  border-color: rgba(53, 212, 154, .22);
  background: rgba(53, 212, 154, .1);
  color: #60e0b1;
}

.code-wrap pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #d6deeb;
}

.code-wrap code {
  font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.message-body :not(pre) > code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-active);
  color: var(--text);
  font: 12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.message-body table {
  width: 100%;
  margin: 14px 0;
  border-collapse: collapse;
  font-size: 13px;
}

.message-body th,
.message-body td {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  text-align: left;
}

.message-body th {
  background: var(--surface);
}

.message-body a {
  color: #9c93ff;
  text-underline-offset: 3px;
}

.attachment-strip {
  width: min(calc(100% - 32px), var(--chat-width));
  display: flex;
  gap: 7px;
  margin: 0 auto;
  overflow-x: auto;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 10px;
}

.attachment-chip small {
  color: var(--muted);
}

.attachment-chip button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
}

.composer{width: min(calc(100% - 32px), var(--chat-width));
  margin: 9px auto 4px;
  padding: 11px 12px 9px;
  padding-bottom: calc(9px + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 12px 38px rgba(0, 0, 0, .16);
}

.composer:focus-within {
  border-color: rgba(124, 108, 255, .65);
  box-shadow: 0 12px 42px rgba(0, 0, 0, .18), var(--focus);
}

.composer textarea {
  width: 100%;
  max-height: 180px;
  display: block;
  resize: none;
  padding: 3px 4px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
}

.composer textarea::placeholder {
  color: var(--muted);
}

@media(max-width:760px) {
  .composer textarea {
    font-size: 16px;
  }
}

.composer-bar {
  display: flex;
  align-items: center;
  margin-top: 7px;
}

.composer-tools {
  display: flex;
  gap: 4px;
}

.composer-tools button {
  min-width: 31px;
  height: 31px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.composer-tools button:hover {
  border-color: var(--border);
  background: var(--surface-hover);
  color: var(--text-soft);
}

#tools-button.active {
  background: var(--primary, #2563eb);
  color: #fff;
  border-color: var(--primary, #2563eb);
}

.char-count {
  margin-left: auto;
  margin-right: 10px;
  color: var(--muted);
  font-size: 9px;
}

.send {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  box-shadow: 0 6px 18px rgba(124, 108, 255, .28);
}

.send:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.send.stop {
  background: var(--danger);
  font-size: 12px;
}

.disclaimer {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.sidebar.right {
  padding: 16px;
  overflow-y: auto;
  border-left: 1px solid var(--border);
}

.panel-head {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.panel-head strong {
  font-size: 13px;
}

.right section {
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--border);
}

.right h2 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.provider-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
}

.provider-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.provider-logo {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--accent-soft);
  color: #a69dff;
  font-weight: 700;
}

.provider-card span:nth-child(2) {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.provider-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.tool-grid button {
  min-height: 62px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: #a69dff;
  text-align: left;
}

.tool-grid button:hover {
  border-color: rgba(124, 108, 255, .35);
  background: var(--surface-hover);
}

.tool-grid span {
  color: var(--muted);
  font-size: 10px;
}

.info-list {
  margin: 0 0 10px;
}

.info-list div {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
}

.info-list dt {
  color: var(--muted);
}

.info-list dd {
  margin: 0;
  color: var(--text-soft);
}

.subtle {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
}

.subtle:hover {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.danger {
  color: var(--danger);
}

.quick-prompts {
  display: grid;
  gap: 6px;
}

.quick-prompts button {
  padding: 8px 9px;
  font-size: 10px;
}

.right footer {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 18px;
  color: var(--muted);
  font-size: 9px;
}

.content-page {
  overflow-y: auto;
  padding: 35px clamp(22px, 5vw, 64px);
}

.content-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 25px;
}

.content-head h1 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -.04em;
}

.content-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 13px;
}

.card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .02);
}

.card:hover {
  border-color: var(--border-strong);
}

.card h2,
.card h3 {
  margin-top: 0;
}

.empty-state {
  max-width: 640px;
  margin: 10vh auto;
  padding: 46px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel-strong);
  text-align: center;
}

.empty-state .orb {
  margin-bottom: 22px;
}

.provider-row,
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.provider-row > span:nth-child(2),
.file-row > span:nth-child(2) {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.provider-row small,
.file-row small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.row-actions button {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
}

.row-actions button:hover {
  background: var(--surface-hover);
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
  font-size: 9px;
}

.field {
  display: grid;
  gap: 5px;
  margin: 13px 0;
}

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

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
}

.check-field input {
  accent-color: var(--accent);
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 7, 12, .74);
  backdrop-filter: blur(9px);
  animation: fade-in .16s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
}

.modal {
  width: min(540px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.modal-actions button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
}

.modal-actions button:hover {
  background: var(--surface-hover);
}

.modal-actions .primary {
  border-color: var(--accent);
  background: var(--accent);
}

.search-results {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}

.search-results button {
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
}

.search-results button:hover {
  background: var(--surface-hover);
}

.backdrop {
  position: fixed;
  z-index: 69;
  inset: var(--top) 0 0;
  background: rgba(3, 5, 9, .64);
  backdrop-filter: blur(2px);
}

.mobile-only {
  display: none;
}

@media(max-width:1100px) {
  :root {
    --right: 0px;
  }

  .shell {
    grid-template-columns: var(--left) minmax(0, 1fr);
  }

  .sidebar.right {
    position: fixed;
    z-index: 70;
    top: var(--top);
    right: 0;
    bottom: 0;
    width: 300px;
    transform: translateX(105%);
    transition: transform .22s ease;
  }

  .sidebar.right.open {
    transform: none;
  }

  .mobile-only#inspector-open,
  .mobile-only#inspector-close {
    display: grid;
  }
}

@media(max-width:760px) {
  :root {
    --left: 0px;
    --top: 58px;
  }

  body {
    min-height: 100dvh;
  }

  .app {
    height: 100dvh;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding: 0 9px;
  }

  .topbar > .mobile-only {
    display: grid;
  }

  .brand {
    justify-self: start;
  }

  .brand small,
  .search-trigger,
  .status-pill {
    display: none;
  }

  .brand-mark {
    width: 33px;
    height: 33px;
    border-radius: 10px;
  }

  .top-actions {
    gap: 3px;
  }

  .top-actions .icon-btn {
    display: none;
  }

  .shell {
    height: 100%;
    min-height: 0;
    display: block;
    overflow: hidden;
  }

  .main{height:100%;min-height:0;overflow:hidden}

  .sidebar.left {
    position: fixed;
    z-index: 70;
    top: var(--top);
    bottom: 0;
    left: 0;
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }

  .sidebar.left.open {
    transform: none;
  }

  .chat-header {
    min-height: 60px;
    padding: 0 13px;
  }

  .title-line h1 {
    max-width: 64vw;
    font-size: 14px;
  }

  .messages {
    padding: 22px 12px 14px;
  }

  .welcome {
    margin: 38px auto 22px;
  }

  .welcome h2 {
    font-size: 25px;
  }

  .starter-grid {
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 24px;
  }

  .starter-grid button {
    min-height: 44px;
  }

  .message {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 9px;
    margin-bottom: 26px;
  }

  .message.user {
    grid-template-columns: minmax(0, 1fr) 28px;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
  }

  .message.user > div:nth-child(2) {
    max-width: 92%;
  }

  .message-body {
    font-size: 14px;
    line-height: 1.7;
  }

  .message-actions {
    opacity: .65;
  }

  .message-actions .copy-message,
  .code-copy {
    min-height: 30px;
    padding: 5px 9px;
    font-size: 11px;
  }

  .attachment-strip,
  .composer {
    width: calc(100% - 20px);
  }

  .composer {
    margin-top: 7px;
    padding: 9px 10px 8px;
    border-radius: 19px;
  }

  .composer-tools button {
    height: 30px;
  }

  .disclaimer {
    margin-bottom: max(5px, env(safe-area-inset-bottom));
  }

  .tool-grid button {
    min-height: 58px;
  }

  .content-page {
    padding: 24px 14px;
  }

  .content-head {
    align-items: start;
    gap: 14px;
  }

  .content-head h1 {
    font-size: 24px;
  }

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

  .provider-row,
  .file-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .row-actions {
    width: 100%;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 88vh;
    padding: 21px 18px max(22px, env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
  }

  .login-card {
    padding: 30px 24px;
  }
}

@media(max-width:420px) {
  .brand > span:last-child {
    display: none;
  }

  .content-head {
    display: grid;
  }

  .content-head .primary {
    width: 100%;
  }
}

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

/* PWA: toast status pemasangan (muncul di bawah, mesra safe-area) */
.pwa-toast {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface, #2f2f2f);
  color: var(--text, #ececec);
  border: 1px solid var(--border, rgba(255,255,255,0.15));
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 1000;
  max-width: calc(100vw - 40px);
  text-align: center;
  transition: opacity .22s, transform .22s;
  pointer-events: none;
}
.pwa-toast.fade-out {
  opacity: 0;
  transform: translate(-50%, 10px);
}

/* ============================================================
   IDSHAN AI Premium Skin — 2026-10-03
   Visual-only refresh. Existing selectors and behavior retained.
   ============================================================ */
:root{
  --bg:#09090b;
  --bg-elevated:#111013;
  --panel:#0d0c0f;
  --panel-strong:#151217;
  --surface:#171419;
  --surface-hover:#211a20;
  --surface-active:#2a2027;
  --text:#f7f3f5;
  --text-soft:#d9d0d5;
  --muted:#90868c;
  --border:rgba(255,255,255,.075);
  --border-strong:rgba(255,255,255,.14);
  --accent:#d84d61;
  --accent-hover:#ef7184;
  --accent-soft:rgba(216,77,97,.14);
  --success:#55d3a0;
  --danger:#ff6f82;
  --code:#080809;
  --shadow-sm:0 8px 24px rgba(0,0,0,.22);
  --shadow-lg:0 26px 80px rgba(0,0,0,.46);
  --focus:0 0 0 3px rgba(216,77,97,.18);
}

html[data-theme="light"]{
  --accent:#c23f55;
  --accent-hover:#a83449;
  --accent-soft:rgba(194,63,85,.09);
}

body{
  background:
    radial-gradient(ellipse 62% 42% at 78% 0,rgba(159,45,66,.17),transparent 68%),
    radial-gradient(ellipse 50% 45% at 20% 100%,rgba(102,62,123,.10),transparent 70%),
    var(--bg);
}

body::before{
  content:"";
  position:fixed;
  pointer-events:none;
  inset:0;
  z-index:-1;
  opacity:.18;
  background:
    linear-gradient(115deg,transparent 0 43%,rgba(255,255,255,.018) 43.2% 43.4%,transparent 43.6%),
    linear-gradient(28deg,transparent 0 70%,rgba(216,77,97,.03) 70.2% 70.4%,transparent 70.6%);
}

.brand-mark{
  border:1px solid rgba(244,124,143,.48);
  border-radius:12px;
  background:
    radial-gradient(circle at 30% 18%,rgba(255,255,255,.26),transparent 25%),
    linear-gradient(145deg,#e45269,#7b2236 78%);
  color:#fff;
  box-shadow:0 10px 28px rgba(177,45,70,.25), inset 0 1px rgba(255,255,255,.10);
}

.primary,
.send{
  border-color:rgba(255,157,172,.15);
  background:linear-gradient(135deg,#e14f67,#ad354c);
  box-shadow:0 10px 28px rgba(173,46,70,.22);
}
.primary:hover,
.send:hover{
  background:linear-gradient(135deg,#ee6479,#bc4058);
}

.topbar{
  border-bottom:1px solid rgba(255,255,255,.065);
  background:rgba(10,9,11,.82);
  backdrop-filter:blur(26px) saturate(145%);
  box-shadow:0 12px 34px rgba(0,0,0,.12);
}

.brand strong{font-size:14px;letter-spacing:.015em}
.brand small{color:#7f757b}
.search-trigger{
  border-color:#2e282c;
  border-radius:13px;
  background:rgba(20,17,20,.86);
  box-shadow:inset 0 1px rgba(255,255,255,.018);
}
.search-trigger:hover{
  border-color:#49353d;
  background:#1b161a;
}
.search-trigger kbd{
  border-color:#352c31;
  background:#0e0d0f;
}

.avatar-btn,.avatar{
  border-color:rgba(216,77,97,.25);
  background:#29161d;
  color:#f18aa0;
}

.status-pill{
  border:1px solid #28372f;
  background:#101814;
}
.status-pill i.online{box-shadow:0 0 14px rgba(85,211,160,.55)}

.sidebar{
  background:rgba(12,11,13,.94);
}
.sidebar.left{border-right-color:#211d20}
.sidebar.right{border-left-color:#211d20}

.new-chat{
  min-height:44px;
  border-radius:12px;
}

.left nav button{
  min-height:42px;
  border:1px solid transparent;
  border-radius:11px;
}
.left nav button:hover{
  border-color:#2c2529;
  background:#171417;
}
.left nav button.active{
  border-color:rgba(216,77,97,.15);
  background:linear-gradient(90deg,rgba(216,77,97,.18),rgba(216,77,97,.05));
  color:#fff;
  box-shadow:inset 3px 0 #d84d61;
}
.left nav button.active span{color:#ed7184}

.history-item:hover > button:first-child,
.history-item.active > button:first-child{background:#171417}
.history-item.active > button:first-child{box-shadow:inset 2px 0 #d84d61}
.user-card{border-top-color:#242023}

.main{
  background:
    radial-gradient(circle at 82% 10%,rgba(151,43,63,.08),transparent 28%),
    transparent;
}

.chat-header{
  border-bottom-color:#211d20;
  background:rgba(9,9,11,.76);
  backdrop-filter:blur(18px);
}
.title-line h1{font-size:16px;font-weight:700}
.model-chip{
  margin-top:5px;
  padding:5px 9px;
  border:1px solid #30282d;
  border-radius:999px;
  background:#121012;
}
.model-chip:hover{
  border-color:#51343e;
  background:#191417;
  color:#eee5e9;
}
.model-chip span{color:#e06a7c}

.messages{
  background:
    radial-gradient(circle at 50% 0,rgba(164,53,73,.045),transparent 34%);
}

.message-avatar{
  border:1px solid rgba(255,255,255,.06);
  background:#171417;
  box-shadow:0 6px 18px rgba(0,0,0,.16);
}
.message.assistant .message-avatar{
  background:linear-gradient(145deg,#d64c61,#7b2638);
  color:#fff;
}
.message.user .message-avatar{
  background:#201a1f;
  color:#d9ccd2;
}

.message-body{
  color:#e9e2e5;
}
.message.user .message-body{
  border:1px solid #33292f;
  border-radius:18px 18px 5px 18px;
  background:linear-gradient(145deg,#1e181c,#161316);
  box-shadow:0 10px 30px rgba(0,0,0,.12);
}
.message-body blockquote{
  border-left-color:#d84d61;
  background:rgba(216,77,97,.06);
}
.message-body :not(pre) > code{
  border:1px solid #32292e;
  background:#151214;
}
.message-body pre{
  border-color:#2d282b;
  border-radius:14px;
  background:#09090a;
}

.composer{
  border-color:#3b3036;
  border-radius:23px;
  background:rgba(21,18,21,.95);
  box-shadow:0 18px 55px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.025);
  backdrop-filter:blur(18px);
}
.composer:focus-within{
  border-color:rgba(228,92,113,.64);
  box-shadow:0 20px 65px rgba(0,0,0,.32),0 0 0 3px rgba(216,77,97,.11);
}
.composer-tools button:hover{
  border-color:#3b3036;
  background:#211a1f;
}
#tools-button.active{
  border-color:#c34359;
  background:#b63b52;
}

.provider-card,
.tool-grid button{
  border-color:#30282d;
  border-radius:14px;
  background:linear-gradient(145deg,#171417,#111012);
  box-shadow:0 10px 28px rgba(0,0,0,.10);
}
.provider-card:hover,
.tool-grid button:hover{
  border-color:#51343e;
  background:#1d171b;
}
.provider-logo{
  border:1px solid rgba(216,77,97,.16);
  background:#2c1820;
  color:#ef7c90;
}
.tool-grid button{color:#e87588}

.right section{border-bottom-color:#242023}
.right h2{color:#766c72}

.content-page{
  background:
    radial-gradient(circle at 85% 0,rgba(159,45,66,.07),transparent 28%);
}
.cards > *,
.provider-row,
.file-row{
  border-color:#30282d !important;
  background:linear-gradient(145deg,#151316,#0f0e10) !important;
  box-shadow:0 14px 38px rgba(0,0,0,.10);
}

.modal{
  border-color:#3b3036;
  border-radius:22px;
  background:#141214;
  box-shadow:0 34px 100px rgba(0,0,0,.55);
}
.modal-backdrop{
  background:rgba(4,3,4,.76);
  backdrop-filter:blur(8px);
}

.login-view{
  background:
    radial-gradient(circle at 75% 18%,rgba(183,49,72,.22),transparent 30%),
    radial-gradient(circle at 18% 80%,rgba(99,58,119,.12),transparent 34%),
    #09090a;
}
.login-card{
  border:1px solid #3a2e34;
  border-radius:26px;
  background:rgba(17,15,17,.90);
  box-shadow:0 35px 100px rgba(0,0,0,.48);
  backdrop-filter:blur(28px);
}
.login-card::before{
  background:linear-gradient(90deg,transparent,#d84d61,#b77cff,transparent);
}
.login-card input{
  border-color:#352c31;
  border-radius:12px;
  background:#0d0c0e;
}
.login-card input:focus{
  border-color:#b7485d;
  box-shadow:0 0 0 3px rgba(216,77,97,.11);
}
.eyebrow{color:#b9a7ff}

@media(max-width:760px){
  .topbar{
    background:rgba(9,9,10,.92);
    box-shadow:0 10px 30px rgba(0,0,0,.18);
  }
  .chat-header{
    background:rgba(9,9,10,.88);
  }
  .messages{
    padding-left:13px;
    padding-right:13px;
  }
  .composer{
    width:calc(100% - 18px);
    margin-bottom:5px;
    border-radius:21px;
  }
  .sidebar.left,
  .sidebar.right{
    background:#0c0b0d;
    box-shadow:24px 0 70px rgba(0,0,0,.46);
  }
  .message.user .message-body{
    max-width:100%;
  }
}

@media(max-width:420px){
  .brand > span:last-child{display:flex}
  .brand strong{font-size:12px}
  .brand small{display:none}
  .top-actions .avatar-btn{width:31px;height:31px}
}

/* IDSHAN AI dark consistency fix — 2026-10-03 */
html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#09090b;
  --bg-elevated:#111013;
  --panel:#0d0c0f;
  --panel-strong:#151217;
  --surface:#171419;
  --surface-hover:#211a20;
  --surface-active:#2a2027;
  --text:#f7f3f5;
  --text-soft:#d9d0d5;
  --muted:#90868c;
  --border:rgba(255,255,255,.075);
  --border-strong:rgba(255,255,255,.14);
  --accent:#d84d61;
  --accent-hover:#ef7184;
  --accent-soft:rgba(216,77,97,.14);
  --success:#55d3a0;
  --danger:#ff6f82;
  --code:#080809;
  --shadow-sm:0 8px 24px rgba(0,0,0,.22);
  --shadow-lg:0 26px 80px rgba(0,0,0,.46);
  --focus:0 0 0 3px rgba(216,77,97,.18);
}
html[data-theme="dark"] body,html[data-theme="dark"] .app,html[data-theme="dark"] .shell,html[data-theme="dark"] .main,html[data-theme="dark"] .page,html[data-theme="dark"] .chat-page,html[data-theme="dark"] .messages{background-color:#09090b!important}
html[data-theme="dark"] .main,html[data-theme="dark"] .messages{color:#f7f3f5!important}
html[data-theme="dark"] .chat-header,html[data-theme="dark"] .topbar{color:#f7f3f5!important}
html[data-theme="dark"] .title-line h1,html[data-theme="dark"] .brand strong{color:#f7f3f5!important}
html[data-theme="dark"] .disclaimer{color:#81777d!important}

/* Settings + content premium consistency — v20 */
.content-page{
  background:
    radial-gradient(circle at 92% 3%,rgba(177,49,72,.12),transparent 26%),
    radial-gradient(circle at 8% 94%,rgba(96,55,116,.08),transparent 30%),
    #09090b !important;
  color:#f7f3f5 !important;
}
.content-head h1{color:#f7f3f5 !important}
.content-head p{color:#92878d !important}
.card{
  border:1px solid #332b2f !important;
  border-radius:18px !important;
  background:
    radial-gradient(circle at 100% 0,rgba(183,56,78,.06),transparent 35%),
    linear-gradient(145deg,#161316,#0f0e10) !important;
  color:#f3edf0 !important;
  box-shadow:0 16px 42px rgba(0,0,0,.16) !important;
}
.card h2,.card h3{color:#f3edf0 !important}
.card .muted{color:#94898f !important}
.info-list dt{color:#8f858a !important}
.info-list dd{color:#ddd4d8 !important}
.settings-grid{grid-template-columns:repeat(auto-fit,minmax(250px,1fr))}
.appearance-card{display:flex;align-items:center;gap:15px}
.setting-icon{
  display:grid;width:46px;height:46px;flex:0 0 auto;place-items:center;
  border:1px solid #5a3540;border-radius:14px;
  background:linear-gradient(145deg,#3b1c27,#22141a);
  color:#f07b8f;font-size:19px;box-shadow:0 8px 24px rgba(177,45,70,.14);
}
.appearance-card h2{margin-bottom:4px}
.appearance-card p{margin:0 0 10px}
.settings-pill{
  display:inline-flex;padding:5px 9px;border:1px solid #49313a;border-radius:999px;
  background:#21161b;color:#e78293;font-size:10px;font-weight:700;letter-spacing:.04em;
}
@media(max-width:760px){
  .content-page{padding:25px 15px 32px !important}
  .content-head{margin-bottom:20px}
  .content-head h1{font-size:30px}
  .cards{gap:11px}
  .card{padding:18px !important;border-radius:17px !important}
}

/* Dual premium themes — v21 */
html[data-theme="light"]{
  color-scheme:light;
  --bg:#f6f3f4;
  --bg-elevated:#ffffff;
  --panel:#fbf9fa;
  --panel-strong:#ffffff;
  --surface:#f2edef;
  --surface-hover:#ebe4e7;
  --surface-active:#e4dadd;
  --text:#211b1e;
  --text-soft:#4f444a;
  --muted:#7e7278;
  --border:rgba(54,35,44,.10);
  --border-strong:rgba(54,35,44,.17);
  --accent:#c23f55;
  --accent-hover:#a83449;
  --accent-soft:rgba(194,63,85,.10);
  --success:#228b65;
  --danger:#d84c60;
  --code:#f2edef;
  --shadow-sm:0 8px 20px rgba(59,35,44,.07);
  --shadow-lg:0 24px 70px rgba(59,35,44,.12);
  --focus:0 0 0 3px rgba(194,63,85,.15);
}
html[data-theme="light"],
html[data-theme="light"] body,
html[data-theme="light"] .app,
html[data-theme="light"] .shell,
html[data-theme="light"] .main,
html[data-theme="light"] .page,
html[data-theme="light"] .chat-page,
html[data-theme="light"] .messages{
  background-color:var(--bg)!important;
}
html[data-theme="light"] body{
  background:
    radial-gradient(ellipse 54% 34% at 82% 5%,rgba(194,63,85,.08),transparent 70%),
    radial-gradient(ellipse 45% 35% at 12% 90%,rgba(136,93,155,.06),transparent 72%),
    var(--bg)!important;
  color:var(--text)!important;
}
html[data-theme="light"] .topbar,
html[data-theme="light"] .chat-header{
  background:rgba(250,247,248,.88)!important;
  color:var(--text)!important;
  border-color:rgba(54,35,44,.09)!important;
}
html[data-theme="light"] .sidebar{background:#fbf9fa!important}
html[data-theme="light"] .sidebar.left{border-right-color:rgba(54,35,44,.09)!important}
html[data-theme="light"] .sidebar.right{border-left-color:rgba(54,35,44,.09)!important}
html[data-theme="light"] .brand strong,
html[data-theme="light"] .title-line h1,
html[data-theme="light"] .content-head h1{color:#211b1e!important}
html[data-theme="light"] .model-chip{
  border-color:#e0d4d8!important;
  background:#fff!important;
  color:#766a70!important;
}
html[data-theme="light"] .messages{color:#211b1e!important}
html[data-theme="light"] .message-body{color:#2d2529!important}
html[data-theme="light"] .message.user .message-body{
  border-color:#dfd4d8!important;
  background:linear-gradient(145deg,#fff,#f2edef)!important;
  color:#211b1e!important;
}
html[data-theme="light"] .composer{
  border-color:#d9cbd0!important;
  background:rgba(255,255,255,.96)!important;
  box-shadow:0 18px 50px rgba(77,48,59,.10),inset 0 1px rgba(255,255,255,.8)!important;
}
html[data-theme="light"] .composer textarea{color:#211b1e!important}
html[data-theme="light"] .provider-card,
html[data-theme="light"] .tool-grid button{
  border-color:#dfd4d8!important;
  background:linear-gradient(145deg,#fff,#f6f1f3)!important;
}
html[data-theme="light"] .content-page{
  background:
    radial-gradient(circle at 92% 3%,rgba(194,63,85,.07),transparent 26%),
    #f6f3f4!important;
  color:#211b1e!important;
}
html[data-theme="light"] .content-head p{color:#7e7278!important}
html[data-theme="light"] .card{
  border-color:#dfd4d8!important;
  background:linear-gradient(145deg,#fff,#f8f4f6)!important;
  color:#211b1e!important;
  box-shadow:0 14px 36px rgba(69,42,52,.07)!important;
}
html[data-theme="light"] .card h2,
html[data-theme="light"] .card h3{color:#211b1e!important}
html[data-theme="light"] .card .muted,
html[data-theme="light"] .info-list dt{color:#7e7278!important}
html[data-theme="light"] .info-list dd{color:#4d4248!important}
html[data-theme="light"] .field select,
html[data-theme="light"] .field input,
html[data-theme="light"] .field textarea{
  border-color:#d7cbd0!important;
  background:#fff!important;
  color:#211b1e!important;
}
html[data-theme="light"] .setting-icon{
  border-color:#e2c5cc;
  background:linear-gradient(145deg,#fce8ed,#f5dbe1);
  color:#c23f55;
}
html[data-theme="light"] .disclaimer{color:#8a7e84!important}
.appearance-copy{min-width:0;flex:1}
.appearance-card .field{margin:10px 0 0}

/* Cerah Premium inspired by clean neutral console UI — v22 */
html[data-theme="light"]{
  --bg:#f7f4ef;--bg-elevated:#fffdfa;--panel:#fffdfa;--panel-strong:#ffffff;
  --surface:#f3eee8;--surface-hover:#ece5de;--surface-active:#e6ddd4;
  --text:#24211e;--text-soft:#4f4a45;--muted:#77706a;
  --border:rgba(55,45,38,.09);--border-strong:rgba(55,45,38,.15);
  --accent:#c23f55;--accent-hover:#a83449;--accent-soft:rgba(194,63,85,.12);
  --success:#258c69;--danger:#d95757;--code:#f1ece6;
  --shadow-sm:0 8px 22px rgba(61,48,38,.06);--shadow-lg:0 26px 70px rgba(61,48,38,.11);
  --focus:0 0 0 3px rgba(194,63,85,.14);
}
html[data-theme="light"] body{background:radial-gradient(circle at 85% 4%,rgba(194,63,85,.035),transparent 28%),#f7f4ef!important;color:#24211e!important}
html[data-theme="light"] .topbar,html[data-theme="light"] .chat-header{background:rgba(255,253,250,.94)!important;border-color:rgba(55,45,38,.08)!important;color:#24211e!important}
html[data-theme="light"] .sidebar{background:#fffdfa!important}
html[data-theme="light"] .sidebar.left{border-right-color:rgba(55,45,38,.08)!important}
html[data-theme="light"] .sidebar.right{border-left-color:rgba(55,45,38,.08)!important}
html[data-theme="light"] .brand-mark{border-color:rgba(194,63,85,.34);background:radial-gradient(circle at 30% 18%,rgba(255,255,255,.65),transparent 26%),linear-gradient(145deg,#e45269,#c23f55 72%);box-shadow:0 10px 24px rgba(194,63,85,.16),inset 0 1px rgba(255,255,255,.5)}
html[data-theme="light"] .brand strong,html[data-theme="light"] .title-line h1,html[data-theme="light"] .content-head h1{color:#24211e!important}
html[data-theme="light"] .left nav button{color:#4f4a45}
html[data-theme="light"] .left nav button:hover{border-color:#eee2d9;background:#f6efe8;color:#24211e}
html[data-theme="light"] .left nav button.active{border-color:rgba(194,63,85,.11);background:#fbe6ea;color:#c23f55;box-shadow:none}
html[data-theme="light"] .left nav button.active span{color:#c23f55}
html[data-theme="light"] .history-item:hover>button:first-child,html[data-theme="light"] .history-item.active>button:first-child{background:#f6efe8}
html[data-theme="light"] .history-item.active>button:first-child{box-shadow:inset 2px 0 #c23f55}
html[data-theme="light"] .user-card{border-top-color:#eee6df}
html[data-theme="light"] .avatar-btn,html[data-theme="light"] .avatar{border-color:rgba(194,63,85,.20);background:#fdeef1;color:#c23f55}
html[data-theme="light"] .model-chip{border-color:#e6ddd5!important;background:#fffdfa!important;color:#6d655f!important}
html[data-theme="light"] .messages{background:#f7f4ef!important;color:#24211e!important}
html[data-theme="light"] .message-body{color:#2d2529!important}
html[data-theme="light"] .message.assistant .message-avatar{background:#fdeef1!important;color:#c23f55!important;border-color:#f2cdd4!important}
html[data-theme="light"] .message.user .message-avatar{background:#efe7df!important;color:#5e5650!important}
html[data-theme="light"] .message.user .message-body{border-color:#ddd3cb!important;background:#efeae5!important;color:#24211e!important;box-shadow:none!important}
html[data-theme="light"] .composer{border-color:#d9cfc7!important;background:#fffdfa!important;box-shadow:0 14px 38px rgba(61,48,38,.09)!important}
html[data-theme="light"] .composer:focus-within{border-color:rgba(194,63,85,.52)!important;box-shadow:0 14px 42px rgba(61,48,38,.10),0 0 0 3px rgba(194,63,85,.08)!important}
html[data-theme="light"] .composer textarea{color:#24211e!important}
html[data-theme="light"] .send,html[data-theme="light"] .primary{background:linear-gradient(135deg,#e14f67,#c23f55)!important;box-shadow:0 8px 20px rgba(194,63,85,.18)!important}
html[data-theme="light"] .provider-card,html[data-theme="light"] .tool-grid button{border-color:#e5ddd6!important;background:#fffdfa!important;box-shadow:none!important}
html[data-theme="light"] .tool-grid button{color:#c23f55}
html[data-theme="light"] .content-page{background:#f7f4ef!important;color:#24211e!important}
html[data-theme="light"] .content-head p{color:#77706a!important}
html[data-theme="light"] .card{border-color:#e3dad3!important;background:#fffdfa!important;color:#24211e!important;box-shadow:0 10px 28px rgba(61,48,38,.055)!important}
html[data-theme="light"] .card h2,html[data-theme="light"] .card h3{color:#24211e!important}
html[data-theme="light"] .card .muted,html[data-theme="light"] .info-list dt{color:#77706a!important}
html[data-theme="light"] .info-list dd{color:#4f4a45!important}
html[data-theme="light"] .setting-icon{border-color:#efc3cc;background:#fdecef;color:#c23f55;box-shadow:none}
html[data-theme="light"] .field select,html[data-theme="light"] .field input,html[data-theme="light"] .field textarea{border-color:#dcd2ca!important;background:#fff!important;color:#24211e!important}
html[data-theme="light"] .search-trigger{border-color:#e5ddd6!important;background:#f8f3ee!important}

/* Cerah Premium: halaman log masuk ikut tema (aksen merah IDSHAN) */
html[data-theme="light"] .login-view{
  background:
    radial-gradient(circle at 75% 18%,rgba(194,63,85,.13),transparent 32%),
    radial-gradient(circle at 18% 80%,rgba(136,93,155,.08),transparent 36%),
    #f7f4ef!important;
}
html[data-theme="light"] .login-card{
  border-color:#e3dad3!important;
  background:rgba(255,253,250,.96)!important;
  box-shadow:0 26px 70px rgba(61,48,38,.12)!important;
}
html[data-theme="light"] .login-card h1{color:#24211e!important}
html[data-theme="light"] .login-card p,
html[data-theme="light"] .login-card label{color:#6d655f!important}
html[data-theme="light"] .login-card input{
  border-color:#dcd2ca!important;
  background:#fff!important;
  color:#24211e!important;
}
html[data-theme="light"] .login-card input:focus{
  border-color:#c23f55!important;
  box-shadow:0 0 0 3px rgba(194,63,85,.12)!important;
}
html[data-theme="light"] .eyebrow{color:#c23f55!important}
html[data-theme="light"] .login-card .primary{
  background:linear-gradient(135deg,#e14f67,#c23f55)!important;
  color:#fff!important;
  box-shadow:0 10px 24px rgba(194,63,85,.22)!important;
}

/* ===== Mobile chat v2: ruang sembang penuh, gaya aplikasi (UI sahaja) ===== */
@media(max-width:760px){
  :root{--top:46px}
  html,body{overflow:hidden;overscroll-behavior:none}
  .app{position:relative;height:100dvh;overflow:hidden}
  .topbar{position:absolute;height:calc(var(--top) + env(safe-area-inset-top,0px));padding-left:max(8px,env(safe-area-inset-left,0px));padding-right:max(8px,env(safe-area-inset-right,0px));gap:6px}
  .brand-mark{width:28px;height:28px;border-radius:9px;font-size:14px}
  .top-actions .avatar-btn{width:30px;height:30px}
  .topbar .icon-btn,.topbar .avatar-btn{min-width:36px;min-height:36px}
  .shell{padding-top:calc(var(--top) + env(safe-area-inset-top,0px))}
  .chat-header{min-height:0;height:40px;padding:0 8px 0 12px;gap:8px;backdrop-filter:none}
  .chat-header>div:first-child{min-width:0;flex:1;display:flex;align-items:center;gap:8px}
  .title-line{min-width:0;flex:1}
  .title-line h1{max-width:none;font-size:14px;line-height:1.2}
  .title-line .tiny-btn{display:none}
  .model-chip{margin:0;flex:none;max-width:48%;padding:3px 9px;font-size:11px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #inspector-open{min-width:34px;min-height:34px}
  .messages{padding:10px 12px 8px;overscroll-behavior-y:contain;scroll-padding-bottom:8px}
  .message,.message.user{display:block;width:100%;margin:0 auto 16px;animation:none}
  .message-avatar,.message-head{display:none}
  .message>div:nth-child(2),.message.user>div:nth-child(2){max-width:100%;width:100%}
  .message.user>div:nth-child(2){display:flex;flex-direction:column;align-items:flex-end}
  .message.user .message-body{max-width:88%;padding:8px 13px;border-radius:18px 18px 5px 18px}
  .message-body{font-size:15px;line-height:1.6}
  .message-actions{margin-top:2px;gap:6px;min-height:0}
  .message:last-child{margin-bottom:4px}
  .attachment-strip,.composer{width:calc(100% - 14px)}
  .composer{margin:4px auto 2px;padding:7px 9px 6px;padding-bottom:calc(6px + env(safe-area-inset-bottom,0px));border-radius:22px}
  .composer textarea{max-height:34dvh;padding:2px 3px;line-height:1.45}
  .composer-bar{margin-top:3px}
  .composer-tools button{height:32px;min-width:34px}
  .send{width:36px;height:36px}
  .disclaimer{margin:0 0 max(3px,env(safe-area-inset-bottom,0px));font-size:9.5px;line-height:1.2;opacity:.8}
  html.kb-open .disclaimer{display:none}
  html.kb-open .composer{padding-bottom:6px;margin-bottom:4px}
  html.kb-open .chat-header{height:36px}
  .empty-chat-placeholder{min-height:0}
}
@media(max-width:760px) and (max-height:480px){
  .chat-header{display:none}
  .composer textarea{max-height:30dvh}
}
@media(max-width:760px){
  .message-actions{margin-left:0!important;padding-left:0!important;justify-content:flex-start}
  .message.user .message-actions{justify-content:flex-end}
  .message-actions button{min-height:32px;padding:5px 10px;opacity:1}
  .message-actions{opacity:.8}
  .disclaimer{margin:2px 0 max(7px,env(safe-area-inset-bottom,0px))}
  html.kb-open .disclaimer{display:none}
  .composer{margin-bottom:3px}
}

/* Mobile fix: nama model panjang tidak boleh melebarkan halaman */
@media(max-width:760px){
  .chat-page{grid-template-columns:minmax(0,1fr);width:100%;max-width:100vw}
  .chat-page>*{min-width:0;max-width:100%}
  .chat-header>div:first-child{min-width:0;overflow:hidden}
  .model-chip{min-width:0;max-width:56%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .model-chip b{flex:none}
  .composer,.attachment-strip{box-sizing:border-box;max-width:calc(100vw - 14px)}
  .message-body{min-width:0;max-width:100%;overflow-wrap:anywhere}
  .message-body pre,.message-body table{max-width:100%;overflow-x:auto}
}
@media(max-width:760px){
  .sidebar.left:not(.open),.sidebar.right:not(.open){box-shadow:none!important;visibility:hidden;pointer-events:none;transition:transform .22s ease,visibility 0s linear .22s}
  .sidebar.left.open,.sidebar.right.open{visibility:visible;pointer-events:auto;transition:transform .22s ease,visibility 0s}
  .message-actions button{font-size:12px}
}

/* ===== Composer v3: satu baris gaya ChatGPT (mobile) ===== */
@media(max-width:760px){
  .composer{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"tools input send";align-items:end;column-gap:4px;margin:4px auto 2px;padding:6px 6px 6px 8px;padding-bottom:calc(6px + env(safe-area-inset-bottom,0px));min-height:48px;border-radius:26px}
  html.kb-open .composer{padding-bottom:6px}
  .composer textarea{grid-area:input;min-height:36px;height:36px;max-height:150px;margin:0;padding:7px 4px;line-height:1.45;font-size:16px;overflow-y:hidden;align-self:center}
  .composer-bar{display:contents}
  .composer-tools{grid-area:tools;align-self:end;display:flex;gap:0}
  .composer-tools button{height:36px;min-width:36px;padding:0;border-radius:50%;display:grid;place-items:center}
  #tools-button span{display:none}
  .char-count{display:none}
  .send{grid-area:send;align-self:end;width:36px;height:36px;margin:0}
  .attachment-strip:empty{display:none}
}
@media(max-width:760px){
  .composer textarea::placeholder{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .composer{margin-bottom:5px}
  .disclaimer{margin:3px 0 max(10px,calc(env(safe-area-inset-bottom,0px) + 6px));padding:0 10px}
  html.kb-open .disclaimer{display:none}
}
