/* TALNEXQ Campaigns — dark "QI" theme matching talnexq.com */
@font-face { font-family: 'Archivo'; src: url('archivo-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #050b18;
  --bg2: #071225;
  --panel: #0b1a2f;
  --panel2: #0f2139;
  --raised: #132a46;
  --line: rgba(120, 180, 230, 0.16);
  --line2: rgba(120, 180, 230, 0.28);
  --ink: #eef6ff;
  --ink2: #b9cce2;
  --muted: #7f97b4;
  --cyan: #7be7ff;
  --blue: #53b8ff;
  --violet: #c2a0ff;
  --green: #5ef2a8;
  --amber: #ffc46b;
  --red: #ff6b81;
  --grad: linear-gradient(105deg, #8bf4ff 0%, #53b8ff 52%, #c2a0ff 100%);
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --font: 'Archivo', Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body { background: radial-gradient(1200px 700px at 15% -10%, rgba(41, 183, 255, 0.12), transparent 60%), radial-gradient(900px 600px at 110% 110%, rgba(124, 92, 255, 0.12), transparent 60%), var(--bg); }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
.linklike { background: none; border: 0; padding: 0; color: var(--cyan); cursor: pointer; font-weight: 600; }
.linklike:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(83, 184, 255, 0.35); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow: auto; padding: 18px 14px; background: linear-gradient(180deg, rgba(8, 20, 38, 0.96), rgba(5, 12, 26, 0.98)); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand img { width: 38px; height: 36px; filter: drop-shadow(0 0 10px rgba(107, 223, 255, 0.45)); }
.brand .w { font-weight: 800; font-size: 19px; letter-spacing: -0.05em; line-height: 1; }
.brand .w span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand small { display: block; font-size: 10.5px; letter-spacing: 0.22em; color: var(--ink2); margin-top: 5px; font-weight: 700; }
.nav-h { font-size: 11px; letter-spacing: 0.18em; color: var(--muted); font-weight: 700; padding: 14px 10px 6px; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--ink2); font-weight: 600; font-size: 14.5px; }
.nav a:hover { background: rgba(123, 231, 255, 0.06); text-decoration: none; color: var(--ink); }
.nav a.on { background: linear-gradient(90deg, rgba(83, 184, 255, 0.18), rgba(194, 160, 255, 0.08)); color: #fff; box-shadow: inset 2px 0 0 var(--cyan); }
.nav a .ic { color: var(--muted); }
.nav a.on .ic { color: var(--cyan); }
.side .foot { margin-top: auto; padding: 12px 8px 2px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: rgba(5, 11, 24, 0.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .grow { flex: 1; }
.page { padding: 26px 28px 60px; max-width: 1320px; width: 100%; }
.page-h { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-h h1 { margin: 0; font-size: 28px; letter-spacing: -0.03em; line-height: 1.15; }
.page-h p { margin: 4px 0 0; color: var(--ink2); }
.page-h .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- surfaces ---------- */
.card { background: linear-gradient(180deg, rgba(17, 38, 64, 0.72), rgba(11, 26, 47, 0.86)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 17px; letter-spacing: -0.01em; }
.card .sub { color: var(--ink2); margin: -6px 0 14px; font-size: 14px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.subject-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.sp { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; }
.ok { color: var(--green); }
.warn { color: var(--amber); }
.bad { color: var(--red); }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- KPI ---------- */
.kpi { padding: 16px 18px; }
.kpi .l { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kpi .v { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; margin-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 13px; color: var(--ink2); margin-top: 4px; }
.kpi.hl .v { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.04); color: var(--ink); font-weight: 650; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s, transform 0.05s; }
.btn:hover { background: rgba(123, 231, 255, 0.08); border-color: rgba(123, 231, 255, 0.45); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.pri { background: var(--grad); color: #04182c; border: 0; box-shadow: 0 8px 24px rgba(83, 184, 255, 0.25); }
.btn.pri:hover { filter: brightness(1.06); }
.btn.danger { border-color: rgba(255, 107, 129, 0.5); color: #ffd1d8; }
.btn.danger:hover { background: rgba(255, 107, 129, 0.12); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.ic { display: inline-block; flex: none; vertical-align: -3px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-weight: 650; font-size: 13.5px; color: var(--ink2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, input.input, select.input, textarea.input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(3, 10, 22, 0.55); color: var(--ink); outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.input:focus { border-color: rgba(123, 231, 255, 0.7); box-shadow: 0 0 0 3px rgba(83, 184, 255, 0.18); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; color: var(--ink2); }
.check input { margin-top: 3px; accent-color: var(--blue); width: 16px; height: 16px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); position: relative; cursor: pointer; transition: background 0.15s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked { background: var(--blue); }
.switch input:checked::after { transform: translateX(16px); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(9, 22, 40, 0.6); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); white-space: nowrap; }
.t td { padding: 11px 14px; border-bottom: 1px solid rgba(120, 180, 230, 0.08); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: rgba(123, 231, 255, 0.04); }
.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.t .name { font-weight: 650; color: var(--ink); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--line2); color: var(--ink2); background: rgba(255, 255, 255, 0.04); white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge.green { color: var(--green); border-color: rgba(94, 242, 168, 0.35); background: rgba(94, 242, 168, 0.08); }
.badge.blue { color: var(--cyan); border-color: rgba(123, 231, 255, 0.35); background: rgba(123, 231, 255, 0.08); }
.badge.amber { color: var(--amber); border-color: rgba(255, 196, 107, 0.35); background: rgba(255, 196, 107, 0.08); }
.badge.red { color: var(--red); border-color: rgba(255, 107, 129, 0.35); background: rgba(255, 107, 129, 0.08); }
.badge.violet { color: var(--violet); border-color: rgba(194, 160, 255, 0.35); background: rgba(194, 160, 255, 0.08); }
.badge.live::before { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 7px; font-size: 12px; background: rgba(123, 231, 255, 0.08); color: var(--ink2); border: 1px solid var(--line); }

/* ---------- notes ---------- */
.note { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(83, 184, 255, 0.07); color: var(--ink2); font-size: 14px; }
.note .ic { margin-top: 2px; color: var(--cyan); }
.note.amber { border-color: rgba(255, 196, 107, 0.4); background: rgba(255, 196, 107, 0.07); }
.note.amber .ic { color: var(--amber); }
.note.red { border-color: rgba(255, 107, 129, 0.45); background: rgba(255, 107, 129, 0.08); }
.note.red .ic { color: var(--red); }
.note.green { border-color: rgba(94, 242, 168, 0.4); background: rgba(94, 242, 168, 0.07); }
.note.green .ic { color: var(--green); }

/* ---------- progress ---------- */
.bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--grad); box-shadow: 0 0 16px rgba(83, 184, 255, 0.5); }
.bar.thin { height: 6px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 650; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--cyan); }
.steps { display: flex; gap: 8px; }
.steps button { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); color: var(--ink2); font-weight: 650; cursor: pointer; }
.steps button b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); font-size: 12px; }
.steps button.on { border-color: rgba(123, 231, 255, 0.55); color: #fff; background: rgba(83, 184, 255, 0.1); }
.steps button.on b { background: var(--grad); color: #04182c; }

/* ---------- modal / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(1, 5, 14, 0.66); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fade 0.15s; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: linear-gradient(180deg, #10233d, #0b1a2f); border: 1px solid var(--line2); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; }
.modal.wide { width: min(880px, 100%); }
.modal h2 { margin: 0 0 6px; font-size: 20px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 12px 16px; border-radius: 12px; background: #13294a; border: 1px solid var(--line2); box-shadow: var(--shadow); max-width: 380px; font-weight: 600; animation: fade 0.2s; }
.toast.bad { border-color: rgba(255, 107, 129, 0.6); }

/* ---------- empty / misc ---------- */
.empty { text-align: center; padding: 50px 20px; color: var(--ink2); }
.empty h3 { color: var(--ink); margin: 12px 0 6px; font-size: 18px; }
.empty .ic { color: var(--cyan); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(123, 231, 255, 0.2); border-top-color: var(--cyan); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { display: grid; place-items: center; min-height: 40vh; }
.copybox { display: flex; gap: 8px; align-items: stretch; }
.copybox code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 9px 11px; border-radius: 9px; background: rgba(3, 10, 22, 0.7); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink2); }
.pill-tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.pill-tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 650; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.pill-tabs button.on { background: rgba(123, 231, 255, 0.14); color: var(--ink); }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .box { width: min(430px, 100%); }
.auth .logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth .logo img { width: 74px; height: 70px; filter: drop-shadow(0 0 22px rgba(107, 223, 255, 0.55)); }
.auth .logo .w { font-size: 30px; font-weight: 800; letter-spacing: -0.06em; }
.auth .logo .w span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- campaign editor ---------- */
.editor { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.blocks { display: flex; flex-direction: column; gap: 8px; }
.block-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); cursor: pointer; }
.block-item:hover { border-color: var(--line2); }
.block-item.on { border-color: rgba(123, 231, 255, 0.6); background: rgba(83, 184, 255, 0.1); }
.block-item .t1 { font-weight: 650; font-size: 13.5px; }
.block-item .t2 { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.add-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.add-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 10px; border: 1px dashed var(--line2); background: transparent; color: var(--ink2); font-size: 11.5px; font-weight: 650; cursor: pointer; }
.add-grid button:hover { border-color: var(--cyan); color: var(--ink); }
.preview { border-radius: 16px; overflow: hidden; background: #e9eef5; border: 1px solid var(--line); }
.preview .bar2 { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #0d1d33; border-bottom: 1px solid var(--line); }
.preview .bar2 .subj { font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview iframe { display: block; width: 100%; height: 760px; border: 0; background: #fff; margin: 0 auto; transition: width 0.2s; }
.preview.mobile iframe { width: 390px; }
.hints { display: flex; flex-direction: column; gap: 8px; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .editor { grid-template-columns: 260px minmax(0, 1fr); } .editor .props { grid-column: 1 / -1; } .g6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: 0; width: 260px; transform: translateX(-100%); transition: transform 0.2s; }
  .side.open { transform: none; }
  .g2, .g3, .g4, .split, .subject-grid { grid-template-columns: 1fr; }
  .top .hide-sm { display: none; }
  .rhead { flex-wrap: wrap !important; }
  .rhead > .sp, .rhead > input { flex: 1 1 calc(100% - 60px) !important; max-width: none !important; }
  .top select.input { min-width: 0 !important; flex: 1; }
  .page-h .actions { margin-left: 0; }
  .col[style*="sticky"], .props[style*="sticky"] { position: static !important; }
  .g6 { grid-template-columns: repeat(2, 1fr); }
  .editor { grid-template-columns: 1fr; }
  .page { padding: 20px 16px 50px; }
  .top { padding: 10px 16px; }
}
@media (min-width: 901px) { .menu-btn { display: none; } }
