/* ============================================================
   Aqivin — Modern Dark design system
   (Restyle only; selectors match existing markup/JS)
   ============================================================ */
:root {
  --dp-color-ground: #050505;
  --dp-color-panel: #0e0e0e;
  --dp-color-hairline: #222222;
  --dp-color-hairline-2: #303030;
  --dp-color-bright: #f2f2f2;
  --dp-color-read: #a6a9ad;
  --dp-color-meta: #8a8d91;
  --dp-color-live: #3aa7e8;
  --dp-color-inverse-ink: #0a0a0a;
  --dp-color-dim: #96999d;
  --dp-brand-blue: #1f8fd6;
  --dp-typography-face: "Geist", "Modern Dark Grotesk", "Helvetica Neue", Arial, sans-serif;
  --dp-typography-mono: "Geist Mono", "Modern Dark Mono", "SFMono-Regular", Menlo, monospace;
  --dp-spacing-gutter: 48px;
  --dp-spacing-gap: 24px;
  --dp-spacing-max: 1360px;
  --dp-radius-panel: 6px;
  --dp-radius-pill: 999px;
  --dp-border-hairline: 1px;
  --dp-motion-duration: 120ms;
  --dp-motion-ease: ease-out;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--dp-typography-face);
  background: var(--dp-color-ground);
  color: var(--dp-color-read);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============ SPLASH ANIMATION ============ */
#splash {
  position: fixed; inset: 0; z-index: 200;
  background: var(--dp-color-ground);
  display: flex; align-items: center; justify-content: center;
}
#splash-video {
  width: min(72vw, 420px);
  aspect-ratio: 1024/576;
  object-fit: contain;
}
.splash-fallback { display: none; }
#splash.splash-skip { display: none; } /* jika JS menandai sudah pernah lihat */
#splash.splash-hide {
  opacity: 0; visibility: hidden;
  transition: opacity .4s ease-out, visibility .4s ease-out;
}
#splash-skip {
  position: absolute; bottom: 28px; right: 24px;
  background: transparent; border: 1px solid var(--dp-color-hairline-2);
  color: var(--dp-color-meta); border-radius: var(--dp-radius-pill);
  padding: 8px 18px; font-size: 12.5px; cursor: pointer;
  font-family: var(--dp-typography-face);
  transition: color var(--dp-motion-duration) var(--dp-motion-ease),
              border-color var(--dp-motion-duration) var(--dp-motion-ease);
}
#splash-skip:hover { color: var(--dp-color-bright); border-color: var(--dp-color-dim); }
@media (prefers-reduced-motion: reduce) {
  #splash-video { display: none; }
  .splash-fallback { display: block; }
  .splash-fallback img { width: 84px; height: 84px; border-radius: 14px; }
}
.hidden { display: none !important; }
.muted { color: var(--dp-color-meta); font-weight: 400; }

/* Splash tetap di atas segalanya sampai selesai */

/* Focus visibility (keyboard accessible) */
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--dp-color-live);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

#app { display: flex; height: 100dvh; }

/* ============ SIDEBAR ============ */
#sidebar {
  width: 272px; min-width: 272px;
  background: var(--dp-color-panel);
  border-right: var(--dp-border-hairline) solid var(--dp-color-hairline);
  display: flex; flex-direction: column;
  transition: margin var(--dp-motion-duration) var(--dp-motion-ease);
}
#sidebar.collapsed { margin-left: -272px; }
.sb-head { padding: 20px 20px 12px; }
.logo {
  font-weight: 400; font-size: 16px; margin-bottom: 16px;
  letter-spacing: .2px; color: var(--dp-color-bright);
}
.btn-new {
  width: 100%; padding: 10px 16px;
  background: var(--dp-color-bright);
  color: var(--dp-color-inverse-ink);
  border: var(--dp-border-hairline) solid var(--dp-color-bright);
  border-radius: var(--dp-radius-pill);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  font-family: var(--dp-typography-face);
  transition: background var(--dp-motion-duration) var(--dp-motion-ease);
}
.btn-new:hover { background: #ffffff; }

.sb-section { flex: 1; overflow-y: auto; padding: 4px 14px; }
.sb-label {
  font-family: var(--dp-typography-mono);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--dp-color-meta); padding: 14px 6px 8px;
}
.chat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: var(--dp-radius-panel);
  cursor: pointer; font-size: 13.5px; color: var(--dp-color-read);
  transition: background var(--dp-motion-duration) var(--dp-motion-ease);
}
.chat-item:hover { background: var(--dp-color-hairline); }
.chat-item.active { background: var(--dp-color-hairline); color: var(--dp-color-bright); }
.chat-item .ct { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .del { margin-left: auto; opacity: 0; border: none; background: none; color: var(--dp-color-meta); cursor: pointer; }
.chat-item:hover .del { opacity: 1; }
.chat-item .del:hover { color: var(--dp-color-bright); }

.sb-foot { padding: 14px; border-top: var(--dp-border-hairline) solid var(--dp-color-hairline); }
.sb-btn {
  width: 100%; padding: 10px 14px; margin-bottom: 6px;
  background: transparent; color: var(--dp-color-read);
  border: var(--dp-border-hairline) solid var(--dp-color-hairline-2);
  border-radius: var(--dp-radius-pill);
  cursor: pointer; font-size: 13.5px; text-align: left;
  font-family: var(--dp-typography-face);
  transition: border-color var(--dp-motion-duration) var(--dp-motion-ease);
}
.sb-btn:hover { border-color: var(--dp-color-dim); color: var(--dp-color-bright); }
.user-info {
  font-family: var(--dp-typography-mono);
  font-size: 11.5px; color: var(--dp-color-meta); padding: 6px 4px 0;
}

/* ============ MAIN ============ */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-bottom: var(--dp-border-hairline) solid var(--dp-color-hairline);
  background: var(--dp-color-ground);
  max-width: var(--dp-spacing-max); width: 100%; margin: 0 auto;
}
.icon-btn {
  background: none; border: none; color: var(--dp-color-read);
  font-size: 16px; cursor: pointer; padding: 6px 9px;
  border-radius: var(--dp-radius-panel);
  transition: color var(--dp-motion-duration) var(--dp-motion-ease);
}
.icon-btn:hover { color: var(--dp-color-bright); }
.model-badge, .key-select {
  font-family: var(--dp-typography-mono);
  font-size: 12px; color: var(--dp-color-bright);
  padding: 7px 14px; border: var(--dp-border-hairline) solid var(--dp-color-hairline-2);
  border-radius: var(--dp-radius-pill);
  background: var(--dp-color-panel); outline: none; max-width: 230px; cursor: pointer;
  transition: border-color var(--dp-motion-duration) var(--dp-motion-ease);
}
.key-select:hover { border-color: var(--dp-color-dim); }
.fast-btn {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: var(--dp-radius-pill);
  border: var(--dp-border-hairline) solid var(--dp-color-hairline-2);
  background: transparent;
  color: var(--dp-color-meta); font-size: 12.5px; cursor: pointer;
  font-family: var(--dp-typography-face);
  transition: color var(--dp-motion-duration) var(--dp-motion-ease),
              border-color var(--dp-motion-duration) var(--dp-motion-ease);
}
.fast-btn:hover { border-color: var(--dp-color-dim); color: var(--dp-color-bright); }
.fast-btn.on {
  background: var(--dp-color-bright);
  color: var(--dp-color-inverse-ink);
  border-color: var(--dp-color-bright);
}
.ai-status {
  flex: 1; min-width: 0;
  font-size: 13px; color: var(--dp-color-bright);
  display: flex; align-items: center; gap: 8px;
}
.ai-status::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--dp-color-live); flex-shrink: 0;
}

/* Brand mark — logo hiu asli */
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 30px; height: 30px; border-radius: var(--dp-radius-panel);
  object-fit: cover; flex-shrink: 0; display: inline-block;
}
.welcome-logo {
  width: 84px; height: 84px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px; overflow: visible;
}
.welcome-logo img { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; box-shadow: 0 4px 24px rgba(0,0,0,.5); }
.logo, .welcome-logo, .auth-title { font-weight: 400; }

/* Assistant messages get the real shark logo */
.msg-wrap.assistant { position: relative; }
.msg-wrap.assistant::before {
  content: '';
  display: block; width: 24px; height: 24px; flex-shrink: 0;
  margin-right: 10px; margin-top: 8px;
  border-radius: 5px;
  background-image: url('logo-sq.jpeg');
  background-size: cover; background-position: center;
}
.msg-wrap.assistant .bubble { max-width: 78%; }
#messages { flex: 1; overflow-y: auto; padding: 28px 0 12px; scroll-behavior: smooth; }
.msg-wrap {
  display: flex; padding: 8px 20px;
  max-width: var(--dp-spacing-max); margin: 0 auto; width: 100%;
}
.msg-wrap.user { justify-content: flex-end; }
.bubble {
  max-width: 72%; padding: 12px 16px; border-radius: var(--dp-radius-panel);
  font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}
.msg-wrap.user .bubble {
  background: var(--dp-color-hairline);
  color: var(--dp-color-bright);
  border-radius: var(--dp-radius-pill) var(--dp-radius-pill) var(--dp-radius-panel) var(--dp-radius-pill);
}
.msg-wrap.assistant .bubble {
  background: var(--dp-color-panel);
  border: var(--dp-border-hairline) solid var(--dp-color-hairline);
  color: var(--dp-color-read);
  max-width: 82%;
}
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--dp-color-live); animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .2; } 40% { opacity: 1; } }

/* Welcome */
.welcome {
  position: absolute; inset: 0 0 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; pointer-events: none;
  padding: 0 var(--dp-spacing-gutter);
}
.welcome > * { pointer-events: auto; }
.welcome h1 {
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 400; letter-spacing: -0.02em; line-height: 1.05;
  color: var(--dp-color-bright); margin-bottom: 14px;
}
.grad {
  background: none; color: var(--dp-color-bright);
  -webkit-text-fill-color: currentColor;
}
/* Team identity langsung di bawah sapaan */
.welcome .team-line { margin-top: 6px; }

/* Composer */
#composer {
  padding: 12px 20px 6px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  max-width: 840px; margin: 0 auto; width: 100%;
  flex-shrink: 0;
}
.composer-row {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--dp-color-panel);
  border: var(--dp-border-hairline) solid var(--dp-color-hairline-2);
  border-radius: 999px;                 /* oval penuh — melengkung di kedua sisi */
  padding: 7px 8px 7px 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
  transition: border-color var(--dp-motion-duration) var(--dp-motion-ease),
              box-shadow var(--dp-motion-duration) var(--dp-motion-ease);
}
.composer-row:focus-within {
  border-color: var(--dp-color-dim);
  box-shadow: 0 4px 22px rgba(0, 0, 0, .35);
}
/* tombol ikon: borderless, hanya ikon — tidak menambah lebar berlebih */
.attach-btn {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: transparent; border: none;
  color: var(--dp-color-read); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dp-motion-duration) var(--dp-motion-ease),
              color var(--dp-motion-duration) var(--dp-motion-ease);
}
.attach-btn:hover { background: var(--dp-color-hairline); color: var(--dp-color-bright); }
/* tombol kirim: solid, selalu terlihat */
#btn-send {
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: var(--dp-color-bright); color: var(--dp-color-inverse-ink);
  cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: opacity var(--dp-motion-duration) var(--dp-motion-ease),
              transform var(--dp-motion-duration) var(--dp-motion-ease);
}
#btn-send:hover { opacity: .85; transform: scale(1.05); }
#btn-send:active { transform: scale(.94); }
#btn-send:disabled { opacity: .3; cursor: default; transform: none; }
/* textarea & tombol hidup DI DALAM satu kapsul */
#input {
  flex: 1; resize: none; max-height: 160px; min-width: 0;
  background: transparent; color: var(--dp-color-bright);
  border: none;
  padding: 9px 4px; font-size: 14.5px; font-family: var(--dp-typography-face); line-height: 1.5;
  outline: none;
}
#input::placeholder { color: var(--dp-color-meta); }
.mic-btn.listening {
  border-color: var(--dp-color-live);
  color: var(--dp-color-live);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(58, 167, 232, .35); }
  50% { box-shadow: 0 0 0 7px rgba(58, 167, 232, 0); }
}

/* Kamera */
.camera-card { max-width: 640px; }
#cam-video {
  width: 100%; border-radius: var(--dp-radius-panel);
  background: #000; aspect-ratio: 4/3; object-fit: cover;
}
.cam-actions {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
}
.attach-menu {
  position: fixed; z-index: 60;
  background: var(--dp-color-panel); border: var(--dp-border-hairline) solid var(--dp-color-hairline-2);
  border-radius: var(--dp-radius-panel); padding: 6px; min-width: 210px;
  box-shadow: 0 8px 30px rgba(0,0,0,.6);
}
.attach-menu button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--dp-color-read);
  padding: 10px 12px; border-radius: var(--dp-radius-panel);
  font-size: 13.5px; cursor: pointer; font-family: var(--dp-typography-face);
  transition: background var(--dp-motion-duration) var(--dp-motion-ease),
              color var(--dp-motion-duration) var(--dp-motion-ease);
}
.attach-menu button:hover { background: var(--dp-color-hairline); color: var(--dp-color-bright); }
.attach-preview { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 4px 10px; }
.attach-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--dp-color-panel); border: var(--dp-border-hairline) solid var(--dp-color-hairline-2);
  border-radius: var(--dp-radius-pill); padding: 6px 12px;
  font-size: 12.5px; max-width: 220px; color: var(--dp-color-read);
  font-family: var(--dp-typography-mono);
}
.attach-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip .rm { background: none; border: none; color: var(--dp-color-meta); cursor: pointer; padding: 0 2px; }
.attach-chip .rm:hover { color: var(--dp-color-bright); }
.attach-chip.uploading { opacity: .55; }

/* ============ MODALS ============ */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--dp-color-panel); border: var(--dp-border-hairline) solid var(--dp-color-hairline-2);
  border-radius: var(--dp-radius-panel); padding: 30px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-head h2 { color: var(--dp-color-bright); font-weight: 400; font-size: 20px; }

.key-form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 22px; }
.field-row { display: flex; gap: 14px; }
.field-row label { flex: 1; }
.key-form label, #form-auth label {
  display: flex; flex-direction: column; gap: 7px;
  font-size: 12px; color: var(--dp-color-meta);
  font-family: var(--dp-typography-mono);
}
input, select {
  background: var(--dp-color-ground); color: var(--dp-color-bright);
  border: var(--dp-border-hairline) solid var(--dp-color-hairline-2);
  border-radius: var(--dp-radius-panel);
  padding: 11px 14px; font-size: 14px; font-family: var(--dp-typography-face); outline: none;
  transition: border-color var(--dp-motion-duration) var(--dp-motion-ease);
}
input:focus, select:focus { border-color: var(--dp-color-dim); }
.btn-primary {
  padding: 11px; border: none; border-radius: var(--dp-radius-pill); cursor: pointer;
  background: var(--dp-color-bright); color: var(--dp-color-inverse-ink);
  font-size: 14px; font-weight: 500; font-family: var(--dp-typography-face);
  transition: opacity var(--dp-motion-duration) var(--dp-motion-ease);
}
.btn-primary:hover { opacity: .85; }
.note { font-size: 11.5px; color: var(--dp-color-meta); font-family: var(--dp-typography-mono); }

#keys-list .key-item {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; border: var(--dp-border-hairline) solid var(--dp-color-hairline);
  border-radius: var(--dp-radius-panel);
  margin-bottom: 8px; background: var(--dp-color-ground);
}
.key-item .ki-info { flex: 1; min-width: 0; }
.key-item .ki-provider { font-weight: 400; font-size: 14px; color: var(--dp-color-bright); }
.key-item .ki-meta {
  font-size: 11.5px; color: var(--dp-color-meta); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--dp-typography-mono);
}
.key-item .ki-badge {
  font-size: 10px; padding: 3px 9px; border-radius: var(--dp-radius-pill);
  background: transparent; border: var(--dp-border-hairline) solid var(--dp-color-live);
  color: var(--dp-color-live); font-family: var(--dp-typography-mono);
}
.key-item .ki-badge.off {
  border-color: var(--dp-color-hairline-2); color: var(--dp-color-meta);
}
.key-item button { background: none; border: none; color: var(--dp-color-meta); cursor: pointer; padding: 6px; }
.key-item button:hover { color: var(--dp-color-bright); }
.key-item button.del:hover { color: var(--dp-color-bright); }

/* Auth */
.auth-card { max-width: 400px; text-align: center; }
.auth-card .welcome-logo { margin: 0 auto 16px; width: 52px; height: 52px; font-size: 24px; }
.auth-title { margin-bottom: 20px; font-weight: 400; color: var(--dp-color-bright); letter-spacing: -.01em; }
.tabs { display: flex; background: var(--dp-color-ground); border-radius: var(--dp-radius-pill); padding: 4px; margin-bottom: 22px; border: var(--dp-border-hairline) solid var(--dp-color-hairline); }
.tab {
  flex: 1; padding: 9px; border: none; border-radius: var(--dp-radius-pill);
  background: none; color: var(--dp-color-meta); font-size: 13.5px; cursor: pointer;
  font-family: var(--dp-typography-face);
  transition: color var(--dp-motion-duration) var(--dp-motion-ease),
              background var(--dp-motion-duration) var(--dp-motion-ease);
}
.tab.active { background: var(--dp-color-hairline); color: var(--dp-color-bright); }
#form-auth { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-error {
  background: transparent; color: var(--dp-color-read);
  border: var(--dp-border-hairline) solid var(--dp-color-hairline-2);
  padding: 10px 12px; border-radius: var(--dp-radius-panel); font-size: 13px;
}

/* Toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--dp-color-panel); border: var(--dp-border-hairline) solid var(--dp-color-hairline-2);
  padding: 11px 20px; border-radius: var(--dp-radius-pill); font-size: 13.5px;
  color: var(--dp-color-bright);
  box-shadow: 0 8px 30px rgba(0,0,0,.6); z-index: 99;
}
.toast.err { border-color: var(--dp-color-dim); color: var(--dp-color-read); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--dp-color-hairline-2); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* Team identity */
.team-line {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--dp-color-meta);
  font-family: var(--dp-typography-mono);
  margin-bottom: 24px;
}
.team-line strong { color: var(--dp-color-read); font-weight: 500; }
.team-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--dp-color-live); flex-shrink: 0;
}
.team-info { padding: 6px 4px 0; }
.team-name {
  font-family: var(--dp-typography-mono);
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--dp-color-meta);
}
.team-sub { font-size: 12.5px; color: var(--dp-color-read); padding-top: 2px; }

/* Model select optgroup styling */
#model-select optgroup {
  font-family: var(--dp-typography-mono);
  font-size: 11px; color: var(--dp-color-meta);
  text-transform: uppercase; letter-spacing: .5px;
}
#model-select option { font-size: 13.5px; padding: 6px; }

/* Admin dashboard */
.admin-card { max-width: 640px; }
.adm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }
.stat {
  background: var(--dp-color-ground); border: var(--dp-border-hairline) solid var(--dp-color-hairline);
  border-radius: var(--dp-radius-panel); padding: 14px; text-align: center;
}
.stat-v { font-size: 22px; color: var(--dp-color-bright); font-weight: 400; }
.stat-l {
  font-family: var(--dp-typography-mono); font-size: 10.5px;
  color: var(--dp-color-meta); text-transform: uppercase; letter-spacing: .8px; margin-top: 4px;
}
.adm-row { display: flex; gap: 10px; margin-bottom: 8px; }
.adm-blocked {
  max-height: 180px; overflow-y: auto;
  border: var(--dp-border-hairline) solid var(--dp-color-hairline);
  border-radius: var(--dp-radius-panel); padding: 10px; margin-bottom: 8px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px;
}
.adm-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--dp-color-read); cursor: pointer; }
.adm-check input { width: 15px; height: 15px; accent-color: var(--dp-brand-blue, #1f8fd6); }
.adm-check em { color: var(--dp-color-meta); font-style: normal; font-size: 11px; }
.adm-user {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: var(--dp-border-hairline) solid var(--dp-color-hairline);
  border-radius: var(--dp-radius-panel); margin-bottom: 6px;
}
.adm-user .au-info { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.adm-user .au-btn { width: auto; padding: 7px 14px; margin: 0; font-size: 12px; }
@media (max-width: 720px) {
  .adm-stats { grid-template-columns: repeat(2, 1fr); }
  .adm-blocked { grid-template-columns: 1fr; }
  .adm-row { flex-direction: column; }
  .adm-row .btn-primary { width: 100% !important; }
  .adm-user { flex-direction: column; align-items: stretch; }
  .au-actions { display: flex; gap: 6px; }
  .au-actions .au-btn { flex: 1; text-align: center; }
}
.adm-user.blocked { opacity: .55; }
.au-actions { display: flex; gap: 6px; }
.au-actions .au-btn { width: auto; padding: 7px 12px; margin: 0; font-size: 12px; white-space: nowrap; }

/* User detail */
.ud-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.ud-avatar { width: 48px; height: 48px; border-radius: var(--dp-radius-panel); object-fit: cover; }
.ud-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.ud-row {
  padding: 9px 12px; border: var(--dp-border-hairline) solid var(--dp-color-hairline);
  border-radius: var(--dp-radius-panel); margin-bottom: 6px; font-size: 13px; color: var(--dp-color-read);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 720px) { .ud-stats { grid-template-columns: repeat(2, 1fr); } }

/* AI global status */
.adm-ai-status {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border: var(--dp-border-hairline) solid var(--dp-color-hairline);
  border-radius: var(--dp-radius-panel); background: var(--dp-color-ground);
  margin-bottom: 4px; font-size: 13px;
}
.ai-ok, .ai-off {
  font-family: var(--dp-typography-mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .8px; padding: 3px 10px; border-radius: var(--dp-radius-pill);
}
.ai-ok { color: var(--dp-color-live); border: var(--dp-border-hairline) solid var(--dp-color-live); }
.ai-off { color: var(--dp-color-meta); border: var(--dp-border-hairline) solid var(--dp-color-hairline-2); }

/* Usage bars */
.adm-usage { margin-bottom: 6px; }
.usage-bars { display: flex; gap: 8px; align-items: flex-end; padding: 10px 4px 0; }
.usage-day { flex: 1; text-align: center; }
.usage-bar-wrap { height: 70px; display: flex; align-items: flex-end; background: var(--dp-color-ground); border-radius: 4px; overflow: hidden; }
.usage-bar { width: 100%; background: var(--dp-brand-blue, #1f8fd6); min-height: 2px; border-radius: 3px 3px 0 0; transition: height var(--dp-motion-duration) var(--dp-motion-ease); }
.usage-num { font-family: var(--dp-typography-mono); font-size: 10.5px; color: var(--dp-color-bright); margin-top: 5px; }
.usage-date { font-family: var(--dp-typography-mono); font-size: 9.5px; color: var(--dp-color-meta); }
.usage-summary {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--dp-color-meta);
  padding: 10px 4px; border-top: var(--dp-border-hairline) solid var(--dp-color-hairline); margin-top: 10px;
}
.usage-summary strong { color: var(--dp-color-bright); font-weight: 500; }

/* System info */
.adm-sysinfo { margin-bottom: 6px; }
.sys-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 4px; border-bottom: var(--dp-border-hairline) solid var(--dp-color-hairline);
  font-size: 12.5px; color: var(--dp-color-meta);
}
.sys-row:last-child { border-bottom: none; }
.sys-row strong { color: var(--dp-color-read); font-weight: 500; font-family: var(--dp-typography-mono); font-size: 12px; text-align: right; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1180px) {
  :root { --dp-spacing-gutter: 32px; }
}
@media (max-width: 900px) {
  .field-row { flex-direction: column; }
  .bubble { max-width: 84% !important; }
  .msg-wrap.assistant .bubble { max-width: 90% !important; }
  .welcome h1 { font-size: clamp(28px, 7vw, 40px); }
}
@media (max-width: 720px) {
  :root { --dp-spacing-gutter: 16px; }

  /* Sidebar drawer */
  #sidebar {
    position: fixed; z-index: 40; height: 100dvh;
    margin-left: -272px;
    transition: margin var(--dp-motion-duration) var(--dp-motion-ease);
    box-shadow: 0 0 80px rgba(0,0,0,.8);
  }
  #sidebar.mobile-open { margin-left: 0; }
  #sb-backdrop {
    position: fixed; inset: 0; z-index: 39;
    background: rgba(0,0,0,.6); border: none; padding: 0; cursor: pointer;
  }

  /* Topbar: dua baris agar tidak sesak */
  #topbar {
    flex-wrap: wrap; padding: 8px 12px; gap: 8px;
    position: sticky; top: 0; z-index: 10;
  }
  #btn-menu { order: 0; }
  #ai-status { order: 1; flex: 1; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #btn-fast { order: 2; padding: 7px 12px; }
  #model-select { order: 3; flex: 1 1 100%; max-width: none; font-size: 12px; }

  /* Messages */
  #messages { padding-top: 14px; }
  .msg-wrap { padding: 5px 12px; }
  .bubble { max-width: 88% !important; font-size: 14px; padding: 10px 13px; }
  .msg-wrap.assistant .bubble { max-width: 92% !important; }
  .msg-wrap.assistant::before { width: 20px; height: 20px; margin-right: 8px; margin-top: 5px; }

  /* Composer: satu kapsul, textarea mengembang, tombol pas */
  #composer { padding: 8px 10px 4px; }
  .composer-row { gap: 3px; padding: 5px 6px 5px 4px; border-radius: 999px; }
  .attach-btn { width: 36px; height: 36px; }
  #btn-send { width: 36px; height: 36px; }
  #input { font-size: 16px; padding: 8px 3px; } /* 16px = cegah zoom iOS */
  .attach-preview { padding: 0 2px 8px; }
  .attach-chip { max-width: 46vw; }

  /* Welcome: absolute di view-chat (yang relative), tidak menabrak composer */
  .welcome { inset: 0 0 140px; padding: 0 18px; position: absolute; margin-top: 0; }
  .welcome-logo { width: 64px; height: 64px; margin-bottom: 14px; }
  .welcome-logo img { width: 64px; height: 64px; }
  .welcome h1 { font-size: 26px; }
  .team-line { font-size: 11.5px; margin-top: 4px; }

  /* Modals full-bleed */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    max-width: 100%; border-radius: 14px 14px 0 0;
    max-height: 92dvh; padding: 22px 18px;
  }
  .camera-card { max-width: 100%; }
  .cam-actions { flex-wrap: wrap; }

  /* Footer sidebar */
  .team-info { padding: 8px 4px 0; }
}
@media (max-width: 400px) {
  #key-select { font-size: 11.5px; }
}

/* Icon buttons: center inline SVG */
.attach-btn, .icon-btn, #btn-send {
  display: inline-flex; align-items: center; justify-content: center;
}
.attach-btn svg, .icon-btn svg, #btn-send svg { display: block; }
.fast-btn { letter-spacing: .01em; }

/* ============ VIEW LAYOUT (chat & admin) ============ */
#view-chat {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0; position: relative;
}
#view-chat #messages { flex: 1; min-height: 0; }
#view-chat #composer { flex-shrink: 0; }
#view-chat #welcome { position: absolute; }
#view-admin { flex: 1; overflow-y: auto; min-height: 0; }
.adm-page {
  max-width: 1000px; margin: 0 auto; padding: 28px 20px 60px;
}
.adm-page-head { margin-bottom: 24px; }
.adm-page-head h1 {
  font-size: clamp(26px, 4vw, 36px); font-weight: 400; letter-spacing: -.02em;
  color: var(--dp-color-bright); line-height: 1.1;
}
.adm-page-head p { color: var(--dp-color-meta); font-size: 13.5px; margin-top: 6px; }
.adm-page .sb-label { padding-left: 2px; }
@media (max-width: 720px) {
  .adm-page { padding: 18px 14px 50px; }
  #topbar { border-bottom: var(--dp-border-hairline) solid var(--dp-color-hairline); }
}

/* ============ LIMIT METER (admin) ============ */
.adm-limit-meter { margin: 6px 0 10px; }
.meter-row { margin-bottom: 10px; }
.meter-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--dp-color-meta); margin-bottom: 5px;
}
.meter-val { font-family: var(--dp-typography-mono); }
.meter-val.warn { color: #e8b34a; }
.meter {
  height: 7px; background: var(--dp-color-ground);
  border: var(--dp-border-hairline) solid var(--dp-color-hairline);
  border-radius: var(--dp-radius-pill); overflow: hidden;
}
.meter-fill {
  height: 100%; background: var(--dp-brand-blue, #1f8fd6);
  border-radius: var(--dp-radius-pill);
  transition: width var(--dp-motion-duration) var(--dp-motion-ease);
}
.meter-fill.warn { background: #e8b34a; }
.warn-note { color: #e8b34a; margin-top: 4px; }

/* ============ BLOCKED POPUP (user) ============ */
.blocked-popup {
  text-align: center; padding: 22px 16px;
  border: var(--dp-border-hairline) solid #b3566b;
  border-radius: var(--dp-radius-panel);
  background: rgba(179, 86, 107, .07);
}
.bp-icon {
  width: 44px; height: 44px; margin: 0 auto 12px;
  border-radius: 50%; border: 1.5px solid #b3566b; color: #d97e90;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 500;
}
.bp-title { color: var(--dp-color-bright); font-size: 15px; margin-bottom: 6px; }
.blocked-popup p { color: var(--dp-color-read); font-size: 13px; line-height: 1.6; }
.blocked-popup strong { color: var(--dp-color-bright); }

/* ============ COMPOSER ADAPTIF PER DEVICE ============ */
/* HP sangat kecil: ikon makin ringkas, gap minimal */
@media (max-width: 400px) {
  .composer-row { gap: 2px; padding: 4px 5px 4px 3px; }
  .attach-btn { width: 34px; height: 34px; }
  #btn-send { width: 34px; height: 34px; }
  .attach-btn svg { width: 15px; height: 15px; }
  #input { padding: 7px 2px; }
}
/* Tablet / layar menengah: sedikit lebih lega */
@media (min-width: 481px) and (max-width: 1179px) {
  .composer-row { padding: 8px 9px 8px 5px; gap: 7px; }
}
/* Laptop besar: kapsul lebih lega */
@media (min-width: 1180px) {
  .composer-row { padding: 9px 12px 9px 7px; gap: 9px; }
  #input { padding: 10px 8px; font-size: 15px; }
  .attach-btn, #btn-send { width: 40px; height: 40px; }
}
/* Landscape HP (tinggi rendah): max-height textarea diturunkan */
@media (max-height: 500px) {
  #input { max-height: 90px; }
  .welcome { inset: 0 0 120px; }
  .welcome h1 { font-size: 22px !important; }
  .welcome-logo { width: 44px; height: 44px; margin-bottom: 8px !important; }
  .welcome-logo img { width: 44px; height: 44px; }
}

/* ============ ASISTEN PRIBADI ============ */
.assistant-card { max-width: 480px; width: calc(100vw - 32px); max-height: 86vh; overflow-y: auto; }
.assistant-btn.on, .assistant-btn:hover { opacity: 1; }
.asst-pane { margin-top: 12px; }
.asst-form { display: flex; gap: 8px; margin-bottom: 12px; }
.asst-form input, .asst-form select {
  flex: 1; min-width: 0; background: var(--bg-input, rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
  color: var(--dp-color-read, #eee); padding: 9px 10px; font-size: 13.5px; font-family: inherit;
}
.asst-form input::placeholder { color: rgba(255,255,255,.35); }
.asst-form .btn-primary { flex: 0 0 auto; padding: 9px 16px; font-size: 13.5px; }
.asst-form-grid { flex-wrap: wrap; }
.asst-form-grid input[type="text"], .asst-form-grid input[type="number"] { flex: 1 1 45%; }
.asst-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--dp-color-read, #ccc); flex: 1 1 100%; cursor: pointer; }
.asst-list { display: flex; flex-direction: column; gap: 6px; }
.asst-item {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; padding: 9px 12px;
}
.asst-item.done { opacity: .55; }
.asst-info { flex: 1; min-width: 0; }
.asst-info .t { font-size: 13.5px; color: var(--dp-color-bright, #fff); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asst-info .s { font-size: 11.5px; color: var(--dp-color-read, #999); margin-top: 2px; }
.asst-empty { text-align: center; color: var(--dp-color-read, #888); font-size: 12.5px; padding: 18px 0; }
.mini-btn {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12);
  background: transparent; color: var(--dp-color-read, #ccc); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.mini-btn.ok:hover { background: rgba(60,180,110,.18); color: #5ad48a; border-color: #5ad48a; }
.mini-btn.rm:hover { background: rgba(220,80,80,.15); color: #e07070; border-color: #e07070; }
.exp-totals { display: flex; gap: 10px; margin-bottom: 12px; }
.exp-totals .stat { flex: 1; background: rgba(255,255,255,.04); border-radius: 10px; padding: 10px 12px; }
.exp-totals .stat-v { font-size: 17px; }
@media (max-width: 480px) {
  .asst-form { flex-wrap: wrap; }
  .asst-form .btn-primary { flex: 1 1 100%; }
}
