/* dDaniel Advertising brand: black #0B0B0B + lime #8BC53D on warm light grey, Mulish body, Bebas Neue headings.
   Tokens follow the dda-marketing-dashboard client dashboard (theme.js). */
:root {
  --lime: #8bc53d; --lime-d: #6fa52a; --lime-soft: #e9f3d8;
  --ink: #0b0b0b; --tx: #1f211d; --mu: #62665e; --bg: #f4f5f2; --sf: #fff; --sf2: #f1f3ee; --bd: #e1e4dc;
  --bad: #c0392b; --warn: #b7791f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Mulish", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--tx); background: var(--bg); font-size: 14px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: "Bebas Neue", "Mulish", Impact, sans-serif; font-weight: 400; letter-spacing: .03em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--lime-d); }

.wordmark { margin: 0; color: #fff; font-family: "Mulish", system-ui, sans-serif; font-weight: 800; letter-spacing: -.02em; font-size: 34px; line-height: 1.02; }
.wordmark em { color: var(--lime); font-style: normal; }
.wordmark.sm { font-size: 19px; line-height: 1.08; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--bd); background: var(--sf); color: var(--tx); border-radius: 10px; padding: 8px 14px; font-weight: 700; font-size: 13px; text-decoration: none; }
.btn:hover { background: var(--sf2); }
.btn.primary { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.btn.primary:hover { background: var(--lime-d); border-color: var(--lime-d); }
.btn.danger { color: var(--bad); }
.btn.ghost-dark { background: transparent; color: #c9cfc2; border-color: #2c3029; }
.btn.ghost-dark:hover { background: #1b1d1a; color: #fff; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 5fr) 6fr; }
.login-brand { background: #0b0b0b radial-gradient(900px 500px at 0% 0%, rgba(139,197,61,.16), transparent 60%); color: #fff; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 56px; gap: 18px; }
.login-brand img { background: #fff; border-radius: 50%; padding: 4px; }
.login-brand .wordmark { font-size: 52px; }
.login-brand p { color: #b5bbae; max-width: 360px; font-size: 16px; line-height: 1.5; margin: 0; }
.login-form-wrap { display: grid; place-items: center; padding: 28px; background: var(--bg); }
.login-card { width: min(400px, 100%); background: var(--sf); border: 1px solid var(--bd); border-radius: 18px; padding: 32px; box-shadow: 0 10px 40px rgba(11,11,11,.08); display: flex; flex-direction: column; gap: 14px; }
.login-card h2 { margin: 0; font-size: 38px; color: var(--ink); }
.kicker { margin: 0; color: var(--lime-d); font-weight: 800; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 12.5px; color: var(--mu); }
.login-card input { padding: 11px 13px; border: 1.5px solid var(--bd); border-radius: 10px; font-size: 15px; background: #fff; outline: 0; }
.login-card input:focus, .field input:focus, .field textarea:focus, .field select:focus, .composer textarea:focus, .toolbar input:focus { border-color: var(--lime-d); box-shadow: 0 0 0 3px rgba(139,197,61,.25); outline: 0; }
.error { color: var(--bad); font-weight: 700; margin: 0; }
.fine { margin: 0; font-size: 12px; color: var(--mu); }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; } .login-brand { padding: 28px; } .login-brand .wordmark { font-size: 38px; } }

/* shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #c9cfc2; display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; border-bottom: 1px solid #1f221d; margin-bottom: 14px; }
.side-brand img { background: #fff; border-radius: 50%; padding: 2px; }
#nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
#nav button { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; border: 0; background: transparent; color: #c9cfc2; font-weight: 700; font-size: 14px; padding: 10px 12px; border-radius: 10px; }
#nav button:hover { background: #1b1d1a; color: #fff; }
#nav button[aria-current="page"] { background: var(--lime); color: var(--ink); }
#nav svg { width: 18px; height: 18px; flex: none; }
#nav .badge { margin-left: auto; background: #fff; color: var(--ink); border-radius: 99px; font-size: 11px; font-weight: 800; padding: 1px 8px; }
#nav button[aria-current="page"] .badge { background: var(--ink); color: var(--lime); }
.nav-sep { margin: 14px 12px 6px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #6c7266; font-weight: 800; }
.side-foot { border-top: 1px solid #1f221d; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.who { padding: 0 6px; line-height: 1.3; }
.who strong { display: block; color: #fff; font-size: 13px; }
.who span { font-size: 11.5px; color: #8e9588; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 28px 6px; }
.top-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.top h1 { margin: 0; font-size: 36px; color: var(--ink); line-height: 1; }
.menu-btn { display: none; border: 1px solid var(--bd); background: #fff; border-radius: 8px; padding: 6px 10px; }
.client-badge { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--bd); border-radius: 12px; padding: 6px 12px 6px 8px; }
.client-badge img { height: 30px; width: auto; max-width: 90px; object-fit: contain; }
.client-badge span { font-weight: 800; font-size: 13px; }
.switch { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 12px; color: var(--mu); }
.switch select, .toolbar select, .toolbar input, .field input, .field select, .field textarea, .composer textarea, .sim input, .sim select { border: 1.5px solid var(--bd); border-radius: 9px; background: #fff; padding: 8px 10px; }
.view { padding: 10px 28px 40px; }

/* cards + stats */
.card { background: var(--sf); border: 1px solid var(--bd); border-radius: 16px; padding: 18px 20px; }
.card h3 { margin: 0 0 12px; font-size: 22px; color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--sf); border: 1px solid var(--bd); border-radius: 16px; padding: 16px 18px; border-top: 4px solid var(--lime); }
.stat .v { font-family: "Bebas Neue", sans-serif; font-size: 46px; line-height: 1; color: var(--ink); letter-spacing: .02em; }
.stat .l { font-size: 12px; font-weight: 800; color: var(--mu); text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 980px) { .grid2 { grid-template-columns: 1fr; } }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--mu); padding: 8px 10px; border-bottom: 1px solid var(--bd); }
table.data td { padding: 10px; border-bottom: 1px solid var(--bd); }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 6px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; font-size: 11px; color: var(--mu); font-weight: 700; }
.bar .col { width: 100%; max-width: 44px; background: var(--lime-soft); border-radius: 6px 6px 0 0; position: relative; min-height: 2px; }
.bar .col i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--lime); border-radius: 6px 6px 0 0; }
.chbar { display: grid; grid-template-columns: 110px 1fr 70px; align-items: center; gap: 10px; margin: 9px 0; font-weight: 700; font-size: 13px; }
.chbar .track { height: 10px; background: var(--sf2); border-radius: 99px; overflow: hidden; }
.chbar .track i { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.chbar .track i.lead { background: var(--lime); }
.chbar small { color: var(--mu); font-weight: 600; text-align: right; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--mu); font-weight: 700; margin: 4px 0 0; }
.legend b { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* pills + banners */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 9px; font-size: 11px; font-weight: 800; background: var(--sf2); color: var(--mu); white-space: nowrap; }
.pill.lime { background: var(--lime-soft); color: #3d6a0c; }
.pill.dark { background: var(--ink); color: var(--lime); }
.pill.warn { background: #fff3d6; color: var(--warn); }
.pill.bad { background: #fde6e2; color: var(--bad); }
.banner { display: flex; gap: 12px; align-items: flex-start; border-radius: 12px; padding: 11px 14px; margin-bottom: 14px; font-size: 13px; line-height: 1.5; border: 1px solid var(--bd); background: #fff; }
.banner.sim { background: #fff8e1; border-color: #f0dba0; }
.banner.live { background: var(--lime-soft); border-color: #cfe5a8; }
.banner strong { white-space: nowrap; }

/* two-pane lists */
.split { display: grid; grid-template-columns: 330px 1fr; gap: 16px; align-items: start; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } }
.list { padding: 0; overflow: hidden; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-bottom: 1px solid var(--bd); align-items: center; }
.toolbar input { flex: 1; min-width: 120px; }
.items { max-height: 640px; overflow-y: auto; }
.item { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--bd); background: #fff; padding: 12px 14px; }
.item:hover { background: var(--sf2); }
.item.sel { background: var(--lime-soft); box-shadow: inset 4px 0 0 var(--lime); }
.item .r1 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.item strong { font-size: 14px; }
.item .t { font-size: 11px; color: var(--mu); white-space: nowrap; }
.item .snip { margin-top: 3px; font-size: 12.5px; color: var(--mu); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.item .tags { margin-top: 6px; display: flex; gap: 5px; flex-wrap: wrap; }
.dotn { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--ink); color: var(--lime); font-size: 11px; font-weight: 800; }
.empty { padding: 36px 20px; text-align: center; color: var(--mu); }

/* conversation */
.conv { display: flex; flex-direction: column; min-height: 560px; padding: 0; overflow: hidden; }
.conv-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--bd); flex-wrap: wrap; }
.conv-head h3 { margin: 0; font-size: 26px; }
.conv-head .sub { font-size: 12px; color: var(--mu); }
.takeover { display: flex; align-items: center; gap: 10px; }
.msgs { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); max-height: 520px; min-height: 280px; }
.m { max-width: 74%; display: flex; flex-direction: column; gap: 3px; }
.m .b { padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.m .meta { font-size: 11px; color: var(--mu); }
.m.in { align-self: flex-start; } .m.in .b { background: #fff; border: 1px solid var(--bd); border-radius: 4px 16px 16px 16px; }
.m.out { align-self: flex-end; align-items: flex-end; } .m.out .b { border-radius: 16px 4px 16px 16px; }
.m.bot .b { background: var(--lime-soft); border: 1px solid #cfe5a8; }
.m.agent .b { background: var(--ink); color: #fff; }
.m.sys { align-self: center; max-width: 90%; } .m.sys .b { background: transparent; color: var(--mu); font-size: 12px; font-weight: 700; padding: 2px 8px; text-align: center; }
.m.fail .meta { color: var(--bad); font-weight: 700; }
.composer { border-top: 1px solid var(--bd); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-end; background: #fff; }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 120px; }
.composer .note { font-size: 12px; color: var(--mu); }
.lead-card { margin: 12px 18px 0; padding: 12px 14px; border: 1px solid #cfe5a8; background: var(--lime-soft); border-radius: 12px; font-size: 13px; }
.lead-card dl { margin: 6px 0 0; display: grid; grid-template-columns: 120px 1fr; gap: 3px 10px; }
.lead-card dt { color: var(--mu); font-weight: 700; } .lead-card dd { margin: 0; font-weight: 700; }
.sim { margin-top: 14px; border: 1.5px dashed #d8c27a; background: #fffdf3; border-radius: 12px; padding: 4px 14px; }
.sim summary { cursor: pointer; font-weight: 800; padding: 8px 0; }
.sim .row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; align-items: center; }
.sim input[type=text], .sim input[type=tel] { flex: 1; min-width: 160px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { border: 1px solid var(--bd); background: #fff; border-radius: 99px; padding: 3px 10px; font-size: 12px; }
.ch-ic { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; font-size: 12px; font-weight: 800; }
.ch-ic.messenger { background: linear-gradient(135deg, #0a7cff, #a334fa); } .ch-ic.instagram { background: linear-gradient(135deg, #feda75, #d62976 55%, #4f5bd5); } .ch-ic.sms { background: var(--ink); color: var(--lime); }

/* forms */
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; font-weight: 700; font-size: 12.5px; color: var(--mu); }
.field.full { grid-column: 1 / -1; }
.field textarea { min-height: 84px; resize: vertical; line-height: 1.45; } .field textarea.tall { min-height: 220px; font-family: ui-monospace, monospace; font-size: 12px; }
.field small { font-weight: 600; color: var(--mu); }
.field input[readonly] { background: var(--sf2); color: var(--mu); }
.prog h3.sec { margin: 22px 0 10px; font-size: 22px; border-bottom: 2px solid var(--lime); padding-bottom: 4px; display: inline-block; }
.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle-grid label { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.toggle-grid input { accent-color: var(--lime-d); }
.status { padding: 9px 12px; border-radius: 10px; font-weight: 700; margin: 12px 0; }
.status.ok { background: var(--lime-soft); color: #3d6a0c; } .status.err { background: #fde6e2; color: var(--bad); }
.steps { margin: 0; padding-left: 20px; line-height: 1.7; } .steps li { margin-bottom: 4px; }
code { background: var(--sf2); padding: 1px 6px; border-radius: 5px; font-size: 12px; word-break: break-all; }
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 6px 14px; font-size: 13px; } .kv dt { color: var(--mu); font-weight: 700; } .kv dd { margin: 0; }
.ok-ic { color: #3d8b0a; font-weight: 800; } .no-ic { color: var(--bad); font-weight: 800; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-block; }
  .top, .view { padding-left: 16px; padding-right: 16px; }
  .fgrid, .toggle-grid { grid-template-columns: 1fr; }
}

/* ---------- v3: empty states, embed, dialogs ---------- */
.banner.info { background: #eef4fb; border-color: #cfdff2; }
.welcome { text-align: center; padding: 34px 20px; }
.welcome .w-ic { width: 52px; height: 52px; border-radius: 50%; background: var(--lime-soft); color: var(--lime-d); display: grid; place-items: center; margin: 0 auto 10px; }
.welcome .w-ic svg { width: 26px; height: 26px; }
.welcome h3 { margin: 0 0 6px; font-size: 30px; color: var(--ink); }
.welcome p { margin: 0 auto 20px; max-width: 520px; color: var(--mu); line-height: 1.55; }
.stats.mini { max-width: 760px; margin: 0 auto; }
.empty strong { color: var(--tx); }
.code-wrap { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
pre.code { margin: 0; width: 100%; background: #0b0b0b; color: #d6f0a8; border-radius: 10px; padding: 12px 14px; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; user-select: all; }
.stack { display: flex; flex-wrap: wrap; gap: 10px; }
.status { margin: 10px 0 0; }
.dlg { border: 0; border-radius: 16px; padding: 0; width: min(420px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dlg::backdrop { background: rgba(11,11,11,.55); }
.dlg form { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.dlg h2 { margin: 0; font-size: 30px; color: var(--ink); }
.dlg label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 12.5px; color: var(--mu); }
.dlg input { padding: 11px 13px; border: 1.5px solid var(--bd); border-radius: 10px; font-size: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; }
.side { overflow-y: auto; }
@media (max-width: 860px) {
  .top { flex-wrap: wrap; padding-top: 12px; }
  .top h1 { font-size: 28px; }
  .top-left { flex-wrap: wrap; row-gap: 8px; }
  .top-right { width: 100%; }
  .switch { width: 100%; } .switch select { flex: 1; min-width: 0; }
  .menu-btn { min-height: 44px; min-width: 44px; }
  .side { height: 100dvh; }
  .btn, #nav button { min-height: 44px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .v { font-size: 28px; }
  .card { overflow-x: auto; }
  table.data { display: block; overflow-x: auto; max-width: 100%; }
  .toolbar { flex-wrap: wrap; }
  .toolbar input, .toolbar select { flex: 1 1 140px; min-width: 0; font-size: 16px; }
  .field input, .field textarea, .field select, .composer textarea, .sim input, .sim select { font-size: 16px; }
  .fgrid { grid-template-columns: 1fr !important; }
  .kv dd code, code { overflow-wrap: anywhere; word-break: break-all; }
  .conv-head { flex-wrap: wrap; gap: 8px; }
  .banner { flex-direction: column; gap: 4px; }
}
.grid2 > *, .split > *, .fgrid > * { min-width: 0; }
@media (max-width: 980px) { .grid2, .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .field input, .field textarea { max-width: 100%; } }
.kv dd, .kv dd code, td code { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.view { min-width: 0; max-width: 100%; }
table.data td { overflow-wrap: anywhere; }
.card { min-width: 0; max-width: 100%; }
@media (max-width: 860px) {
  .top-left { flex-wrap: wrap; width: 100%; gap: 10px; }
  .top-left .client-badge { flex: 1 1 0; min-width: 0; }
  .top-left .client-badge span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-left h1 { flex: 0 0 100%; }
}
