@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Inter:wght@400;450;500;600&display=swap');

:root {
  --bg: #080d17;
  --surface: rgba(255,255,255,.034);
  --surface-2: rgba(255,255,255,.06);
  --raise: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
  --navy: #1a3360; --navy-soft: #2a5db0; --navy-2: #0f2348;
  --gold: #e3b24c; --gold-soft: #f1cd78;
  --accent: #5b8bff; --accent-2: #7aa2ff; --red: #ef5350;
  --head: #f2f5fb; --ink: #cdd6e6; --muted: #8290a6; --faint: #5a6678;
  --line: rgba(255,255,255,.07); --line-2: rgba(255,255,255,.13);
  --good: #34d399; --warn: #f5b948; --bad: #f6716e; --info: #38bdf8;
  --r: 16px; --r-sm: 11px;
  --sh-1: 0 1px 2px rgba(0,0,0,.30), 0 14px 36px -14px rgba(0,0,0,.55);
  --sh-2: 0 24px 70px rgba(0,0,0,.6);
  --sidebar: 250px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 8% -8%, rgba(38,82,150,.32), transparent 60%),
    radial-gradient(760px 540px at 100% -4%, rgba(227,178,76,.10), transparent 55%),
    radial-gradient(1000px 760px at 88% 112%, rgba(91,139,255,.10), transparent 60%),
    linear-gradient(180deg, #090f1b, #070b14);
  background-attachment: fixed;
}
h1, h2, h3 { font-family: "Sora", "Inter", sans-serif; letter-spacing: -.018em; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
b, strong { font-weight: 600; }
::selection { background: rgba(91,139,255,.32); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.10); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); background-clip: padding-box; }

/* ---------- Login / Setup ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 412px; max-width: 94vw; padding: 38px;
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.022));
  border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--sh-2);
  backdrop-filter: blur(22px);
}
.login-card h1 { margin: 0 0 5px; font-size: 24px; color: var(--head); }
.login-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 13px; line-height: 1.6; }
.brand-logo { display: block; width: 224px; max-width: 80%; background: #fff; padding: 15px 19px; border-radius: 14px; margin: 0 0 24px; box-shadow: 0 12px 34px rgba(0,0,0,.42); }
.hint { font-size: 12px; color: var(--faint); margin-top: 18px; text-align: center; line-height: 1.65; }
.steps { display: flex; gap: 7px; margin: 6px 0 24px; }
.steps i { height: 3px; flex: 1; border-radius: 4px; background: rgba(255,255,255,.12); }
.steps i.on { background: linear-gradient(90deg, var(--gold), var(--gold-soft)); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, rgba(11,18,33,.86), rgba(8,12,22,.92));
  border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; backdrop-filter: blur(12px);
}
.sidebar .logo { display: flex; gap: 12px; align-items: center; padding: 4px 8px 22px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.sidebar .logo .mk { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: #fff; padding: 6px; box-shadow: 0 5px 16px rgba(0,0,0,.4); flex: none; }
.sidebar .logo .mk img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sidebar .logo b { color: #fff; font-size: 15px; letter-spacing: -.01em; font-family: "Sora", sans-serif; }
.sidebar .logo span { font-size: 10px; color: var(--gold-soft); letter-spacing: .1em; text-transform: uppercase; }
.nav-group { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--faint); padding: 18px 12px 8px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 13px; border-radius: 10px;
  color: #9aa7bd; text-decoration: none; font-size: 13.5px; margin-bottom: 2px; position: relative;
  transition: background .16s, color .16s;
}
.nav a:hover { background: var(--surface); color: #eaf0fa; }
.nav a.active { background: var(--surface-2); color: #fff; font-weight: 500; }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--gold), var(--gold-soft)); box-shadow: 0 0 12px rgba(227,178,76,.5); }
.nav a .ic { width: 18px; display: inline-flex; align-items: center; justify-content: center; opacity: .92; }
.nav a.active .ic { color: var(--gold-soft); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: rgba(9,14,24,.6); border-bottom: 1px solid var(--line); padding: 14px 26px;
  display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 5; backdrop-filter: blur(16px);
}
.topbar h2 { margin: 0; font-size: 17px; color: var(--head); }
.topbar .spacer { flex: 1; }
.whoami { display: flex; align-items: center; gap: 11px; font-size: 13px; }
.avatar { width: 35px; height: 35px; border-radius: 10px; background: linear-gradient(140deg, var(--navy-soft), var(--navy)); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; border: 1px solid var(--line-2); box-shadow: var(--sh-1); }
.bell { position: relative; border: 1px solid var(--line); background: var(--surface); color: var(--muted); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; transition: all .15s; }
.bell:hover { color: #fff; background: var(--surface-2); border-color: var(--line-2); }
.bell .count { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #0a1019; }
.notif-wrap { position: relative; }
.notif-panel { position: absolute; top: 46px; right: 0; width: 330px; max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.5); z-index: 40; animation: fade .15s ease; }
.notif-hd { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 13px 15px; border-bottom: 1px solid var(--line); color: var(--head); font-size: 13.5px; }
.notif-hd .muted { font-size: 11.5px; }
.notif-list { padding: 5px; }
.notif-item { padding: 10px 11px; border-radius: 10px; cursor: pointer; transition: background .12s; }
.notif-item:hover { background: var(--surface-2); }
.notif-item + .notif-item { border-top: 1px solid var(--line); }
.content { padding: 26px; max-width: 1320px; width: 100%; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ---------- Bits ---------- */
.btn {
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); padding: 8px 15px;
  border-radius: 10px; font-size: 13px; font-weight: 500; transition: all .16s; white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.primary { background: linear-gradient(140deg, #2f5db3, #21407e); border: 1px solid rgba(122,162,255,.45); color: #fff; box-shadow: 0 6px 18px -6px rgba(47,93,179,.7), inset 0 1px 0 rgba(255,255,255,.16); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.gold { background: linear-gradient(140deg, var(--gold), var(--gold-soft)); border: 0; color: #251a05; box-shadow: 0 6px 18px -6px rgba(227,178,76,.7), inset 0 1px 0 rgba(255,255,255,.4); font-weight: 600; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: #fff; background: var(--surface); transform: none; }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn.danger { color: var(--bad); border-color: rgba(246,113,110,.35); background: rgba(246,113,110,.06); }
.btn.danger:hover { background: rgba(246,113,110,.14); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }
.muted { color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); letter-spacing: .01em; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
.tag { background: var(--surface-2); color: #aebace; padding: 3px 10px; border-radius: 7px; font-size: 11.5px; border: 1px solid var(--line); white-space: nowrap; }
.chip-pick { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink); }
.chip-x { border: 0; background: rgba(255,255,255,.14); color: var(--ink); width: 18px; height: 18px; border-radius: 50%; line-height: 1; font-size: 13px; cursor: pointer; display: grid; place-items: center; padding: 0; }
.chip-x:hover { background: var(--bad); color: #fff; }

.card { background: var(--raise); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); backdrop-filter: blur(8px); overflow: hidden; position: relative; }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent); }
.card .hd { padding: 15px 19px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card .hd h3 { margin: 0; font-size: 13.5px; color: var(--head); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.card .bd { padding: 19px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 15px; margin-bottom: 18px; }
.kpi { background: var(--raise); border: 1px solid var(--line); border-radius: var(--r); padding: 17px 18px; box-shadow: var(--sh-1); transition: transform .16s, border-color .16s; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.14), transparent); }
.kpi:hover { transform: translateY(-3px); border-color: var(--line-2); }
.kpi .v { font-family: "Sora", sans-serif; font-size: 27px; font-weight: 700; color: var(--head); line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 11.5px; color: var(--muted); margin-top: 8px; text-transform: uppercase; letter-spacing: .05em; }
.kpi .sub { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.kpi .v.gold { background: linear-gradient(116deg, var(--gold-soft), var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.seg { display: inline-flex; background: rgba(0,0,0,.28); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-b { border: 0; background: transparent; color: var(--muted); padding: 6px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 500; transition: all .15s; }
.seg-b:hover { color: var(--ink); }
.seg-b.on { background: var(--surface-2); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 2px 6px rgba(0,0,0,.3); }

.ring { display: grid; place-items: center; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 600; }
.tbl th[data-key] { user-select: none; transition: color .12s; }
.tbl th[data-key]:hover { color: var(--head); }
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: rgba(255,255,255,.04); }
.tbl tr.click { cursor: pointer; }
.tbl .strong { font-weight: 600; color: var(--head); font-variant-numeric: normal; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: #b7c2d4; margin-bottom: 6px; letter-spacing: .01em; }
.field .help { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.input, select.input, textarea.input { width: 100%; padding: 10px 13px; border: 1px solid var(--line-2); border-radius: 10px; background: rgba(0,0,0,.22); color: var(--head); transition: border-color .15s, box-shadow .15s, background .15s; }
.input::placeholder { color: #5d6a7e; }
.input:focus, textarea.input:focus, select.input:focus { outline: none; border-color: var(--accent); background: rgba(0,0,0,.3); box-shadow: 0 0 0 3px rgba(91,139,255,.18); }
.input option, select.input option { color: #0b1220; }
textarea.input { min-height: 74px; resize: vertical; }
.checks { display: flex; flex-direction: column; gap: 9px; max-height: 214px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: rgba(0,0,0,.22); }
.checks label { display: flex; gap: 9px; align-items: center; font-weight: 400; font-size: 13px; margin: 0; color: var(--ink); }
.inline-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
input[type="color"] { background: rgba(0,0,0,.2); }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(4,7,13,.66); display: grid; place-items: center; z-index: 50; padding: 20px; backdrop-filter: blur(5px); animation: fade .15s ease; }
.modal { background: linear-gradient(180deg, #101a2e, #0c1322); width: 560px; max-width: 96vw; max-height: 92vh; overflow-y: auto; border-radius: 18px; box-shadow: var(--sh-2); border: 1px solid var(--line-2); }
.modal .mh { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal .mh h3 { margin: 0; font-size: 16px; color: var(--head); }
.modal .mb { padding: 22px; }
.modal .mf { padding: 15px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: rgba(0,0,0,.24); position: sticky; bottom: 0; }
.x { margin-left: auto; border: 0; background: none; font-size: 22px; color: var(--muted); line-height: 1; cursor: pointer; transition: color .15s; }
.x:hover { color: #fff; }

/* ---------- Slide-over (lead) ---------- */
.sheet { position: fixed; top: 0; right: 0; height: 100vh; width: 700px; max-width: 100vw; background: linear-gradient(180deg, #0b1322, #080d17); box-shadow: -22px 0 70px rgba(0,0,0,.55); z-index: 40; display: flex; flex-direction: column; border-left: 1px solid var(--line-2); animation: slidein .24s cubic-bezier(.2,.7,.3,1); }
@keyframes slidein { from { transform: translateX(48px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet .sh { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; padding: 20px 22px; border-bottom: 1px solid var(--line-2); }
.sheet .sh .nm { font-size: 21px; font-weight: 700; font-family: "Sora", sans-serif; letter-spacing: -.02em; }
.sheet .sh .meta { font-size: 12.5px; color: #a7b8d4; margin-top: 4px; }
.sheet .body { padding: 19px; overflow-y: auto; flex: 1; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 9px 0 9px 19px; border-left: 2px solid var(--line-2); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 9px rgba(227,178,76,.6); }
.timeline .tt { font-size: 13px; color: var(--ink); }
.timeline .tm { font-size: 11px; color: var(--muted); margin-top: 2px; }
.wa-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.wa-item:last-child { border-bottom: 0; }
.wa-item .badge { font-size: 9.5px; padding: 3px 8px; border-radius: 6px; font-weight: 700; white-space: nowrap; letter-spacing: .04em; }
.b-sent { background: rgba(52,211,153,.16); color: #6ee7b7; } .b-pending { background: rgba(245,185,72,.16); color: #fbd474; }
.b-failed { background: rgba(246,113,110,.16); color: #fca5a5; } .b-cancelled { background: rgba(255,255,255,.08); color: #94a3b8; }

.empty { text-align: center; color: var(--muted); padding: 46px 14px; font-size: 13px; }
.bar { height: 7px; background: rgba(255,255,255,.07); border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-soft), var(--accent-2)); border-radius: 6px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: rgba(16,26,46,.97); color: #fff; padding: 12px 20px; border-radius: 12px; box-shadow: var(--sh-2); z-index: 100; font-size: 13px; border: 1px solid var(--line-2); backdrop-filter: blur(10px); }
.toast.bad { border-color: rgba(246,113,110,.5); } .toast.good { border-color: rgba(52,211,153,.5); }
.hide { display: none !important; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .22s; width: 250px; }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 16px; }
  .menu-btn { display: inline-flex !important; }
}
.menu-btn { display: none; }

/* ===== PAGE WRAPPER ===== */
.pg { max-width: 900px; }

/* ===== WA CHAT (openLead waChatCard + inbox) ===== */
.wa-chat-header { display:flex; align-items:center; gap:10px; padding:10px 14px; background:rgba(255,255,255,.04); border-bottom:1px solid var(--line); border-radius:10px 10px 0 0; }
.wa-chat-avatar { width:36px; height:36px; border-radius:50%; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; flex-shrink:0; }
.wa-chat-name { font-weight:600; font-size:13px; }
.wa-chat-phone { font-size:11px; color:var(--muted); }
.wa-chat-body { flex:1; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:8px; min-height:160px; max-height:340px; }
.wa-chat-footer { display:flex; align-items:flex-end; gap:8px; padding:10px 12px; background:rgba(255,255,255,.03); border-top:1px solid var(--line); border-radius:0 0 10px 10px; }
.wa-chat-footer textarea, .wa-chat-footer input { flex:1; resize:none; min-height:40px; }
.wa-send-btn { background:var(--accent); color:#fff; border:none; border-radius:8px; width:38px; height:38px; cursor:pointer; font-size:16px; flex-shrink:0; display:flex; align-items:center; justify-content:center; }
.wa-bubble { max-width:80%; padding:8px 12px; border-radius:10px; font-size:13px; line-height:1.5; position:relative; }
.wa-bubble.out { background:rgba(79,104,247,.25); align-self:flex-end; border-bottom-right-radius:2px; }
.wa-bubble.in { background:rgba(255,255,255,.07); align-self:flex-start; border-bottom-left-radius:2px; }
.wa-bubble-time { font-size:10px; color:var(--muted); margin-top:4px; text-align:right; }
.wa-attach-btn { background:transparent; border:none; color:var(--muted); cursor:pointer; width:34px; height:38px; display:flex; align-items:center; justify-content:center; flex-shrink:0; border-radius:6px; }
.wa-attach-btn:hover { background:rgba(255,255,255,.07); color:var(--fg); }
.wa-attach-menu { position:absolute; bottom:58px; left:4px; background:var(--card); border:1px solid var(--line); border-radius:10px; padding:6px 0; min-width:180px; box-shadow:0 4px 16px rgba(0,0,0,.35); z-index:200; }
.wa-attach-menu.hidden { display:none; }
.wa-attach-opt { display:flex; align-items:center; gap:10px; padding:9px 14px; cursor:pointer; font-size:13px; }
.wa-attach-opt:hover { background:rgba(255,255,255,.06); }
.wa-attach-opt .material-icons { font-size:18px; color:var(--accent); }
.wa-contact-form { padding:10px 12px; background:rgba(255,255,255,.04); border-top:1px solid var(--line); display:flex; flex-direction:column; gap:6px; }
.wa-tpl-drop { position:relative; }
.wa-tpl-drop.hide { display:none; }
.wa-tpl-btn { background:rgba(255,255,255,.06); border:1px solid var(--line); border-radius:8px; padding:6px 12px; cursor:pointer; color:var(--fg); font-size:12px; }
.wa-tpl-item { padding:8px 12px; cursor:pointer; border-radius:6px; }
.wa-tpl-item:hover { background:rgba(255,255,255,.06); }
.wa-tpl-name { font-weight:600; font-size:12px; }
.wa-tpl-preview { font-size:11px; color:var(--muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* ===== TEMPLATE BUILDER ===== */
.tpl-layout { display:grid; grid-template-columns:1fr 340px; gap:20px; }
.tpl-form-col { min-width:0; }
.tpl-preview-col { min-width:0; }
.tpl-row-2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.tpl-btn-row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:6px; }
.tpl-label { font-size:11.5px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin-bottom:4px; }
.tpl-hint { font-size:11px; color:var(--muted); margin-top:3px; }
.tpl-body-input { width:100%; min-height:140px; background:var(--card); border:1px solid var(--line); border-radius:8px; color:var(--fg); padding:10px 12px; font-size:13px; resize:vertical; font-family:inherit; box-sizing:border-box; }
.tpl-char-count { font-size:11px; color:var(--muted); text-align:right; margin-top:2px; }
.tpl-var-chip { background:rgba(79,104,247,.18); color:var(--accent); border-radius:5px; padding:2px 7px; cursor:pointer; font-size:11px; margin-right:4px; margin-bottom:4px; display:inline-block; }
.tpl-var-chip:hover { background:rgba(79,104,247,.32); }
.tpl-phone { background:#111b21; border-radius:14px; overflow:hidden; box-shadow:0 4px 24px rgba(0,0,0,.5); max-width:300px; }
.tpl-phone-bar { background:#202c33; display:flex; align-items:center; gap:10px; padding:10px 14px; }
.tpl-phone-avatar { width:34px; height:34px; border-radius:50%; background:var(--accent); display:flex; align-items:center; justify-content:center; font-weight:700; color:#fff; font-size:13px; }
.tpl-phone-body { padding:12px; background:#0b141a; min-height:100px; }
.tpl-bubble { background:#202c33; border-radius:10px 10px 10px 2px; padding:10px 13px; max-width:260px; }
.tpl-prev-body { font-size:13px; color:#e9edef; line-height:1.5; white-space:pre-wrap; }
.tpl-prev-footer { font-size:11px; color:#8696a0; margin-top:6px; }
.tpl-prev-footer.hide { display:none; }
.tpl-prev-btns { margin-top:8px; border-top:1px solid rgba(255,255,255,.1); padding-top:8px; }
.tpl-prev-btns.hide { display:none; }
.tpl-prev-btn { font-size:12px; color:#53bdeb; text-align:center; padding:5px 0; border-top:1px solid rgba(255,255,255,.06); }
.tpl-prev-btn:first-child { border-top:0; }
.tpl-prev-header { overflow:hidden; border-radius:6px; margin-bottom:8px; }
.tpl-prev-header-img { width:100%; height:120px; object-fit:cover; border-radius:6px; display:block; background:rgba(255,255,255,.06); background-size:cover; background-position:center; }
.tpl-prev-header-text { background:rgba(255,255,255,.08); border-radius:6px; padding:8px 10px; font-weight:600; font-size:13px; color:#e9edef; }
.tpl-prev-header-icon { background:rgba(255,255,255,.06); border-radius:6px; padding:14px; text-align:center; font-size:28px; }
.tpl-card { margin-bottom:12px; }
.tpl-card-top { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:8px; }
.tpl-name { font-weight:700; font-size:14px; }
.tpl-meta { font-size:11.5px; color:var(--muted); margin-top:3px; }
.tpl-actions { display:flex; gap:6px; flex-shrink:0; }
.tpl-body-preview { font-size:12.5px; color:var(--muted); white-space:pre-wrap; line-height:1.5; max-height:60px; overflow:hidden; }
.tpl-status { border-radius:5px; padding:2px 8px; font-size:10.5px; font-weight:700; }
.tpl-status-approved { background:rgba(52,211,153,.16); color:#6ee7b7; }
.tpl-status-rejected { background:rgba(246,113,110,.16); color:#fca5a5; }
.tpl-status-pending { background:rgba(245,185,72,.16); color:#fbd474; }
/* template card sub-elements (Eduventures layout) */
.tpl-card-name { font-weight:700; font-size:14px; }
.tpl-card-meta { font-size:11.5px; color:var(--muted); margin-top:3px; }
.tpl-card-body { font-size:12.5px; color:var(--muted); white-space:pre-wrap; line-height:1.5; max-height:80px; overflow:hidden; margin:6px 0 4px; }
.tpl-card-footer { font-size:11px; color:var(--muted); opacity:.7; margin-top:4px; font-style:italic; }
.tpl-card-btns { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; padding-top:8px; border-top:1px solid var(--line); }
.tpl-card-btn { font-size:11.5px; border-radius:5px; padding:3px 10px; font-weight:500; }
.tpl-card-btn.qr { background:rgba(79,104,247,.13); color:var(--accent); }
.tpl-card-btn.cta { background:rgba(52,211,153,.12); color:#6ee7b7; }
/* interactive actions (radio-button layout) */
.tpl-ia-radios { display:flex; flex-wrap:wrap; gap:10px; margin:10px 0 4px; }
.tpl-ia-radio { display:flex; align-items:center; gap:5px; font-size:13px; cursor:pointer; }
.tpl-ia-radio input { accent-color:var(--accent); }
.tpl-ia-body { margin-top:14px; }
.tpl-ia-section { margin-bottom:14px; }
.tpl-ia-title { font-weight:600; font-size:13px; margin-bottom:4px; }
.tpl-ia-cap { font-weight:400; font-size:11px; color:var(--muted); }
.tpl-ia-subtitle { font-size:12px; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin-bottom:6px; }
.tpl-ia-add { display:inline-flex; align-items:center; gap:5px; font-size:12px; padding:5px 12px; border-radius:7px; background:rgba(79,104,247,.1); color:var(--accent); border:1px dashed var(--accent); cursor:pointer; margin-top:6px; transition:background .15s; }
.tpl-ia-add:hover { background:rgba(79,104,247,.18); }
/* button row / delete button inside template editor */
.tpl-btn-list { display:flex; flex-direction:column; gap:6px; }
.tpl-btn-del { background:none; border:none; color:var(--muted); font-size:14px; cursor:pointer; padding:0 4px; flex-shrink:0; transition:color .12s; }
.tpl-btn-del:hover { color:var(--danger); }
/* variable chip row */
.tpl-var-row { display:flex; flex-wrap:wrap; gap:5px; margin:8px 0 6px; }

/* ===== WA INBOX ===== */
.wai-layout { display:grid; grid-template-columns:280px 1fr; gap:0; height:calc(100vh - 120px); min-height:400px; border:1px solid var(--line); border-radius:12px; overflow:hidden; }
.wai-sidebar { border-right:1px solid var(--line); display:flex; flex-direction:column; overflow:hidden; }
.wai-sidebar-head { padding:14px 14px 8px; border-bottom:1px solid var(--line); }
.wai-sidebar-head h3 { margin:0 0 8px; font-size:14px; }
.wai-list { flex:1; overflow-y:auto; }
.wai-item { display:flex; gap:10px; align-items:flex-start; padding:11px 14px; border-bottom:1px solid var(--line); cursor:pointer; transition:background .12s; }
.wai-item:hover, .wai-item.active { background:rgba(79,104,247,.1); }
.wai-item-avatar { width:36px; height:36px; border-radius:50%; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; flex-shrink:0; }
.wai-item-body { flex:1; min-width:0; }
.wai-item-top { display:flex; justify-content:space-between; gap:6px; }
.wai-item-name { font-weight:600; font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wai-item-time { font-size:10.5px; color:var(--muted); flex-shrink:0; }
.wai-item-preview { font-size:11.5px; color:var(--muted); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wai-conv-badge { display:inline-block; font-size:9.5px; font-weight:700; border-radius:5px; padding:2px 7px; margin-top:4px; text-transform:uppercase; letter-spacing:.04em; }
.wai-chat-panel { display:flex; flex-direction:column; overflow:hidden; }
.wai-chat-header { display:flex; align-items:center; gap:10px; padding:10px 14px; background:rgba(255,255,255,.04); border-bottom:1px solid var(--line); }
.wai-empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; flex:1; color:var(--muted); }
.wai-loading { display:flex; align-items:center; justify-content:center; flex:1; color:var(--muted); }

/* ===== BROADCAST ===== */
.bc-steps { display:flex; margin-bottom:20px; border-radius:8px; overflow:hidden; border:1px solid var(--line); }
.bc-step { flex:1; text-align:center; padding:8px 4px; font-size:12px; border-bottom:2px solid var(--line); color:var(--muted); }
.bc-step.active { border-bottom-color:var(--accent); color:var(--accent); }
.bc-step.done { border-bottom-color:var(--good); color:var(--good); }
.bc-badge { display:inline-block; font-size:10.5px; font-weight:700; border-radius:5px; padding:2px 9px; text-transform:uppercase; letter-spacing:.04em; }
.bc-draft { background:rgba(148,163,184,.14); color:#94a3b8; }
.bc-sending { background:rgba(245,185,72,.16); color:#fbd474; }
.bc-paused { background:rgba(245,185,72,.1); color:#fbd474; }
.bc-done { background:rgba(52,211,153,.14); color:#6ee7b7; }
.bc-cancelled { background:rgba(246,113,110,.12); color:#fca5a5; }
.bc-card { margin-bottom:14px; }
.bc-card-top { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:10px; }
.bc-name { font-weight:700; font-size:14px; }
.bc-meta { font-size:11.5px; color:var(--muted); margin-top:3px; }
.bc-stats { display:flex; gap:0; border-top:1px solid var(--line); margin-top:10px; padding-top:10px; }
.bc-stat { flex:1; text-align:center; }
.bc-stat-n { font-size:18px; font-weight:700; color:var(--accent); }
.bc-stat-l { font-size:10.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; margin-top:2px; }
.bc-progress { height:5px; background:rgba(255,255,255,.07); border-radius:4px; margin-top:10px; overflow:hidden; }
.bc-progress-bar { height:100%; background:linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius:4px; transition:width .4s; }

/* ===== KEYWORDS ===== */
.kw-card { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:14px 16px; margin-bottom:10px; }
.kw-card-top { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; flex-wrap:wrap; }
.kw-tag { background:rgba(79,104,247,.18); color:var(--accent); border-radius:6px; padding:3px 10px; font-weight:700; font-size:13px; font-family:monospace; }
.kw-match-type { font-size:11.5px; color:var(--muted); background:rgba(255,255,255,.06); border-radius:5px; padding:2px 8px; margin-left:6px; }
.kw-status { font-size:10.5px; font-weight:700; border-radius:5px; padding:2px 8px; text-transform:uppercase; margin-left:6px; }
.kw-on { background:rgba(52,211,153,.14); color:#6ee7b7; }
.kw-off { background:rgba(255,255,255,.06); color:var(--muted); }
.kw-reply { background:rgba(255,255,255,.04); border-radius:6px; padding:8px 12px; font-size:12.5px; color:var(--muted); white-space:pre-wrap; margin:0; line-height:1.5; overflow:hidden; max-height:80px; }

/* ===== UPLOAD AREA ===== */
.upload-area { width:100%; }
.upload-zone { border:2px dashed var(--line); border-radius:10px; padding:20px; text-align:center; cursor:pointer; transition:border-color .15s, background .15s; }
.upload-zone:hover, .upload-zone-over { border-color:var(--accent); background:rgba(79,104,247,.06); }
.upload-drop-label { color:var(--muted); font-size:13px; }
.upload-thumb { margin-top:8px; }
.upload-name { font-size:12px; color:var(--muted); display:block; margin-top:4px; }

/* ===== MEDIA LIBRARY ===== */
.media-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(130px, 1fr)); gap:12px; }
.media-card { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:12px; text-align:center; }
.media-icon { font-size:32px; margin-bottom:6px; }
.media-name { font-size:11.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin-bottom:3px; }
.media-type { font-size:10.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; margin-bottom:8px; }

/* ===== WA REPORTS ===== */
.rep-stats-row { display:flex; gap:12px; flex-wrap:wrap; }
.rep-stat-card { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:16px 20px; min-width:100px; flex:1; }
.rep-stat-n { font-size:26px; font-weight:700; color:var(--accent); }
.rep-stat-l { font-size:11.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; margin-top:3px; }
.rep-stat-note { font-size:11px; color:var(--good); margin-top:3px; }

@media (max-width: 820px) {
  .tpl-layout { grid-template-columns: 1fr; }
  .tpl-preview-col { display: none; }
  .wai-layout { grid-template-columns: 1fr; height: auto; }
  .wai-sidebar { max-height: 280px; }
}

/* ===== FEES DEPARTMENT MODULE ===== */
.fd-tabs { display:flex; gap:0; border-bottom:1px solid var(--line); margin-bottom:18px; }
.fd-tab { padding:9px 18px; font-size:13px; font-weight:500; color:var(--muted); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; transition:color .15s; }
.fd-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.fd-tab:hover:not(.active) { color:var(--ink); }
.fd-reminder-block { border-radius:10px; padding:12px 14px; margin-bottom:12px; }
.fd-reminder-block.overdue { background:rgba(246,113,110,.08); border:1px solid rgba(246,113,110,.22); }
.fd-reminder-block.today { background:rgba(245,185,72,.08); border:1px solid rgba(245,185,72,.22); }
.fd-reminder-block.tomorrow { background:rgba(56,189,248,.08); border:1px solid rgba(56,189,248,.22); }
.fd-reminder-title { font-weight:700; font-size:12.5px; margin-bottom:8px; }
.fd-reminder-block.overdue .fd-reminder-title { color:var(--bad); }
.fd-reminder-block.today .fd-reminder-title { color:var(--warn); }
.fd-reminder-block.tomorrow .fd-reminder-title { color:var(--info); }
.fd-inst-row { display:flex; align-items:center; gap:8px; padding:6px 0; border-bottom:1px solid var(--line); font-size:12.5px; }
.fd-inst-row:last-child { border-bottom:none; }
.fd-inst-num { width:22px; height:22px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; }
.fd-inst-num.paid { background:rgba(52,211,153,.15); color:var(--good); }
.fd-inst-num.pending { background:rgba(91,139,255,.15); color:var(--accent); }
.fd-inst-num.overdue { background:rgba(246,113,110,.15); color:var(--bad); }
.fd-plan-badge { font-size:10.5px; font-weight:600; padding:2px 7px; border-radius:20px; }
.fd-plan-badge.paid { background:rgba(52,211,153,.15); color:var(--good); }
.fd-plan-badge.pending { background:rgba(91,139,255,.12); color:var(--accent); }
.fd-plan-badge.overdue { background:rgba(246,113,110,.12); color:var(--bad); }
.fd-plan-progress { height:5px; border-radius:3px; background:var(--line); overflow:hidden; min-width:60px; }
.fd-plan-progress-bar { height:100%; background:var(--good); border-radius:3px; transition:width .3s; }
.fd-receipt-row { display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--line); font-size:12.5px; }
.fd-receipt-row:last-child { border-bottom:none; }
.fd-receipt-num { font-weight:700; font-size:12px; color:var(--accent); min-width:120px; }
.fd-receipt-file-icon { font-size:18px; }
.fd-section-hd { font-weight:700; font-size:13px; color:var(--head); margin:16px 0 8px; padding-bottom:6px; border-bottom:1px solid var(--line); }
