/* Rocky's Premium Hub – admin dashboard (dark premium theme) */
:root {
  --bg: #0b0d14;
  --bg2: #10131d;
  --panel: #151926;
  --panel2: #1b2031;
  --line: #262c40;
  --line2: #323a54;
  --text: #e8eaf3;
  --muted: #8d94ad;
  --accent: #8b5cf6;
  --accent2: #c084fc;
  --gold: #f5c76b;
  --blue: #3e8ef7;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 100% -10%, rgba(139, 92, 246, 0.12), transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, 'Segoe UI', system-ui, -apple-system, 'Noto Sans Sinhala', 'Iskoola Pota', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 24px; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
h4 { font-size: 15px; }
p { margin: 4px 0; }
code, .mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
code { background: rgba(139, 92, 246, 0.14); padding: 1px 5px; border-radius: 5px; color: #d8c8ff; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.center { text-align: center; }
.right { text-align: right; white-space: nowrap; }
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%; }

/* ---------- form controls ---------- */
input, textarea, select {
  width: 100%;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  font: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 60px; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18); }
input[type='checkbox'] { width: auto; }
input::placeholder, textarea::placeholder { color: #5d6480; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--line2); border-radius: 9px;
  padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  text-decoration: none !important;
}
.btn:hover { background: #232a40; border-color: #414b6b; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.primary { background: linear-gradient(135deg, #8b5cf6, #6d28d9); border-color: #7c3aed; color: #fff; }
.btn.primary:hover { background: linear-gradient(135deg, #9b6cff, #7c3aed); }
.btn.success { background: linear-gradient(135deg, #22c55e, #15803d); border-color: #16a34a; color: #fff; }
.btn.danger { background: linear-gradient(135deg, #ef4444, #b91c1c); border-color: #dc2626; color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.btn.ghost.danger { color: #ff8a8a; border-color: rgba(239, 68, 68, 0.4); background: transparent; }
.btn.ghost.danger:hover { background: rgba(239, 68, 68, 0.12); }
.icon-btn {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 15px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover:not(:disabled) { background: var(--panel2); color: var(--text); border-color: var(--line); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.sm { width: 26px; height: 26px; font-size: 13px; }
.icon-btn.danger:hover:not(:disabled) { color: #ff8a8a; background: rgba(239, 68, 68, 0.12); }
.link-btn { background: none; border: none; padding: 0; color: var(--accent2); cursor: pointer; font: inherit; font-size: 12px; }
.link-btn:hover { text-decoration: underline; }

/* toggle */
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { width: 38px; height: 22px; border-radius: 99px; background: #2b3149; position: relative; transition: background 0.15s; flex: none; }
.toggle .thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #c9cde0; transition: transform 0.15s, background 0.15s; }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track .thumb { transform: translateX(16px); background: #fff; }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.35); }
.toggle.sm .track { width: 30px; height: 18px; }
.toggle.sm .thumb { width: 12px; height: 12px; }
.toggle.sm input:checked + .track .thumb { transform: translateX(12px); }
.toggle-label { font-size: 13.5px; }
.toggle.sm .toggle-label { font-size: 12.5px; color: var(--muted); }

/* segmented control */
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg.disabled { opacity: 0.45; }
.seg-btn { background: transparent; border: none; color: var(--muted); padding: 5px 12px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }
.seg-btn.c-primary.on { background: var(--blue); color: #fff; box-shadow: none; }
.seg-btn.c-success.on { background: var(--green); color: #fff; box-shadow: none; }
.seg-btn.c-danger.on { background: var(--red); color: #fff; box-shadow: none; }
.seg.small .seg-btn { padding: 4px 10px; font-size: 12px; }

/* layout helpers */
.row { display: flex; align-items: center; }
.row.gap, .gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.sm { gap: 9px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-2.tight { gap: 12px; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.editor-grid > :last-child { position: sticky; top: 18px; }
.modal .editor-grid { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 1100px) {
  .editor-grid, .modal .editor-grid { grid-template-columns: 1fr; }
  .editor-grid > :last-child { position: static; }
}
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- app shell ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: rgba(16, 19, 29, 0.92); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.brand b { display: block; font-size: 14.5px; }
.brand small { color: var(--muted); font-size: 12px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(245, 199, 107, 0.25)); border: 1px solid rgba(192, 132, 252, 0.35);
}
.brand.big { padding: 0 0 22px; }
.brand.big .brand-logo { width: 46px; height: 46px; font-size: 24px; }
.brand.big b { font-size: 17px; }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; color: #b8bdd3;
  font-weight: 550; text-decoration: none !important;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.on { background: linear-gradient(90deg, rgba(139, 92, 246, 0.22), rgba(139, 92, 246, 0.06)); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav-icon { width: 22px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--amber); color: #1a1200; font-size: 11.5px; font-weight: 800; padding: 1px 8px; border-radius: 99px; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); font-size: 12.5px; }
.content { min-width: 0; }
.page { padding: 28px 32px 60px; max-width: 1480px; }
.topbar { display: none; }
.scrim { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform 0.2s; }
  .menu-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 30; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); position: sticky; top: 0; z-index: 20; }
  .page { padding: 18px 14px 50px; }
}

/* page head */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { max-width: 720px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back-link { display: inline-block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }

/* section / field */
.section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.stack > .section { margin-bottom: 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.section-head p { font-size: 12.5px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field-label { font-size: 12.5px; font-weight: 650; color: #c3c8dc; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; }

/* alerts, badges, chips */
.alert { background: rgba(62, 142, 247, 0.08); border: 1px solid rgba(62, 142, 247, 0.28); border-radius: 10px; padding: 11px 14px; margin-bottom: 18px; font-size: 13px; line-height: 1.7; }
.alert.warn { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.32); }
.alert.err { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.35); color: #ffb4b4; margin: 12px 0 0; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; white-space: nowrap; border: 1px solid transparent; text-decoration: none !important; }
.badge.gray { background: rgba(141, 148, 173, 0.14); color: #b9bfd6; border-color: rgba(141, 148, 173, 0.25); }
.badge.amber { background: rgba(245, 158, 11, 0.15); color: #fcd27b; border-color: rgba(245, 158, 11, 0.35); }
.badge.green { background: rgba(34, 197, 94, 0.14); color: #7ee2a3; border-color: rgba(34, 197, 94, 0.32); }
.badge.red { background: rgba(239, 68, 68, 0.14); color: #ff9c9c; border-color: rgba(239, 68, 68, 0.32); }
.chip { display: inline-block; background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 0 7px; font-size: 12px; margin: 0 4px 4px 0; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.color-dot.primary { background: var(--blue); }
.color-dot.success { background: var(--green); }
.color-dot.danger { background: var(--red); }

/* loading & empty */
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 30px 4px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--accent); animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { border: 1px dashed var(--line2); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.login-card .btn { margin-top: 14px; padding: 11px; }
.pw-row { position: relative; display: flex; }
.pw-row input { flex: 1; padding-right: 44px; }
.login-card .pw-row .pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); margin: 0; padding: 4px 8px; background: transparent; border: 0; cursor: pointer; font-size: 16px; line-height: 1; }

/* overview */
.bot-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; }
.bot-strip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15); }
.bot-strip.ok .dot { background: var(--green); box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--text); text-decoration: none !important; }
a.stat:hover { border-color: var(--line2); background: var(--panel2); }
.stat.amber { border-color: rgba(245, 158, 11, 0.45); box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.15); }
.stat-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--bg2); font-size: 20px; flex: none; }
.stat-value { font-size: 19px; font-weight: 750; }
.checklist { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist li.ok span:last-child { color: var(--muted); }

/* tables */
.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.search { max-width: 340px; }
.page > div > .search { margin-bottom: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.section .table-wrap { border: none; background: transparent; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table td.mono { white-space: nowrap; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: rgba(139, 92, 246, 0.06); }
.list-foot { margin-top: 12px; }
.muted-item { opacity: 0.6; }

/* tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.toolbar .tabs { margin-bottom: 0; border-bottom: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.tab { background: transparent; border: none; color: var(--muted); padding: 8px 12px; cursor: pointer; font: inherit; font-weight: 600; border-radius: 8px; }
.tab:hover { color: var(--text); background: var(--panel2); }
.tab.on { color: #fff; background: rgba(139, 92, 246, 0.25); }

/* lists (categories, products, methods) */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; flex-wrap: wrap; }
.list-item:hover { border-color: var(--line2); }
.li-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; color: var(--text); text-decoration: none !important; overflow: hidden; }
.li-main.plain { background: none; border: none; text-align: left; font: inherit; cursor: pointer; padding: 0; }
.li-main b { font-size: 14.5px; }
.li-toggles { display: flex; flex-direction: column; gap: 4px; }
.reorder { display: flex; flex-direction: column; }
.thumb { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: var(--bg2); border: 1px solid var(--line); display: grid; place-items: center; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* modal */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(4, 6, 12, 0.72); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); animation: pop 0.15s ease-out; }
.modal.wide { max-width: 1080px; }
@keyframes pop { from { transform: translateY(8px) scale(0.99); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); border-radius: 0 0 16px 16px; }

/* orders */
.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
@media (max-width: 800px) { .order-grid { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0 0 18px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }
.decide { display: flex; flex-direction: column; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.decide .field { margin-bottom: 0; }
.receipt { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.receipt img { max-width: 100%; max-height: 70vh; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.receipt.empty { color: var(--muted); border: 1px dashed var(--line2); border-radius: 10px; padding: 30px; align-items: center; justify-content: center; }
.receipt-pdf { width: 100%; height: 60vh; border-radius: 10px; border: 1px solid var(--line); background: #fff; }

/* emoji field */
.emoji-field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.emoji-field.off .ef-preview, .emoji-field.off .ef-id, .emoji-field.off .ef-fb { opacity: 0.4; }
.ef-preview { width: 38px; height: 38px; border-radius: 9px; background: var(--bg2); border: 1px solid var(--line); display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.ef-preview:hover { border-color: var(--accent); }
.ef-id { flex: 1 1 110px; min-width: 90px; }
.ef-fb { width: 64px !important; flex: none; text-align: center; }
.emoji-img { display: inline-block; vertical-align: middle; object-fit: contain; }
.emoji-fb { display: inline-flex; align-items: center; justify-content: center; line-height: 1; vertical-align: middle; }

/* button editor */
.btn-editor { display: flex; flex-direction: column; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.be-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; align-items: center; }
.be-key { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.button-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
@media (max-width: 600px) { .button-cards { grid-template-columns: 1fr; } .be-row { grid-template-columns: 1fr; gap: 4px; } }
.button-card { display: flex; flex-direction: column; gap: 8px; }
.bc-title { display: flex; justify-content: space-between; font-weight: 650; }

/* bilingual input */
.bi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
@media (max-width: 700px) { .bi { grid-template-columns: 1fr; } }
.bi-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bi-tag { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }

/* image field */
.image-field { display: flex; gap: 14px; align-items: flex-start; }
.if-thumb { width: 120px; height: 90px; border-radius: 10px; overflow: hidden; background: var(--bg2); border: 1px dashed var(--line2); display: grid; place-items: center; color: var(--muted); font-size: 12px; flex: none; }
.if-thumb img, .if-thumb video { width: 100%; height: 100%; object-fit: cover; }
.if-controls { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* product editor */
.features { display: flex; flex-direction: column; gap: 10px; }
.feature { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.feature-head { display: flex; justify-content: space-between; align-items: center; }
.price-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 700px) { .price-row { grid-template-columns: 1fr; } }
.save-bar { position: sticky; bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: rgba(21, 25, 38, 0.95); border: 1px solid var(--line2); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }

/* messages */
.msg-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.msg-card.focus { border-color: rgba(139, 92, 246, 0.55); }
.msg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.vars { display: flex; flex-wrap: wrap; }

/* ---------- Telegram preview ---------- */
.preview-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.pp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 650; font-size: 13px; }
.tg-phone {
  background: #0e1621 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cg fill='%23ffffff' fill-opacity='.025'%3E%3Ccircle cx='10' cy='10' r='3'/%3E%3Ccircle cx='50' cy='40' r='2'/%3E%3Ccircle cx='25' cy='65' r='2.5'/%3E%3C/g%3E%3C/svg%3E");
  border-radius: 12px; padding: 14px 12px; min-height: 160px; transition: opacity 0.2s;
  font-family: -apple-system, 'Segoe UI', Roboto, 'Noto Sans Sinhala', sans-serif;
}
.tg-phone.is-loading { opacity: 0.6; }
.tg-empty { color: var(--muted); text-align: center; padding: 50px 0; }
.tg-msg { background: #182533; border-radius: 12px 12px 12px 4px; overflow: hidden; max-width: 100%; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.tg-photo { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.tg-text { padding: 9px 12px 10px; white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.42; color: #f5f5f5; }
.tg-text b, .tg-text strong { font-weight: 700; }
.tg-text a { color: #6ab3f3; }
.tg-text code { background: rgba(255, 255, 255, 0.08); color: #8fd1ff; }
.tg-text blockquote { margin: 4px 0; padding: 3px 8px 3px 10px; border-left: 3px solid #6ab3f3; background: rgba(106, 179, 243, 0.1); border-radius: 4px; white-space: pre-wrap; }
.tg-text .spoiler { background: #405060; color: transparent; border-radius: 4px; }
.tg-text .spoiler:hover { color: inherit; background: transparent; }
.tg-text img.ce { width: 20px; height: 20px; vertical-align: -4px; object-fit: contain; }
.tg-kb { display: flex; flex-direction: column; gap: 5px; margin-top: 5px; }
.tg-kb.inline { margin-top: 0; }
.tg-row { display: flex; gap: 5px; }
.tgb {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px;
  background: rgba(40, 56, 74, 0.92); color: #fff; border-radius: 8px; padding: 6px 10px;
  font-size: 13.5px; font-weight: 550; text-align: center; position: relative; min-width: 0;
}
.tgb > span:not(.tgb-link) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tgb.primary { background: #3390ec; }
.tgb.success { background: #31b545; }
.tgb.danger { background: #e5484d; }
.tgb-link { position: absolute; top: 2px; right: 5px; font-size: 10px; opacity: 0.75; }
.be-row .tg-kb { max-width: 320px; }

/* emoji grid / picker */
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-top: 12px; max-height: 420px; overflow-y: auto; padding: 2px; }
.emoji-grid.big { max-height: none; }
.eg-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; cursor: pointer; color: var(--text); font: inherit; }
.eg-item:hover { border-color: var(--accent); }
.eg-item.saved { border-color: rgba(34, 197, 94, 0.45); }
.eg-item small { font-size: 10.5px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eg-main { background: none; border: none; color: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; padding: 0; font: inherit; }
.eg-del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 6px; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; opacity: 0; }
.eg-item:hover .eg-del { opacity: 1; }
.eg-del:hover { background: rgba(239, 68, 68, 0.2); color: #ff9c9c; }
.pack-head { margin-top: 14px; }

/* toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: #1d2335; border: 1px solid var(--line2); border-left: 4px solid var(--green); padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow); animation: pop 0.15s ease-out; }
.toast.err { border-left-color: var(--red); }

/* emoji library filter */
.emoji-filter { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.emoji-filter .search { max-width: none; width: 100%; }
.pack-chips { display: flex; gap: 6px; flex-wrap: wrap; max-height: 92px; overflow-y: auto; }
.pchip { background: var(--bg2); border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 4px 11px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pchip:hover { color: var(--text); border-color: var(--accent); }
.pchip.on { color: #fff; background: rgba(139, 92, 246, 0.25); border-color: rgba(139, 92, 246, 0.6); }

/* force join channels */
.ch-card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.ch-head { display: flex; align-items: center; gap: 10px; }
.ch-head > b { flex: 1; min-width: 0; }
.ch-card .field { margin: 0; }
.ch-card .badge { white-space: normal; }
