* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #ececed;
  --border-strong: #e2e2e4;
  --text: #1f2024;
  --text-muted: #6b6c72;
  --text-faint: #9a9ba1;
  --green: #2ea043;
  --green-dark: #15803d;
  --purple: #7c5cff;
  --purple-soft: #f3f0ff;
  --bubble-agent: #ffffff;
  --bubble-customer: #eef1f6;
  --chip-bg: #f1f1f3;
  --red: #d4373a;
  --amber: #b45309;
  --radius: 12px;
  font-size: 13px;
}
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body { height: 100vh; overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ---------- Top Bar ---------- */
.topbar {
  height: 48px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  flex-shrink: 0;
}
.logo { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; display: flex; align-items: center; gap: 5px; }
.logo .bliss { color: #111; }
.logo .contact { color: var(--green-dark); font-weight: 600; }
.logo .caret { color: var(--text-faint); font-size: 11px; margin-left: 2px; }
.tab {
  display: flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 14px;
  border-bottom: 2px solid #111;
  font-weight: 600; font-size: 13px;
  margin-left: 6px;
}
.tab .mail { font-size: 13px; }
.tab .timer {
  background: #ededed; color: #4a4b50;
  border-radius: 6px; padding: 2px 7px; font-size: 11px; font-weight: 600;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong); border-radius: 18px;
  padding: 5px 12px; font-size: 12px; font-weight: 500; color: var(--text);
  background: #fff;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.pill .ic { font-size: 12px; color: var(--text-muted); }
.pill .caret { color: var(--text-faint); font-size: 10px; }

/* ---------- Sub Bar ---------- */
.subbar {
  height: 38px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px; gap: 8px; flex-shrink: 0;
  font-size: 12px; color: var(--text-muted);
}
.subbar .crumb-strong { color: var(--green-dark); font-weight: 600; }
.subbar .sep { color: var(--text-faint); }
.subbar .meta { display: flex; align-items: center; gap: 5px; color: var(--text-muted); }
.subbar .badge-open {
  background: #eef6ef; color: var(--green-dark); border-radius: 5px;
  padding: 2px 8px; font-weight: 600; font-size: 11px;
}
.subbar .lock { font-size: 11px; }
.subbar-right { margin-left: auto; display: flex; gap: 8px; }
.btn-outline {
  border: 1px solid var(--border-strong); background: #fff;
  border-radius: 18px; padding: 5px 13px; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text);
}
.btn-outline .caret { color: var(--text-faint); font-size: 10px; }

/* ---------- Main 3-column ---------- */
.main {
  flex: 1; display: grid;
  grid-template-columns: 360px 1fr 500px;
  grid-template-rows: minmax(0, 1fr);
  gap: 10px; padding: 10px;
  overflow: hidden;
  min-height: 0;
}
.col { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.col::-webkit-scrollbar { width: 8px; }
.col::-webkit-scrollbar-thumb { background: #d7d8da; border-radius: 4px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.card-head {
  display: flex; align-items: center; gap: 7px;
  font-weight: 600; font-size: 13px; margin-bottom: 4px;
}
.card-head .icon { font-size: 13px; }
.card-head .right { margin-left: auto; display: flex; gap: 10px; color: var(--text-faint); font-size: 12px; }

/* Summary card */
.summary {
  background: var(--purple-soft);
  border: 1px solid #e7e1ff;
}
.summary .card-head { color: var(--purple); }
.summary p { font-size: 12.5px; line-height: 1.5; margin-top: 8px; color: #2c2d33; }
.summary p b { font-weight: 600; color: #1f2024; }
.summary .quote { font-style: italic; color: #3a3b42; }

/* stat row */
.statrow {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.statrow .stat { padding: 11px 12px; border-right: 1px solid var(--border); }
.statrow .stat:last-child { border-right: none; }
.statrow .stat .lbl { font-size: 10.5px; color: var(--text-faint); margin-bottom: 4px; }
.statrow .stat .val { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.statrow .stat .val.normal { color: var(--green-dark); }
.statrow .stat .val.flag { color: var(--red); }
.statrow .stat .val.warn { color: var(--amber); }

/* entity card */
.entity .card-head .ic { color: var(--green); }
.entity .title-green { color: var(--green-dark); font-weight: 600; }
.row-2 { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.name-line { font-weight: 600; font-size: 13px; margin-top: 8px; }
.ratings {
  display: flex; align-items: center; gap: 12px; margin-top: 8px;
  font-size: 12px; color: var(--text); flex-wrap: wrap;
}
.ratings .tag { display: flex; align-items: center; gap: 4px; }
.ratings .good { color: var(--green-dark); }
.ratings .bad { color: var(--red); }
.grid4 {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin-top: 12px; gap: 4px 4px; row-gap: 12px;
}
.grid4 .cell .lbl { font-size: 10.5px; color: var(--text-faint); margin-bottom: 3px; }
.grid4 .cell .v { font-size: 12.5px; font-weight: 600; }
.grid4 .cell .v.flag { color: var(--red); }
.grid3 {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin-top: 12px; gap: 4px; row-gap: 12px;
}
.grid3 .cell .lbl { font-size: 10.5px; color: var(--text-faint); margin-bottom: 3px; }
.grid3 .cell .v { font-size: 12.5px; font-weight: 600; }
.grid3 .cell .v.flag { color: var(--red); }
.grid2 {
  display: grid; grid-template-columns: repeat(2, 1fr);
  margin-top: 12px; gap: 4px; row-gap: 12px;
}
.grid2 .cell .lbl { font-size: 10.5px; color: var(--text-faint); margin-bottom: 3px; }
.grid2 .cell .v { font-size: 12.5px; font-weight: 600; }
.grid2 .cell .v.flag { color: var(--red); }
.trip-date { font-weight: 600; font-size: 13px; margin-top: 8px; }
.trip-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.divider { height: 1px; background: var(--border); margin: 10px 0; }

/* ---------- Middle conversation ---------- */
.convo { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.convo-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background:#ddd; }
.convo-head .who { font-weight: 600; font-size: 13px; }
.convo-head .role { background: #eef0f3; color: #5a5b61; border-radius: 5px; padding: 2px 7px; font-size: 11px; font-weight: 500; }
.convo-tabs { margin-left: auto; display: flex; gap: 18px; font-size: 12.5px; color: var(--text-muted); }
.convo-tabs .active { color: var(--text); font-weight: 600; border-bottom: 2px solid #111; padding-bottom: 13px; margin-bottom: -13px; }

.messages { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: #d7d8da; border-radius: 4px; }

.msg { display: flex; gap: 10px; max-width: 82%; }
.msg .mini-av { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; object-fit: cover; background:#ccc; }
.bubble { padding: 11px 14px; border-radius: 14px; font-size: 12.5px; line-height: 1.5; }
.msg.in .bubble { background: var(--bubble-customer); border-top-left-radius: 4px; color: #25262b; }
.msg.out { margin-left: auto; flex-direction: row-reverse; }
.msg.out .bubble { background: #fff; border: 1px solid var(--border-strong); border-top-right-radius: 4px; color: #25262b; }
.bubble ul { margin: 6px 0 2px 16px; }
.bubble li { margin: 2px 0; }
.sysline { text-align: center; font-size: 11px; color: var(--text-faint); margin: 4px 0; position: relative; }
.sysline span { background: var(--panel); padding: 0 12px; position: relative; z-index: 1; }
.sysline::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }

/* composer */
.composer { border-top: 1px solid var(--border); padding: 10px 14px 12px; flex-shrink: 0; }
.quickchips { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.chip { background: var(--chip-bg); border-radius: 16px; padding: 5px 13px; font-size: 12px; color: #45464c; cursor: pointer; }
.inputbox { border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; color: var(--text-faint); }
.composer-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.composer-foot .ic { color: var(--text-faint); font-size: 14px; cursor: pointer; }
.gen-btn { border: 1px solid var(--border-strong); background:#fff; border-radius: 16px; padding: 5px 12px; font-size: 12px; color: var(--text-muted); display:flex; align-items:center; gap:6px; cursor:pointer; }
.composer-foot .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sendas { border: 1px solid var(--border-strong); background:#fff; border-radius: 16px; padding: 6px 12px; font-size: 12px; display:flex; align-items:center; gap:6px; cursor:pointer; }
.send-circle { width: 34px; height: 34px; border-radius: 50%; background:#111; color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:14px; }

/* ---------- Right column iframe ---------- */
.scout {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; min-height: 0;
  padding: 16px;
}
.scout iframe { flex: 1; width: 100%; border: none; min-height: 0; }

/* ---------- Landing page ---------- */
.landing { padding: 36px 40px; height: 100vh; overflow-y: auto; }
.landing h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.landing .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.landing .pkg-title { font-size: 14px; font-weight: 700; margin: 26px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.landing .pkg-title .pkg-note { font-size: 11px; font-weight: 500; color: var(--text-faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.scen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.scen-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; transition: box-shadow .12s, border-color .12s;
}
.scen-card:hover { border-color: #c9c9cd; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.scen-card .id { font-size: 11px; font-weight: 700; color: var(--purple); letter-spacing: .4px; }
.scen-card .ttl { font-size: 14px; font-weight: 600; margin: 6px 0 4px; }
.scen-card .meta2 { font-size: 12px; color: var(--text-muted); }
.scen-card .tags2 { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.scen-card .t { font-size: 10.5px; background: var(--chip-bg); color: #54555b; border-radius: 5px; padding: 2px 7px; }
