:root {
  --blue: #0a4ea3;
  --blue-d: #073a7d;
  --blue-dd: #062f63;
  --gold: #f5b800;
  --ink: #1f2a44;
  --muted: #6b7686;
  --line: #e6eaf0;
  --card: #ffffff;
  --chip: #eef4fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, var(--blue) 0%, var(--blue-d) 55%, var(--blue-dd) 100%);
  color: #fff;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* NAV */
nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding: .85rem 2rem;
  background: rgba(6, 42, 90, .45);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  line-height: 1;
}

.logo .mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-size: 1.1rem;
}

.logo small {
  display: block;
  font-weight: 600;
  font-size: .66rem;
  opacity: .85;
  letter-spacing: .3px;
}

.nav-menu {
  display: flex;
  gap: 1.5rem;
  font-size: .92rem;
  font-weight: 600;
  opacity: .95;
  flex-wrap: wrap;
}

.nav-menu span {
  cursor: pointer;
  opacity: .85;
}

.nav-menu span:hover {
  opacity: 1;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .8rem;
}

.pill {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 30px;
  padding: .5rem .9rem;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
}

.pill.on {
  background: var(--gold);
  color: #3a2c00;
  border-color: var(--gold);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* LAYOUT */
.wrap {
  display: grid;
  grid-template-columns: 280px 1fr 360px;
  gap: 1.6rem;
  max-width: 1500px;
  margin: 0 auto;
  padding: 1.6rem 2rem 1rem;
}

/* SIDEBAR */
.side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.side-card {
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  padding: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.brand .ava {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3db6e6, #1f7a6b);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}

.brand b {
  font-size: 1.15rem;
}

.brand small {
  opacity: .8;
  font-size: .8rem;
}

.side-label {
  font-size: .68rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: .6;
  margin: .3rem 0 .1rem;
  font-weight: 800;
}

.agent {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  padding: .6rem .8rem;
  margin-top: .5rem;
}

.agent .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9fb4cc;
  flex: none;
  transition: .2s;
}

.agent.online .dot {
  background: #34d27b;
  box-shadow: 0 0 0 3px rgba(52, 210, 123, .2);
}

.agent.busy .dot {
  background: var(--gold);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  50% { opacity: .4; }
}

.agent .nm {
  font-weight: 700;
  font-size: .9rem;
}

.agent .ds {
  opacity: .7;
  font-size: .74rem;
}

.scn {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  color: #fff;
  border-radius: 11px;
  padding: .65rem .8rem;
  margin-top: .5rem;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
}

.scn:hover {
  background: rgba(255, 255, 255, .13);
}

/* CENTER */
.center {
  display: flex;
  flex-direction: column;
}

.hero {
  font-size: 2.7rem;
  font-weight: 800;
  margin: .2rem 0 0;
}

.hero-sub {
  color: var(--gold);
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: .1rem;
}

.hero-desc {
  opacity: .9;
  max-width: 560px;
  margin: .6rem 0 1.1rem;
  line-height: 1.5;
}

.chat-card {
  background: var(--card);
  color: var(--ink);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 380px;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.chat-head .ava {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3db6e6, #1f7a6b);
  display: grid;
  place-items: center;
  color: #fff;
}

.chat-head b {
  font-size: .98rem;
}

.chat-head small {
  color: var(--muted);
  font-size: .78rem;
  display: block;
}

.speak-btn {
  margin-left: auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #f4f7fb;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  transition: .2s;
  flex: none;
}

.speak-btn:hover {
  border-color: var(--blue);
  background: #eef4fb;
}

.speak-btn.on {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d27b;
  display: inline-block;
  margin-left: .3rem;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  max-height: 46vh;
}

.msg {
  max-width: 88%;
  padding: .7rem .9rem;
  border-radius: 14px;
  font-size: .95rem;
  line-height: 1.55;
  white-space: normal;
  word-wrap: break-word;
}

.msg.bot {
  background: var(--chip);
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.msg.user {
  background: var(--blue);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg p {
  margin: .3rem 0;
}

.msg strong {
  font-weight: 700;
}

.msg pre {
  background: #0d1b2e;
  color: #cfe;
  padding: .6rem;
  border-radius: 8px;
  overflow: auto;
  font-size: .8rem;
}

.qris-img {
  max-width: 200px;
  border-radius: 12px;
  border: 2px solid #e6eaf0;
  display: block;
  margin: .4rem 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .45rem;
}

.chip-btn {
  background: #fff;
  border: 1.5px solid var(--blue);
  color: var(--blue);
  border-radius: 20px;
  padding: .35rem .8rem;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
}

.chip-btn:hover {
  background: var(--blue);
  color: #fff;
}

.typing {
  display: inline-flex;
  gap: 3px;
}

.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: pulse 1s infinite;
}

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

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

.input-row {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  padding: .7rem 1.1rem;
  border-top: 1px solid var(--line);
}

#input {
  flex: 1;
  border: 1.5px solid #cdd9ea;
  border-radius: 14px;
  padding: .7rem .9rem;
  font-size: .95rem;
  resize: none;
  font-family: inherit;
  max-height: 120px;
  outline: none;
}

#input:focus {
  border-color: var(--blue);
}

.rbtn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}

#mic {
  background: #eef4fb;
  color: var(--blue);
}

#mic.rec {
  background: #e7352c;
  color: #fff;
  animation: pulse 1s infinite;
}

#send {
  background: var(--blue);
  color: #fff;
}

#send:disabled {
  opacity: .5;
  cursor: default;
}

.attach-row {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  padding: .65rem 1.1rem 1rem;
  font-size: .85rem;
}

.attach-row a {
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
}

.attach-row .safe {
  color: var(--muted);
  background: #f4f7fb;
  border-radius: 10px;
  padding: .4rem .7rem;
  display: flex;
  gap: .4rem;
  align-items: center;
}

/* RIGHT */
.right {
  display: flex;
  flex-direction: column;
}

.assistant {
  position: relative;
  border-radius: 20px;
  min-height: 460px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
}

.assistant img.full-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.assistant .cap {
  position: absolute;
  left: 18px;
  bottom: 18px;
  right: 18px;
  text-align: center;
  opacity: .9;
  font-size: .9rem;
  background: rgba(13, 27, 46, 0.75);
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge {
  position: absolute;
  right: 16px;
  top: 16px;
  background: rgba(13, 27, 46, 0.85);
  border-radius: 30px;
  padding: .45rem .8rem;
  font-size: .82rem;
  font-weight: 700;
  display: flex;
  gap: .45rem;
  align-items: center;
  z-index: 2;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* FEATURES */
.features {
  max-width: 1500px;
  margin: 0 auto;
  padding: .6rem 2rem 2rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, .1);
  margin-top: 1rem;
}

.feat {
  display: flex;
  gap: .7rem;
}

.feat .fi {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .1);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  flex: none;
}

.feat b {
  display: block;
  font-size: .95rem;
}

.feat small {
  opacity: .8;
  font-size: .8rem;
  line-height: 1.4;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #0d1b2e;
  color: #fff;
  padding: .7rem 1.1rem;
  border-radius: 10px;
  font-size: .9rem;
  opacity: 0;
  transition: .3s;
  z-index: 99;
}

.toast.show {
  opacity: 1;
}

/* MODAL KAMERA */
.cam-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.cam-bg.show {
  display: flex;
}

.cam-box {
  background: #0d1b2e;
  border-radius: 20px;
  width: min(360px, 92vw);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

.cam-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1.1rem;
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.cam-head .cam-close {
  margin-left: auto;
  cursor: pointer;
  opacity: .6;
  font-size: 1.2rem;
}

.cam-head .cam-close:hover {
  opacity: 1;
}

.cam-wrap {
  position: relative;
  background: #000;
  aspect-ratio: 4/3;
  overflow: hidden;
}

#camVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cam-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cam-oval {
  width: 160px;
  height: 200px;
  border: 3px solid #34d27b;
  border-radius: 50%;
  animation: camPulse 1.8s ease-in-out infinite;
}

@keyframes camPulse {
  0%, 100% {
    border-color: #34d27b;
    box-shadow: 0 0 0 0 rgba(52, 210, 123, .4);
  }
  50% {
    border-color: #7fffbe;
    box-shadow: 0 0 0 10px rgba(52, 210, 123, 0);
  }
}

.cam-hint {
  margin-top: .8rem;
  color: #fff;
  font-size: .8rem;
  opacity: .9;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}

.cam-scanning {
  position: absolute;
  inset: 0;
  background: rgba(13, 27, 46, .85);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .7rem;
  color: #fff;
}

.cam-scanning.show {
  display: flex;
}

.cam-scanning .spin {
  font-size: 2rem;
  animation: spin 1s linear infinite;
}

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

.cam-foot {
  padding: .8rem 1.1rem;
}

#camCapture {
  width: 100%;
  padding: .75rem;
  background: #34d27b;
  color: #0d1b2e;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: .95rem;
  cursor: pointer;
}

#camCapture:hover {
  background: #28c46d;
}

#camCapture:disabled {
  opacity: .5;
  cursor: default;
}

/* MODAL DOKUMEN */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-bg.show {
  display: flex;
}

.modal {
  background: #fff;
  color: var(--ink);
  border-radius: 18px;
  width: min(440px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.modal-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.modal-head b {
  font-size: 1rem;
  flex: 1;
}

.modal-close {
  cursor: pointer;
  font-size: 1.3rem;
  opacity: .6;
  line-height: 1;
}

.modal-close:hover {
  opacity: 1;
}

.modal-body {
  overflow-y: auto;
  padding: .8rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem .8rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f9fbfd;
}

.doc-item .doc-icon {
  font-size: 1.5rem;
  flex: none;
}

.doc-item .doc-name {
  flex: 1;
  font-size: .9rem;
  font-weight: 600;
  word-break: break-all;
}

.doc-item .doc-size {
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
}

.doc-dl {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .4rem .8rem;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.doc-dl:hover {
  background: var(--blue-d);
}

.modal-empty {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: .9rem;
}

@media(max-width:1100px) {
  .wrap { grid-template-columns: 1fr; }
  .side, .right { order: 2; }
  .features { grid-template-columns: 1fr 1fr; }
}

/* Custom scrollbars for chat interface */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #1b75bc 0%, #104c81 100%);
  color: #ffffff;
  font-family: 'Inter', sans-serif;
}

@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.animate-pulse-slow {
  animation: pulse-slow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.upload-doc-btn {
  background: #fff;
  border: 1.5px solid var(--blue);
  color: var(--blue);
  border-radius: 30px;
  padding: .35rem .85rem;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  transition: all .2s;
  font-style: normal;
}

.upload-doc-btn:hover {
  background: var(--blue);
  color: #fff;
}

