:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e3e5ea;
  --text: #1c1f26;
  --muted: #6b7280;
  --primary: #0754a5;
  --primary-soft: #e6eef8;
  --danger: #c0362c;
  --radius: 10px;
  --open: #0754a5;
  --in_progress: #975a16;
  --resolved: #2f855a;
  --closed: #6b7280;
  --urgent: #c0362c;
  --high: #c05621;
  --medium: #5a67d8;
  --low: #6b7280;
  --pending: #c05621;
  --confirmed: #2f855a;
  --declined: #6b7280;
  --cancelled: #6b7280;
  --attended: #0754a5;
  --no_show: #c0362c;
  --changed: #6b7280;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
body > main { flex: 1; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; }
.site-footer { padding: 16px; text-align: center; font-size: 12px; color: var(--muted); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { flex: none; }
.brand-name { font-weight: 700; font-size: 18px; line-height: 1.2; white-space: nowrap; }
.brand-name > span { color: var(--primary); }
.brand-name > .brand-sub { color: var(--muted); font-size: 13px; font-weight: 400; }
.brand-by { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.brand-by-logo { flex: none; border-radius: 50%; }
.topbar nav { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.badge-mode { white-space: nowrap; font-size: 12px; padding: 3px 8px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); }

.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
}
.btn:hover { border-color: #c4c8d0; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--primary); }
.btn:disabled { opacity: .5; cursor: default; }

input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text);
}
textarea { resize: vertical; }
label, .field-label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 28px 24px; text-align: center; }
.login-card h2 { margin: 0 0 4px; }
.login-card label { text-align: left; }
.login-logo { display: block; margin: 0 auto 14px; }
.login-error { min-height: 1.2em; margin: 10px 0; color: var(--danger); }
.login-card .btn-primary { width: 100%; padding: 10px 14px; }
.login-card .link-btn { display: inline-block; margin-top: 12px; }
.copy-link { display: flex; gap: 8px; margin-top: 6px; }
.copy-link input { font-family: ui-monospace, monospace; font-size: 12px; }

/* ---------- Percakapan ---------- */
.msg { max-width: 80%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; line-height: 1.45; }
/* Sudut pandang agent: customer di kiri, AI & agent di kanan. */
.msg.user { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.assistant { align-self: flex-end; background: var(--primary-soft); border-bottom-right-radius: 4px; }

/* ---------- Dashboard ---------- */
.dash { width: 100%; padding: 16px 20px; max-width: 1400px; margin: 0 auto; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tab { padding: 8px 14px; border-radius: 8px; cursor: pointer; border: none; background: transparent; color: var(--muted); }
.tab.active { background: var(--surface); color: var(--text); border: 1px solid var(--border); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { padding: 10px 12px; text-align: left; font: inherit; color: inherit; width: 100%; }
.stat .label { font-size: 12px; color: var(--muted); line-height: 1.3; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: #b9c3e0; }
.stat.alert { border-left-width: 3px; }
.stat.alert .label { color: var(--text); font-weight: 600; }
.stat.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--primary-soft); }
.toolbar { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-bottom: 8px; }
.toolbar .btn { white-space: nowrap; }
.quick-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 5px 12px; border-radius: 99px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: #b9c3e0; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-bottom: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 28px; margin-bottom: 10px; font-size: 13px; }
.result-count { color: var(--muted); margin-right: 4px; }
.result-count strong { color: var(--text); }
.filter-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-soft); color: var(--primary); border-radius: 99px; padding: 3px 4px 3px 10px; }
.filter-chip button { border: none; background: transparent; color: inherit; cursor: pointer; padding: 0 6px; font-size: 12px; line-height: 1.6; border-radius: 99px; }
.filter-chip button:hover { background: rgba(7, 84, 165, .15); }
.link-btn { border: none; background: none; color: var(--primary); cursor: pointer; text-decoration: underline; font-size: 13px; padding: 2px 4px; }
.group-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 6px 2px 0; }
.group-label:first-child { margin-top: 0; }
.back-btn { display: none; }
.btn-danger { color: var(--danger); border-color: #f0c4c0; }
.btn-danger:hover { border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.archived-banner { background: #fff7e6; border: 1px solid #f3d9a4; color: #8a5a00; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; font-size: 14px; }
.danger-zone { border: 1px solid #f0c4c0; border-radius: 8px; padding: 12px; }
.danger-zone .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.confirm-box { margin-top: 10px; background: #fdf0ef; border-radius: 8px; padding: 12px; }
.confirm-box label { display: flex; gap: 8px; align-items: center; color: var(--text); margin: 8px 0; }
.confirm-box input[type=checkbox] { width: auto; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; align-items: start; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { cursor: pointer; padding: 12px 14px; }
.item:hover { border-color: #b9c3e0; }
.item.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.item .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.item .title { font-weight: 600; margin: 4px 0; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; margin-right: 4px; }
.detail h2 { margin: 0 0 4px; font-size: 18px; }
.detail .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.detail section { margin-top: 18px; }
.detail h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.desc { white-space: pre-wrap; background: var(--bg); padding: 10px 12px; border-radius: 8px; }
.note { border-left: 3px solid var(--primary); padding: 6px 10px; margin-bottom: 8px; background: var(--bg); border-radius: 0 8px 8px 0; }
.note .meta { font-size: 12px; color: var(--muted); }
.transcript { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; background: var(--bg); padding: 10px; border-radius: 8px; }
.transcript .msg { max-width: 90%; font-size: 14px; }
.empty { text-align: center; padding: 40px 12px; color: var(--muted); }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; }
.toast-error { display: flex; gap: 12px; align-items: flex-start; background: var(--danger); }
.toast-error button { flex: none; border: none; background: none; color: inherit; cursor: pointer; padding: 0 2px; font-size: 14px; }

/* Desktop: detail tetap terlihat walau daftar di-scroll jauh ke bawah. */
@media (min-width: 901px) {
  .split > .detail { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
}

@media (max-width: 900px) {
  .dash { padding: 12px; overflow-x: clip; }
  .split { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  /* Statistik jadi satu baris yang bisa digeser, supaya tiket langsung terlihat di layar pertama. */
  .stats { display: flex; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: 12px; margin: 0 -12px 10px; padding: 0 12px 4px; }
  .stat { flex: 0 0 auto; width: auto; min-width: 112px; max-width: 150px; scroll-snap-align: start; }
  .stat .n { font-size: 20px; }
  .quick-filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 8px; padding: 0 12px 2px; }
  .toolbar { grid-template-columns: 1fr auto; }
  .toolbar #export-tickets { display: none; }
  /* Detail tampil penuh menggantikan list; panel kosong disembunyikan. */
  .split > .detail { display: none; }
  .show-detail .split > .detail { display: block; }
  .show-detail .split > .list, .show-detail .stats, .show-detail .toolbar, .show-detail .quick-filters,
  .show-detail .filters, .show-detail .active-filters { display: none; }
  .back-btn { display: inline-block; margin-bottom: 12px; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
}

@media (max-width: 600px) {
  .topbar { padding: 10px 12px; }
  .brand-sub, #telegram-link, #enable-notifications { display: none; }
  .brand { gap: 8px; }
  .brand-logo { width: 30px; height: 30px; }
  .brand-name { font-size: 16px; }
  .brand-by { font-size: 11px; }
  .topbar nav { gap: 6px; min-width: 0; }
  #logout { padding: 6px 10px; }
  #agent-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .detail .grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  #agent-name { display: none; }
}

/* ---------- Reservasi, keluhan, SLA, balasan agent ---------- */
.item.overdue { border-left: 3px solid var(--urgent); }
.item .visit { margin: 2px 0 6px; color: var(--text); }
.age { color: var(--muted); }
.age.late { color: var(--urgent); font-weight: 600; }
.age.soon { color: #b26a00; font-weight: 600; }
.age.ok { color: var(--resolved); }
.badge-new { font-size: 12px; font-weight: 600; color: #fff; background: var(--primary); padding: 1px 7px; border-radius: 99px; }
.overdue-banner { background: #fdf0ef; border: 1px solid #f0c4c0; color: var(--danger); padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; font-size: 14px; }
.form-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
label.inline { display: flex; gap: 6px; align-items: center; margin: 0; color: var(--text); }
label.inline input { width: auto; }
.note.reply { border-left-color: #229ed9; }
.note.system { border-left-color: var(--closed); color: var(--muted); font-size: 13px; }
.msg.agent { background: #e7f5fc; border-color: #b3dff3; }
.msg .sender { font-size: 11px; font-weight: 600; color: #1b7fb0; margin-bottom: 2px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); }

/* ---------- Service desk: reservasi, handoff, laporan, template ---------- */
.rsv-panel { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--bg); }
.rsv-panel h3 { display: flex; gap: 8px; align-items: center; }
.rsv-panel .actions, #rsv-form .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
#rsv-form { margin-top: 6px; }
.handoff-banner, .handoff-hint { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; }
.handoff-banner { background: #e7f5fc; border: 1px solid #b3dff3; color: #155e80; font-size: 14px; }
.handoff-hint { background: var(--bg); }
.badge-handoff { font-size: 12px; font-weight: 600; color: #155e80; background: #e7f5fc; padding: 1px 7px; border-radius: 99px; }
#reply-template { margin-bottom: 8px; }
.msg .time { font-size: 10px; opacity: .6; text-align: right; margin-top: 2px; }
.history { line-height: 1.9; }
.report-actions { display: flex; gap: 8px; align-items: center; }

.report-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.report-head h2 { margin: 0; font-size: 18px; }
.report-head select { width: auto; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-bottom: 12px; }
.report-card { margin-bottom: 12px; }
.report-grid .report-card { margin-bottom: 0; }
.report-card h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 12px; }
.bar-list { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; }
.bar { display: block; height: 100%; min-width: 2px; background: var(--primary); border-radius: 0 4px 4px 0; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.col-chart { display: flex; align-items: flex-end; gap: 2px; height: 140px; border-bottom: 1px solid var(--border); }
.col-slot { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.col-slot:hover .col { filter: brightness(1.2); }
.col { display: block; width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; }
.col-axis { display: flex; justify-content: space-between; margin-top: 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.table td { font-variant-numeric: tabular-nums; }
.tooltip { position: fixed; z-index: 10; pointer-events: none; background: var(--text); color: #fff; font-size: 12px; padding: 5px 8px; border-radius: 6px; }
code { background: var(--bg); padding: 1px 4px; border-radius: 4px; font-size: 12px; }
#template-list > .btn { align-self: flex-start; }

/* ---------- Navigasi aplikasi, list view, halaman record ---------- */
.app-nav { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 20px; }
.app-nav .tabs { max-width: 1400px; margin: 0 auto; gap: 0; overflow-x: auto; }
.app-nav .tab { position: relative; padding: 11px 14px; border-radius: 0; border: none; background: none; color: var(--text); white-space: nowrap; box-shadow: inset 0 -3px 0 transparent; }
.app-nav .tab:hover { background: var(--bg); }
.app-nav .tab.active { border: none; background: var(--primary-soft); color: var(--primary); font-weight: 600; box-shadow: inset 0 -3px 0 var(--primary); }

.page-head, .record-head { margin-bottom: 12px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; }
.object-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.object-icon { flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; background: var(--primary); font-size: 18px; }
.object-label { font-size: 12px; color: var(--muted); }
.detail h2.object-name, h1.object-name { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.view-select { width: auto; min-width: 140px; max-width: 100%; padding: 2px 28px 2px 4px; margin-left: -4px; border-color: transparent; background: transparent; font-size: 18px; font-weight: 700; cursor: pointer; }
.view-select:hover { border-color: var(--border); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 320px; justify-content: flex-end; }
.page-actions input { flex: 1 1 200px; max-width: 360px; }
.page-actions .btn { white-space: nowrap; }

.list-page .list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; gap: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-more { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; }
.data-table th { padding: 8px 12px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); background: #f3f6fb; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th button { border: none; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.data-table th button:hover { color: var(--text); text-decoration: underline; }
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #f7f9fc; }
.data-table tbody tr:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.data-table tr.item.selected { border: none; box-shadow: none; background: var(--primary-soft); }
.data-table tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--urgent); }
.data-table tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.data-table .pill { white-space: nowrap; margin-bottom: 2px; }
.row-title { font-weight: 600; }
.row-preview { max-width: 420px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.primary-cell { min-width: 200px; }
.data-table td:first-child { white-space: nowrap; }

.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; align-items: start; }
.home-card { min-width: 0; padding: 0; overflow: hidden; }
.home-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.home-card-head h2 { margin: 0; font-size: 15px; }
#home-daily, #home-status { padding: 6px 14px 14px; }
.home-card .empty { padding: 28px 12px; }
.home-more { padding: 8px 12px; border-top: 1px solid var(--border); }
#tab-home .stat .n { color: var(--text); }
#tab-home .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.record-page { display: none; }
.show-detail .record-page { display: block; }
.show-detail .list-page { display: none; }
.record-view .back-btn { display: inline-block; margin-bottom: 12px; }
.record-page > .card { padding: 14px 16px; }
.record-page .path { margin: 0 0 12px; }
.record-page .rsv-panel { margin: 0 0 12px; }
.highlights { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 18px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.highlights dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.highlights dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.record-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; align-items: start; }
/* Console tiket: pelanggan di kiri, tahap dan detail di tengah, timeline dan kotak balas di kanan. */
.console { display: grid; grid-template-columns: 250px minmax(0, 1fr) 400px; gap: 12px; align-items: start; }
.console-center { min-width: 0; }
.console-left, .console .record-side, .console-center .record-main { padding: 14px 16px; }
.side-facts { margin: 0; font-size: 14px; }
.side-facts > div { padding: 5px 0; }
.side-facts dt { font-size: 12px; color: var(--muted); }
.side-facts dd { margin: 0; overflow-wrap: anywhere; }
.side-facts .link-btn { padding: 0; text-align: left; }
.console .record-side { display: flex; flex-direction: column; }
.console #ticket-chat { flex: 1 1 auto; min-height: 120px; display: flex; flex-direction: column; }
.console #ticket-chat .transcript { flex: 1 1 auto; min-height: 0; max-height: none; }
.console #ticket-chat[data-show="chat"] [data-feed]:not([data-feed="chat"]),
.console #ticket-chat[data-show="note"] [data-feed]:not([data-feed="note"]),
.console #ticket-chat[data-show="log"] [data-feed]:not([data-feed="log"]) { display: none; }
.feed-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.detail .feed-head h3 { margin: 0; }
.feed-filters { display: flex; gap: 4px; }
.feed-filter { padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; cursor: pointer; }
.feed-filter:hover { color: var(--text); }
.feed-filter.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.feed-note { margin: 0; font-size: 13px; white-space: pre-wrap; flex: none; }
.feed-note.system { border-left-color: var(--border); color: var(--muted); }
#ticket-detail .back-btn { padding: 4px 10px; font-size: 13px; margin-bottom: 8px; }
#ticket-detail .record-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding: 10px 56px 10px 16px; }
#ticket-detail .highlights { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0; padding: 0; border: 0; }
#ticket-detail .highlights dd .pill { margin-right: 4px; }
.console .handoff-hint, .console .handoff-banner { flex: none; flex-wrap: nowrap; gap: 8px; margin-bottom: 8px; padding: 6px 10px; }
.console .handoff-hint .btn, .console .handoff-banner .btn { flex: none; padding: 4px 8px; font-size: 13px; }
.composer { flex: none; margin-top: 10px; }
.composer #reply-template { padding-top: 5px; padding-bottom: 5px; margin-bottom: 6px; }
.composer .form-actions { flex-wrap: nowrap; align-items: center; gap: 8px; }
.composer .form-actions .btn { flex: none; padding: 6px 12px; }
.composer .form-actions .inline { font-size: 12px; line-height: 1.25; }
.composer .record-tabs { margin: 0 0 8px; }
.composer textarea { min-height: 64px; }
.composer .form-actions { margin-top: 8px; }
@media (min-width: 1200px) {
  .console { height: max(460px, calc(100vh - var(--console-top, 220px) - 12px)); align-items: stretch; }
  .console-left, .console-center, .console .record-side { height: 100%; min-height: 0; overflow-y: auto; }
  .console #ticket-chat { min-height: 0; overflow: hidden; }
  .console #ticket-chat .transcript { overflow-y: auto; }
}
/* Laptop kecil: kotak balas tetap masuk layar tanpa scroll halaman. */
@media (min-width: 1200px) and (max-height: 720px) {
  .console { height: max(420px, calc(100vh - var(--console-top, 220px) - 12px)); }
  .composer textarea { height: 52px; min-height: 52px; }
}
@media (min-width: 901px) and (max-width: 1199px) {
  .console { grid-template-columns: minmax(0, 1fr) 380px; }
  .console-center { grid-column: 1; grid-row: 1; }
  .console-left { grid-column: 1; grid-row: 2; }
  .console .record-side { grid-column: 2; grid-row: 1 / span 2; height: max(460px, calc(100vh - var(--console-top, 220px) - 12px)); max-height: none; }
  .console #ticket-chat { min-height: 0; overflow: hidden; }
  .console #ticket-chat .transcript { overflow-y: auto; }
}
.record-tabs { display: flex; gap: 2px; margin: -4px 0 14px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.record-tab { padding: 8px 12px; border: none; background: none; color: var(--muted); cursor: pointer; white-space: nowrap; font-size: 14px; box-shadow: inset 0 -2px 0 transparent; }
.record-tab:hover { color: var(--text); }
.record-tab.active { color: var(--primary); font-weight: 600; box-shadow: inset 0 -2px 0 var(--primary); }
.detail section.first-section { margin-top: 0; }
.record-side h3:first-of-type { margin-top: 0; }
.detail .side-subhead { margin-top: 16px; }
.record-side .transcript { max-height: 420px; }
.reply-template, #reply-template { margin-bottom: 8px; }
.detail .grid .grid-wide { grid-column: 1 / -1; }
.readonly-field { padding: 8px 0; font-weight: 500; overflow-wrap: anywhere; }
.readonly-field .muted { font-weight: 400; font-size: 13px; }
@media (min-width: 901px) {
  .record-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
}

@media (max-width: 900px) {
  .app-nav { padding: 0 4px; }
  .record-grid { grid-template-columns: 1fr; }
  /* Di HP urutannya tahap, percakapan, detail, lalu data pelanggan. */
  .console { display: flex; flex-direction: column; align-items: stretch; }
  .console-center { display: contents; }
  .console-center .path, .console-center .rsv-panel { order: -2; }
  .console .record-side { order: -1; }
  .console-center .record-main { order: 0; }
  .console-left { order: 1; }
  .console #ticket-chat .transcript { max-height: 420px; }
  /* Di HP, percakapan tampil lebih dulu daripada detail. */
  .record-side { order: -1; }
  .page-actions { flex-basis: 100%; }
  .page-actions input { max-width: none; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  /* Tabel jadi kartu: tiap baris menampilkan label kolomnya. */
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tbody tr { padding: 8px 12px; border-bottom: 1px solid var(--border); }
  .data-table tbody tr:last-child { border-bottom: none; }
  .data-table td { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; padding: 3px 0; border: none; font-size: 13px; }
  .data-table td::before { content: attr(data-label); flex: none; width: 92px; color: var(--muted); font-size: 12px; }
  .page-actions #export-tickets { display: none; }
  .data-table td.primary-cell { display: block; font-size: 14px; }
  .data-table td.primary-cell::before { display: none; }
  .data-table td > * { min-width: 0; }
  .row-preview { max-width: 100%; }
  .data-table tr.overdue td:first-child, .data-table tr.unread td:first-child { box-shadow: none; }
  .data-table tr.overdue { box-shadow: inset 3px 0 0 var(--urgent); }
  .data-table tr.unread { box-shadow: inset 3px 0 0 var(--primary); }
}

/* ---------- Detail tiket, menu tindakan, daftar tamu ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 18px; margin: 0 0 12px; }
.facts dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.facts dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.facts .readonly-field, .facts dd .muted { font-weight: 400; }
.record-head { position: relative; }
.record-actions { position: absolute; top: 12px; right: 12px; z-index: 5; }
.more-menu summary { list-style: none; cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 18px; font-weight: 700; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu summary:hover { background: var(--bg); }
.more-panel { position: absolute; right: 0; top: 42px; width: 320px; max-width: calc(100vw - 48px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0, 0, 0, .16); padding: 10px; }
.guest-list { display: flex; flex-direction: column; gap: 8px; }
.guest { display: flex; gap: 14px; align-items: center; }
.guest-done { opacity: .65; }
.guest-time { flex: none; width: 64px; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.guest-main { flex: 1; min-width: 0; }
.guest-note { margin-top: 4px; font-weight: 600; color: var(--danger); overflow-wrap: anywhere; }
.guest-actions { flex: none; display: flex; gap: 8px; align-items: center; }
@media (max-width: 600px) {
  .guest { flex-wrap: wrap; }
  .guest-actions { width: 100%; }
  .guest-actions .btn { flex: 1; }
}

/* ---------- Pemilih tanggal & jam ---------- */
.picker-field { position: relative; }
.picker-field input { padding-right: 36px; }
.picker-btn { position: absolute; top: 1px; right: 1px; bottom: 1px; width: 34px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 0 7px 7px 0; background: transparent; color: var(--muted); cursor: pointer; }
.picker-btn:hover { background: var(--bg); color: var(--primary); }
.picker { position: fixed; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0, 0, 0, .16); }
.picker-date { width: 288px; max-width: calc(100vw - 16px); padding: 10px; }
.picker-time { width: 120px; }
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cal-title { flex: 1; font-weight: 600; font-size: 14px; text-align: center; }
.cal-year { width: auto; padding: 3px 4px; font-size: 13px; }
.cal-nav { width: 30px; height: 30px; flex: none; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 16px; line-height: 1; }
.cal-nav:hover { background: var(--bg); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { padding: 4px 0; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.cal-day { aspect-ratio: 1; min-height: 34px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--text); cursor: pointer; font-size: 13px; }
.cal-day:hover { background: var(--primary-soft); }
.cal-day.today { border-color: var(--primary); font-weight: 600; }
.cal-day.selected { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.cal-day[aria-disabled="true"], .time-option[aria-disabled="true"] { opacity: .35; cursor: not-allowed; background: none; text-decoration: line-through; }
.cal-foot { margin-top: 6px; text-align: center; }
.time-list { max-height: 240px; overflow-y: auto; padding: 4px; position: relative; }
.time-option { display: block; width: 100%; padding: 7px 10px; border: none; border-radius: 6px; background: none; color: var(--text); cursor: pointer; font-size: 14px; font-variant-numeric: tabular-nums; text-align: center; }
.time-option:hover { background: var(--primary-soft); }
.time-option.selected { background: var(--primary); color: #fff; font-weight: 600; }

/* ---------- Path tiket ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.path { margin-top: 14px; border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.path-steps { display: flex; list-style: none; margin: 0; padding: 0; }
.path-step { flex: 1 1 0; min-width: 0; margin-left: -6px; }
.path-step:first-child { margin-left: 0; }
.path-step button {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 40px;
  padding: 6px 16px 6px 20px; border: none; cursor: pointer; font-size: 13px; line-height: 1.2; text-align: center;
  background: var(--border); color: var(--text);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}
.path-step:first-child button { padding-left: 12px; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 8px 0 0 8px; }
.path-step:last-child button { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%); border-radius: 0 8px 8px 0; padding-right: 12px; }
.path-step button:hover { filter: brightness(.95); }
.path-step button:focus-visible { outline: none; text-decoration: underline; text-decoration-thickness: 2px; filter: brightness(.9); }
.path-step.done button { background: var(--resolved); color: #fff; }
.path-step.current button { background: var(--primary); color: #fff; font-weight: 600; }
.path-step.current.negative button { background: var(--danger); }
.path-step.previewing button { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.path-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.path-note { margin: 10px 0 0; }
.path-blocked { margin: 8px 0 0; color: var(--danger); }
.path-guide { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.path-guide summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.path-goal { margin: 8px 0 10px; font-size: 14px; }
.path-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.detail .path-grid h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.path-fields { margin: 0; font-size: 13px; }
.path-fields > div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.path-fields dt { color: var(--muted); }
.path-fields dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.path-fields dd .muted { font-weight: 400; }
.path-checks, .path-tips { margin: 0 0 8px; padding: 0; font-size: 13px; line-height: 1.4; }
.path-checks { list-style: none; }
.path-checks li { display: flex; gap: 6px; padding: 2px 0; }
.path-check-mark { flex: none; width: 16px; color: var(--muted); font-weight: 700; }
.path-checks li.done .path-check-mark { color: var(--resolved); }
.path-checks .link-btn, .path-blocked .link-btn, .path-fields .link-btn { padding: 0 2px; }
.path-tips { padding-left: 16px; color: var(--muted); }
.path-tips li { margin-bottom: 3px; }

@media (max-width: 600px) {
  .path { padding: 10px; }
  .path-step button { font-size: 12px; padding: 4px 12px 4px 16px; min-height: 44px; }
}

/* ---------- Inbox customer ---------- */
.toolbar-single { grid-template-columns: 1fr; }
.tab-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 99px; background: var(--urgent); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.inbox-item .top .title { margin: 0; color: var(--text); font-size: 15px; }
.inbox-item .preview { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 6px; }
.inbox-item.unread { border-left: 3px solid var(--primary); }
.inbox-item.unread .preview { color: var(--text); font-weight: 500; }
.inbox-item .meta { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.conv-sep { align-self: center; font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 2px 10px; margin: 6px 0; }
.msg.auto { background: transparent; border: 1px dashed var(--border); color: var(--muted); font-size: 13px; }
.history-row { margin-bottom: 4px; }
.manual-ticket { margin-top: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.template-hint { margin: -4px 0 8px; }
#c-reply-template { margin-bottom: 8px; }

/* Tab kerja: tiket yang sedang dibuka */
.work-tabs { display: flex; gap: 2px; margin-bottom: 10px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.work-tab { flex: none; display: flex; align-items: center; max-width: 240px; background: none; border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0; font-size: 13px; color: var(--muted); }
.work-tab:hover { background: var(--surface); }
.work-tab.active { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: inset 0 2px 0 var(--primary); }
.work-tab-list { padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.work-tab-open { min-width: 0; display: flex; gap: 4px; align-items: baseline; padding: 7px 2px 7px 10px; border: none; background: none; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.work-tab-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.work-tab-close { flex: none; padding: 4px 8px; border: none; background: none; color: var(--muted); font-size: 11px; cursor: pointer; border-radius: 4px; }
.work-tab-close:hover { color: var(--text); background: var(--bg); }

/* Aksi massal */
.bulk-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; padding: 8px 12px; background: var(--primary-soft); border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.bulk-bar select { width: auto; }
.bulk-errors { flex-basis: 100%; color: var(--danger); font-size: 13px; }
.data-table td:has(> input[type="checkbox"]) + td { white-space: nowrap; }
.data-table input[type="checkbox"] { width: 16px; height: 16px; margin: 0; cursor: pointer; vertical-align: middle; }

/* Template beraksi */
.template-actions { margin-bottom: 8px; padding: 6px 10px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: 13px; }
.template-action-line { margin-top: 4px; color: var(--primary); }

/* Pencarian global */
.global-search { position: relative; flex: 1 1 320px; min-width: 180px; max-width: 520px; }
.global-search input { width: 100%; padding: 8px 12px 8px 34px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center; }
.global-search input:focus { background-color: var(--surface); }
.global-results { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; min-width: 300px; max-height: min(70vh, 560px); overflow-y: auto; padding: 4px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0, 0, 0, .16); }
.global-group { padding: 8px 12px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.global-empty { padding: 16px 12px; font-size: 14px; color: var(--muted); }
.global-all { width: 100%; margin-top: 4px; padding: 10px 12px; border: none; border-top: 1px solid var(--border); background: none; color: var(--primary); font-size: 13px; text-align: left; cursor: pointer; }
.global-all:hover { background: var(--bg); }
.recent-row { display: flex; gap: 10px; align-items: center; width: 100%; padding: 7px 12px; border: none; background: none; color: inherit; text-align: left; cursor: pointer; }
.recent-row:hover, .recent-row.active { background: var(--primary-soft); }
.recent-icon { flex: none; width: 24px; text-align: center; }
.recent-text { display: flex; flex-direction: column; min-width: 0; }
.recent-title, .recent-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-title { font-size: 14px; font-weight: 500; }
.search-page { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px; align-items: start; }
.search-side { display: flex; flex-direction: column; padding: 6px; }
.search-side-item { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border: none; border-radius: 6px; background: none; color: inherit; text-align: left; cursor: pointer; }
.search-side-item:hover:not(:disabled) { background: var(--bg); }
.search-side-item:disabled { color: var(--muted); cursor: default; }
.search-side-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.search-section { margin-bottom: 16px; }
.search-section h2 { margin: 0 0 6px; font-size: 15px; }
.search-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; gap: 0; }

/* Beranda */
.home-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; padding: 14px 18px; border-top: 3px solid var(--primary); }
.home-banner h1 { margin: 0; font-size: 20px; }
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
.home-main, .home-rail { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.home-layout .home-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.home-days { width: auto; padding: 4px 8px; font-size: 13px; }
.home-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; padding: 2px 14px 12px; border-bottom: 1px solid var(--border); }
.home-metric-value { font-size: 22px; font-weight: 700; line-height: 1.25; }
.home-performance { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; padding: 10px 14px 12px; }
.home-performance h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.home-performance #home-daily, .home-performance #home-status { padding: 0; }
.home-rail .data-table td { padding: 8px 10px; }
.home-rail .row-preview { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant-list { display: flex; flex-direction: column; padding: 0 8px 8px; gap: 4px; }
.assistant-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 8px; background: var(--surface); color: inherit; text-align: left; cursor: pointer; font-size: 14px; }
.assistant-item:hover { background: var(--bg); }
.assistant-item.late { border-left-color: var(--urgent); }
.assistant-item.soon { border-left-color: var(--high); }
.assistant-text { flex: 1; min-width: 0; }
.recent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); padding: 0 4px 6px; }

/* List view */
.view-menu { position: relative; flex: none; }
.view-menu-panel { display: flex; flex-direction: column; gap: 6px; width: 230px; padding: 8px; z-index: 20; }
.view-menu-panel .btn { width: 100%; text-align: left; }
.view-menu-panel .btn.hidden { display: none; }
.view-dialog { width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); }
.view-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.view-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.view-dialog h3 { margin: 16px 0 6px; font-size: 14px; }
.view-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.view-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; }
.view-dialog .form-actions { margin-top: 16px; }

@media (max-width: 1200px) {
  .brand-sub, #telegram-link { display: none; }
}
@media (max-width: 1100px) {
  .home-layout { grid-template-columns: minmax(0, 1fr); }
  .home-rail { order: -1; }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; }
  .global-search { order: 3; flex-basis: 100%; max-width: none; }
  .global-results { min-width: 0; }
  .search-page { grid-template-columns: minmax(0, 1fr); }
  .search-side { flex-direction: row; overflow-x: auto; }
  .search-side-item { flex: none; }
  .home-performance { grid-template-columns: minmax(0, 1fr); }
  .home-layout .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-rail .row-preview { max-width: none; }
}

/* Menu Pengaturan */
.app-nav .tabs .tab-settings { margin-left: auto; }
.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 12px; align-items: start; }
.settings-side { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.settings-title { padding: 6px 10px 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.settings-side .tab { padding: 8px 10px; border: none; border-radius: 6px; background: none; color: inherit; text-align: left; white-space: nowrap; }
.settings-side .tab:hover { background: var(--bg); }
.settings-side .tab.active { border: none; background: var(--primary-soft); color: var(--primary); font-weight: 600; }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-side { flex-direction: row; overflow-x: auto; }
  .settings-title { display: none; }
  .settings-side .tab { flex: none; }
}

/* Panduan menambah bot */
.channel-guide { margin-bottom: 14px; padding: 10px 14px; background: var(--primary-soft); border-radius: 8px; font-size: 14px; }
.channel-guide summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.channel-guide ol { margin: 10px 0 2px; padding-left: 20px; }
.channel-guide li { margin-bottom: 8px; line-height: 1.45; }
.channel-guide code { overflow-wrap: anywhere; }

/* Ubah langsung di tempat */
.fact-editable dd { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.fact-editable .fact-value { min-width: 0; }
.edit-pencil { flex: none; padding: 0 4px; border: none; background: none; font-size: 12px; line-height: 1.5; cursor: pointer; opacity: 0; border-radius: 4px; }
.fact-editable:hover .edit-pencil, .edit-pencil:focus-visible { opacity: 1; }
.edit-pencil:hover { background: var(--bg); }
@media (hover: none) { .edit-pencil { opacity: .7; } }
.edit-footer { position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: flex-end; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px -4px 0; padding: 10px 4px; background: var(--surface); border-top: 1px solid var(--border); }
.edit-footer .small { margin-right: auto; }
.edit-field { margin-bottom: 4px; }
.field-changed input, .field-changed select, .field-changed textarea { background: #fff8db; border-color: #e0b64a; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.field-error label { color: var(--danger); }

/* Riwayat perubahan */
.field-history { margin-top: 12px; }
.field-history summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.field-history-body { margin-top: 8px; overflow-x: auto; }
.history-table { font-size: 13px; }
.history-table tbody tr { cursor: default; }
.history-table td { white-space: normal; }
.history-table td:first-child { white-space: nowrap; }
.history-value { max-width: 240px; overflow-wrap: anywhere; }

/* Poles tampilan */
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.view-select:focus { box-shadow: none; }
.age { white-space: nowrap; }
.page-head .object-title { flex: 0 1 auto; max-width: 100%; }
.page-head .object-title > div { flex: 1; min-width: 0; }
#enable-notifications { padding: 6px 10px; }
/* Kartu tiket sudah punya tab Daftar tiket, jadi tombol kembali tidak perlu ada dua. */
#work-tabs:not(.hidden) ~ #ticket-detail .back-btn { display: none; }

@media (max-width: 900px) {
  .page-head .view-select { width: 100%; }
  /* Daftar tiket di HP: ringkas, supaya beberapa tiket muat dalam satu layar. */
  #ticket-list tbody tr { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; grid-auto-flow: row dense; gap: 3px 8px; align-items: center; width: auto; padding: 10px 12px; }
  #ticket-list td { display: block; width: auto; padding: 0; }
  #ticket-list td::before { display: none; }
  #ticket-list td[data-label="Pilih"] { grid-column: 1; grid-row: 1; }
  #ticket-list td[data-label="Pilih"] input { width: 20px; height: 20px; }
  #ticket-list td[data-label="No. tiket"] { grid-column: 2; grid-row: 1; font-size: 13px; }
  #ticket-list td[data-label="Prioritas"] { grid-column: 3; grid-row: 1; }
  #ticket-list td[data-label="Tipe"] { display: none; }
  #ticket-list td[data-label="Judul"], #ticket-list td[data-label="Pelanggan"], #ticket-list td[data-label="Status"], #ticket-list td[data-label="Saluran"] { grid-column: 1 / -1; }
  #ticket-list td[data-label="Pelanggan"], #ticket-list td[data-label="Saluran"] { color: var(--muted); font-size: 13px; }
  #ticket-list td[data-label="PJ"] { grid-column: 3; text-align: right; font-size: 13px; }
  #ticket-list td[data-label="PJ"]::before { content: "PJ: "; display: inline; width: auto; }
  #ticket-list td[data-label="Batas respons / dibuka"] { grid-column: 1 / 3; font-size: 13px; }
}

/* Profil bisnis dan tipe tiket */
.settings-page { padding: 18px; max-width: 760px; }
.settings-page h2 { margin-top: 0; }
.pack-list { display: flex; flex-direction: column; gap: 8px; }
.pack-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.pack-item.active { border-color: var(--primary); background: var(--primary-soft); }
.cf-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.cf-row .cf-label { flex: 2 1 180px; width: auto; }
.cf-row .cf-kind { flex: 1 1 110px; width: auto; }
.cf-row .cf-options { flex: 1 1 100%; width: auto; }
.stage-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 8px; margin-bottom: 8px; }
@media (max-width: 600px) { .stage-row { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { #ticket-list td { grid-column: 1 / -1; } }
#type-form h3, #business-form h3 { margin-top: 20px; }
#type-form .actions, #business-form .actions { margin-top: 14px; }

/* Langkah awal pelanggan baru */
.setup-card { margin-bottom: 12px; border-left: 3px solid var(--primary); }
.setup-list { list-style: none; margin: 0; padding: 0 14px 12px; }
.setup-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.setup-list li:first-child { border-top: none; }
.setup-mark { flex: none; display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 2px solid var(--border); border-radius: 50%; font-size: 13px; color: #fff; }
.setup-list li.done .setup-mark { border-color: var(--resolved); background: var(--resolved); }
.setup-text { flex: 1; min-width: 0; }
.setup-hint { display: block; }
.field-hint { margin: 4px 0 0; }
.field-hint .link-btn { padding: 0; }
