@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #13312B; --muted: #4F5F5A; --line: #D5DEDA; --line2: #E6ECE9;
  --bg: #F3F5F4; --card: #FFFFFF; --green: #157A43; --green-bright: #1FA855; --green-soft: #DDF3E4;
  --amber: #F2B53A; --amber-soft: #FBEFCF; --amber-ink: #6B4B00; --blue-soft: #E3E9F5; --blue-ink: #2C3E66;
  --nav: #13312B; --nav-on: #24493F;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Plus Jakarta Sans', system-ui, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--green); }
h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
h2 { margin: 0 0 8px; font-size: 16px; font-weight: 800; }
h3 { margin: 0; font-size: 15px; font-weight: 800; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.lead { margin: 6px 0 0; font-size: 14px; max-width: 600px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
input, select, textarea { font: inherit; font-size: 14px; color: var(--ink); border: 1px solid #C9D3CE; border-radius: 10px; padding: 10px 12px; background: #fff; width: 100%; }
select { width: auto; min-height: 44px; }
textarea { resize: vertical; }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin: 10px 0 4px; }
:focus-visible { outline: 3px solid var(--green-bright); outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--green); color: #fff; }
.btn-warn { background: var(--amber); color: var(--ink); }
.btn-ghost { background: #fff; color: var(--ink); border-color: #C9D3CE; }
.btn-outline { background: #fff; color: var(--green); border-color: var(--green); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.alert { background: #FDE8E4; color: #8A2A1A; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.ok { background: var(--green-soft); color: #0F5C36; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.empty { color: var(--muted); padding: 16px; font-size: 14px; }
.empty.big { padding: 80px 20px; text-align: center; }

/* Kerangka */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 210px; max-width: 100%; background: var(--nav); color: #fff; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; }
@media (min-width: 900px) { .side { flex: 0 0 220px; } }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand small { display: block; font-size: 12px; color: #B9CCC5; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--green-bright); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; }
.nav-link { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #DCE7E2; text-decoration: none; font-weight: 600; font-size: 14px; }
.nav-link.on { background: var(--nav-on); color: #fff; font-weight: 700; }
.nav-badge { background: var(--amber); color: var(--ink); border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 800; }
.side-foot { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid #2E5A4E; font-size: 13px; color: #B9CCC5; }
.side-foot strong { color: #fff; }
.side-foot a { color: #DCE7E2; }
.content { flex: 999 1 560px; min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.seg { display: flex; gap: 4px; background: #fff; padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.seg button, .seg a { min-height: 38px; padding: 0 14px; border-radius: 9px; border: none; background: transparent; color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.seg .on { background: var(--ink); color: #fff; font-weight: 700; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.pad { padding: 16px 18px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > * { flex: 1 1 220px; }
.two-col { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.col-main { flex: 999 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.col-side { flex: 1 1 300px; display: flex; flex-direction: column; gap: 18px; }

/* Kotak masuk */
.inbox { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.list-panel { flex: 1 1 280px; display: flex; flex-direction: column; overflow: hidden; max-height: calc(100vh - 140px); }
.convo-list { overflow-y: auto; }
.convo { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; padding: 12px 16px; border: none; border-top: 1px solid var(--line2); background: #fff; font: inherit; color: inherit; cursor: pointer; }
.convo.on { background: #EEF7F1; }
.convo-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.convo-prev { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #EEF2F0; color: #3E4E49; }
.st-bot { background: var(--green-soft); color: #0F5C36; font-weight: 700; }
.st-cs { background: var(--amber-soft); color: var(--amber-ink); font-weight: 700; }
.st-held { background: var(--blue-soft); color: var(--blue-ink); font-weight: 700; }
.chat-panel { flex: 999 1 400px; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
#chatWrap { display: flex; flex-direction: column; height: calc(100vh - 140px); min-height: 480px; }
#chatWrap[hidden] { display: none; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--line2); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.chat-name { font-weight: 800; font-size: 16px; }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; background: #EFEAE2; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 75%; padding: 9px 12px; border-radius: 12px; font-size: 14px; box-shadow: 0 1px 0 rgba(0,0,0,.06); overflow-wrap: anywhere; }
.msg-pelanggan { align-self: flex-start; background: #fff; }
.msg-bot, .msg-cs { align-self: flex-end; background: #D9FDD3; }
.who { font-size: 11px; font-weight: 800; color: #3E4E49; margin-bottom: 2px; }
.msg-bot .who { color: var(--green); }
.msg-cs .who { color: var(--blue-ink); }
.when { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.fail { color: #A3311F; font-weight: 700; margin-right: 6px; }
.note { align-self: center; max-width: 90%; background: var(--amber-soft); color: var(--amber-ink); font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 8px; text-align: center; }
.note span { font-weight: 500; margin-left: 4px; }
.composer { padding: 12px; border-top: 1px solid var(--line2); display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.composer textarea { flex: 1 1 240px; width: auto; }
.composer-btns { display: flex; gap: 8px; }
.chat-panel .alert { margin: 8px 12px 0; }
.profile-panel { flex: 1 1 240px; padding: 18px; align-self: flex-start; }
.profile-panel dl { margin: 0 0 6px; }
.profile-panel dt { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 10px; }
.profile-panel dd { margin: 2px 0 0; font-weight: 700; font-size: 14px; }
.profile-panel select { width: 100%; }
.profile-panel .btn { width: 100%; margin-top: 16px; }

/* Basis pengetahuan */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid #C9D3CE; background: #fff; color: var(--ink); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; text-decoration: none; }
.tab.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.entry-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.entry p { margin: 6px 0 0; font-size: 14px; color: #33433E; }
.entry.off { opacity: .55; }
.entry-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.entry-btns form, .gap-btns form { margin: 0; }
.form-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.gap { background: var(--amber-soft); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.gap-q { font-weight: 600; font-size: 14px; }
.gap-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--amber-ink); font-weight: 600; }
.gap-btns { display: flex; gap: 6px; }
.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.dark label { color: #DCE7E2; }
.dark .btn { margin-top: 12px; }
.test-reply { background: #D9FDD3; color: var(--ink); border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: 14px; }
.test-hand { background: var(--amber-soft); color: var(--amber-ink); border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: 14px; }

/* Pengaturan */
.settings { display: flex; flex-direction: column; gap: 16px; max-width: 900px; }
.switch-row, .radio-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line2); margin: 0; color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; }
.radio-row { justify-content: flex-start; }
.switch-row input, .radio-row input { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--green); }

/* Pipeline */
.stats { background: var(--ink); color: #fff; border-radius: 18px; padding: 22px 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px; }
.stats span { font-size: 13px; color: #B9CCC5; font-weight: 600; display: block; }
.stats strong { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; display: block; }
.stats strong.warn { color: var(--amber); }
.stats small { font-size: 12px; color: #B9CCC5; }
.section-title { margin: 4px 0 0; font-size: 17px; }
.board-wrap { overflow-x: auto; padding-bottom: 6px; }
.board { display: flex; gap: 12px; min-width: 1000px; }
.stage { flex: 1 1 0; min-width: 160px; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.stage-head { padding: 12px 14px; display: flex; justify-content: space-between; align-items: baseline; border-bottom: 3px solid #8E9C97; font-size: 14px; }
.stage-head span { font-weight: 800; font-size: 18px; }
.stage-tanya_tanya, .stage-tertarik { border-color: #3B5FA8; }
.stage-ditawari, .stage-ditawari_upsell { border-color: var(--amber); }
.stage-menunggu_bayar { border-color: #C77700; }
.stage-closing, .stage-beli_lagi { border-color: var(--green); }
.stage-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #F7F9F8; flex: 1; }
.person { display: block; background: #fff; border: 1px solid #E1E8E5; border-radius: 10px; padding: 9px 10px; text-decoration: none; color: var(--ink); font-size: 13px; }
.person span { display: block; font-size: 12px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 420px; }
th { text-align: left; color: var(--muted); font-size: 12px; padding: 8px 6px; }
td { padding: 10px 6px; border-top: 1px solid var(--line2); }
.warn-text { color: #8A5A00; font-weight: 600; }
.share { height: 14px; border-radius: 999px; overflow: hidden; background: var(--amber); }
.share div { height: 100%; background: var(--green); }
.share-legend { display: flex; justify-content: space-between; font-size: 13px; margin: 8px 0; }
.g { color: var(--green); } .y { color: #8A5A00; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 28px; width: 100%; max-width: 380px; }
.login-box .brand { padding: 0 0 16px; }
.login-box .btn { width: 100%; margin-top: 16px; }
