/* ════════════════════════════════════════════════════════════
   Ronthiq CRM — Enterprise Theme (kapareho ng Webhook Pro)
   ════════════════════════════════════════════════════════════ */

:root{
  --bg0:#0a0d14; --bg1:#0e1220; --surface:#121724; --surface2:#181f30; --surface3:#1e2639;
  --border:#232c40; --border2:#2e3a52;
  --text:#e9eef8; --text2:#9aa7bd; --text3:#64718a;
  --accent:#5b8cff; --accent2:#8b5cf6; --accent-soft:rgba(91,140,255,.12);
  --success:#34d399; --success-soft:rgba(52,211,153,.13);
  --warning:#fbbf24; --warning-soft:rgba(251,191,36,.12);
  --danger:#f87171; --danger-soft:rgba(248,113,113,.12);
  --radius:12px; --radius-sm:8px;
  --font:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --mono:ui-monospace,"JetBrains Mono","SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
  --shadow-2:0 8px 24px -8px rgba(0,0,0,.5);
}

*{ box-sizing:border-box; margin:0; padding:0; }
html,body{ height:100%; }
body{
  background:var(--bg0); color:var(--text); font-family:var(--font);
  font-size:14px; line-height:1.55; -webkit-font-smoothing:antialiased;
}
.hidden{ display:none !important; }
.mono{ font-family:var(--mono); }
.muted-sm{ font-size:11.5px; color:var(--text3); }
code{ font-family:var(--mono); font-size:12px; background:var(--surface2); padding:2px 6px; border-radius:5px; border:1px solid var(--border); }

::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-track{ background:transparent; }
::-webkit-scrollbar-thumb{ background:#2a3550; border-radius:8px; border:2px solid var(--bg0); }
::selection{ background:rgba(91,140,255,.35); }

button{ font-family:inherit; }
input, select, textarea{
  width:100%; background:var(--bg1); color:var(--text);
  border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:10px 12px; font-family:inherit; font-size:13.5px;
  transition:border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(91,140,255,.18); }
select{ appearance:none; background-image:linear-gradient(45deg,transparent 50%,var(--text3) 50%),linear-gradient(135deg,var(--text3) 50%,transparent 50%); background-position:calc(100% - 18px) 50%,calc(100% - 13px) 50%; background-size:5px 5px; background-repeat:no-repeat; padding-right:34px; }

/* ─────────── BUTTONS ─────────── */
.btn{
  display:inline-flex; align-items:center; gap:7px;
  background:var(--surface2); color:var(--text); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:9px 14px; font-size:13px; font-weight:600;
  cursor:pointer; white-space:nowrap; transition:background .15s, border-color .15s, transform .08s;
}
.btn svg{ width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }
.btn:hover{ background:var(--surface3); border-color:var(--border2); }
.btn:active{ transform:scale(.97); }
.btn.primary{ background:linear-gradient(135deg,#4f7ef7,#7a5cf0); border-color:transparent; color:#fff; box-shadow:0 4px 14px -4px rgba(91,140,255,.45); }
.btn.primary:hover{ filter:brightness(1.1); }
.btn.ghost{ background:transparent; border-color:transparent; color:var(--text2); }
.btn.ghost:hover{ background:var(--surface2); border-color:var(--border); color:var(--text); }
.btn.sm{ padding:6px 10px; font-size:12px; }
.btn.block{ width:100%; justify-content:center; }
.btn.armed{ background:var(--danger-soft); border-color:var(--danger); color:var(--danger); }

.field-label{ display:block; font-size:12px; color:var(--text2); margin:14px 0 6px; font-weight:600; }
.form-error{ color:var(--danger); font-size:12.5px; margin-top:10px; min-height:18px; }

/* ─────────── AUTH ─────────── */
.auth{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; padding:24px; overflow:hidden; }
.auth-bg{
  position:absolute; inset:0; z-index:-1;
  background:
    radial-gradient(600px 400px at 15% 10%, rgba(91,140,255,.14), transparent 60%),
    radial-gradient(700px 500px at 85% 85%, rgba(139,92,246,.13), transparent 60%), var(--bg0);
}
.auth-bg::after{
  content:""; position:absolute; inset:0;
  background-image:linear-gradient(rgba(255,255,255,.025) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.025) 1px,transparent 1px);
  background-size:44px 44px;
  mask-image:radial-gradient(ellipse at center,black 30%,transparent 75%);
  -webkit-mask-image:radial-gradient(ellipse at center,black 30%,transparent 75%);
}
.auth-card{
  position:relative; width:100%; max-width:400px;
  background:linear-gradient(180deg,var(--surface2),var(--surface));
  border:1px solid var(--border); border-radius:18px; padding:36px 32px;
  box-shadow:var(--shadow-2); animation:cardIn .45s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes cardIn{ from{ opacity:0; transform:translateY(14px) scale(.98);} to{ opacity:1; transform:none;} }
.auth-logo{
  width:58px; height:58px; margin:0 auto 16px; border-radius:16px;
  background:var(--surface3); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 8px 24px -8px rgba(91,140,255,.4);
}
.auth-logo svg{ width:32px; height:32px; }
.auth-card h1{ text-align:center; font-size:21px; letter-spacing:-.02em; }
.auth-sub{ text-align:center; color:var(--text3); font-size:12.5px; margin:6px 0 20px; }
.auth-note{ text-align:center; color:var(--text3); font-size:11.5px; margin-top:18px; line-height:1.5; }
.input-icon{ position:relative; }
.input-icon svg{ position:absolute; left:12px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--text3); fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.input-icon input{ padding-left:38px; }
.form-error.shake{ animation:shake .4s; }
@keyframes shake{ 0%,100%{ transform:translateX(0);} 20%{ transform:translateX(-6px);} 40%{ transform:translateX(6px);} 60%{ transform:translateX(-4px);} 80%{ transform:translateX(4px);} }

/* ─────────── LAYOUT ─────────── */
#app{ display:flex; min-height:100vh; }
.sidebar{
  width:236px; flex-shrink:0; display:flex; flex-direction:column;
  background:var(--bg1); border-right:1px solid var(--border);
  position:sticky; top:0; height:100vh;
}
.side-brand{ display:flex; align-items:center; gap:11px; padding:20px 18px 16px; border-bottom:1px solid var(--border); }
.brand-bolt{ width:34px; height:34px; border-radius:10px; flex-shrink:0; background:var(--surface2); padding:7px; border:1px solid var(--border); box-shadow:0 4px 12px -4px rgba(91,140,255,.35); }
.side-brand-txt{ display:flex; flex-direction:column; line-height:1.25; }
.side-name{ font-weight:700; font-size:14.5px; }
.side-host{ font-size:11px; color:var(--text3); font-family:var(--mono); }

.side-nav{ padding:12px 10px; display:flex; flex-direction:column; gap:4px; flex:1; }
.nav-item{
  display:flex; align-items:center; gap:10px; width:100%;
  background:none; border:none; border-radius:var(--radius-sm);
  color:var(--text2); font-size:13.5px; font-weight:600;
  padding:10px 12px; cursor:pointer; text-align:left; position:relative;
  transition:background .15s, color .15s;
}
.nav-item svg{ width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }
.nav-item:hover{ background:var(--surface2); color:var(--text); }
.nav-item.active{ background:linear-gradient(90deg,var(--accent-soft),transparent); color:var(--text); }
.nav-item.active::before{ content:""; position:absolute; left:-10px; top:8px; bottom:8px; width:3px; background:linear-gradient(180deg,var(--accent),var(--accent2)); border-radius:3px; }
.nav-item.active svg{ color:var(--accent); }
.nav-badge{
  margin-left:auto; font-size:10.5px; font-weight:700; color:var(--text);
  background:var(--surface3); border:1px solid var(--border2); border-radius:20px;
  padding:1px 8px; min-width:24px; text-align:center;
}
.nav-item.active .nav-badge{ background:var(--accent-soft); border-color:rgba(91,140,255,.4); color:var(--accent); }

.side-foot{ padding:14px 18px; border-top:1px solid var(--border); display:flex; flex-direction:column; gap:12px; }
.phase-tag{
  font-size:10px; font-weight:800; letter-spacing:.12em; color:var(--accent2);
  background:rgba(139,92,246,.12); border:1px solid rgba(139,92,246,.3);
  border-radius:6px; padding:4px 8px; text-align:center; text-transform:uppercase;
}

.main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between; gap:14px;
  padding:14px 24px; background:rgba(10,13,20,.85); backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border);
}
.page-title{ font-size:17px; font-weight:700; letter-spacing:-.02em; }
.topbar-actions{ display:flex; align-items:center; gap:10px; }
.searchbox{ position:relative; display:flex; align-items:center; width:260px; }
.searchbox svg{ position:absolute; left:11px; width:15px; height:15px; color:var(--text3); fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; }
.searchbox input{ padding:8px 14px 8px 34px; font-size:13px; border-radius:20px; background:var(--surface); }

.content{ flex:1; padding:24px; max-width:1200px; width:100%; margin:0 auto; }
.content-foot{
  display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap;
  padding:18px 2px 8px; font-size:12px; color:var(--text3);
  border-top:1px solid var(--border); margin-top:24px;
}

/* ─────────── KPI ─────────── */
.kpi-row{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:18px; }
.kpi{
  background:var(--surface); border:1px solid var(--border); border-radius:14px;
  padding:16px 18px; transition:border-color .15s, transform .15s;
}
.kpi:hover{ border-color:var(--border2); transform:translateY(-1px); }
.kpi-top{ display:flex; align-items:center; justify-content:space-between; }
.kpi-label{ font-size:11.5px; font-weight:700; color:var(--text3); text-transform:uppercase; letter-spacing:.07em; }
.kpi-icon{ width:30px; height:30px; border-radius:9px; display:flex; align-items:center; justify-content:center; background:var(--surface2); border:1px solid var(--border); }
.kpi-icon svg{ width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.kpi-value{ font-size:26px; font-weight:800; letter-spacing:-.03em; margin-top:8px; font-variant-numeric:tabular-nums; }
.kpi-sub{ font-size:11.5px; color:var(--text3); margin-top:2px; }

/* ─────────── CARDS / ANALYTICS ─────────── */
.grid-analytics{ display:grid; grid-template-columns:2fr 1fr; gap:14px; margin-bottom:18px; }
.grid-two{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.card{ background:var(--surface); border:1px solid var(--border); border-radius:14px; overflow:hidden; }
.card.pad{ padding:18px 20px; }
.card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.card-head.pad-head{ padding:14px 16px 0; }
.card-title{ font-size:13px; font-weight:700; }
.card-meta{ font-size:11.5px; color:var(--text3); }
.chart-wrap{ min-height:140px; }
.chart-wrap svg{ width:100%; height:140px; display:block; }
.chart-empty{ display:flex; align-items:center; justify-content:center; height:140px; color:var(--text3); font-size:12.5px; text-align:center; padding:0 20px; }

.stage-breakdown{ display:flex; flex-direction:column; gap:10px; }
.sb-item{ display:flex; flex-direction:column; gap:5px; }
.sb-top{ display:flex; align-items:center; gap:8px; font-size:12px; color:var(--text2); }
.sb-swatch{ width:9px; height:9px; border-radius:3px; flex-shrink:0; }
.sb-name{ flex:1; }
.sb-val{ font-family:var(--mono); font-size:11.5px; color:var(--text3); }
.sb-bar{ height:6px; border-radius:4px; background:var(--surface3); overflow:hidden; }
.sb-fill{ height:100%; border-radius:4px; transition:width .5s cubic-bezier(.2,.8,.3,1); }

.mini-list{ }
.ml-item{
  display:flex; align-items:center; gap:12px; padding:10px 16px;
  border-top:1px solid rgba(35,44,64,.6); cursor:pointer; transition:background .12s;
}
.ml-item:hover{ background:var(--surface2); }
.ml-item .mini-avatar{
  width:30px; height:30px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:800; color:#fff; background:linear-gradient(135deg,#4f7ef7,#7a5cf0);
}
.ml-main{ flex:1; min-width:0; }
.ml-name{ font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ml-sub{ font-size:11.5px; color:var(--text3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ml-side{ font-size:11.5px; color:var(--text3); text-align:right; white-space:nowrap; }
.ml-empty{ padding:20px 16px; font-size:12.5px; color:var(--text3); }

/* ─────────── FILTER BAR / CHIPS ─────────── */
.filter-bar{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.chips{ display:flex; gap:6px; flex-wrap:wrap; }
.chip{
  background:var(--surface); color:var(--text2); border:1px solid var(--border);
  border-radius:20px; padding:5px 13px; font-size:12px; font-weight:700; cursor:pointer;
  transition:all .15s;
}
.chip:hover{ color:var(--text); border-color:var(--border2); }
.chip.active{ color:#fff; background:linear-gradient(135deg,#4f7ef7,#7a5cf0); border-color:transparent; }
.filter-info{ font-size:12px; color:var(--text3); }

/* ─────────── TABLE ─────────── */
.table-scroll{ overflow-x:auto; }
table{ width:100%; border-collapse:collapse; min-width:640px; }
thead th{
  text-align:left; font-size:10.5px; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
  color:var(--text3); padding:12px 16px; border-bottom:1px solid var(--border); background:var(--surface2);
}
tbody tr{ cursor:pointer; border-bottom:1px solid rgba(35,44,64,.6); transition:background .12s; }
tbody tr:last-child{ border-bottom:none; }
tbody tr:hover{ background:var(--surface2); }
tbody td{ padding:11px 16px; font-size:13px; vertical-align:middle; }
.col-id{ width:56px; font-family:var(--mono); font-size:12px; color:var(--text3); }
.col-time{ width:140px; white-space:nowrap; font-size:12px; color:var(--text2); }

.tag-pill{
  display:inline-block; background:var(--surface3); border:1px solid var(--border2);
  color:var(--text2); border-radius:20px; padding:1px 9px; font-size:11px; font-weight:600; margin:1px 3px 1px 0;
}
.empty{ padding:48px 24px; text-align:center; color:var(--text2); }
.empty h3{ font-size:15px; color:var(--text); margin-bottom:6px; }
.empty p{ font-size:12.5px; color:var(--text3); max-width:420px; margin:0 auto 14px; }
.empty svg{ width:48px; height:48px; color:var(--text3); margin:0 auto 12px; display:block; fill:none; stroke:currentColor; stroke-width:1.4; stroke-linecap:round; stroke-linejoin:round; }

/* ─────────── KANBAN ─────────── */
.pipeline-head{ display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:14px; }
.section-desc{ font-size:12.5px; color:var(--text3); max-width:640px; line-height:1.6; }
.kanban{ display:flex; gap:12px; overflow-x:auto; padding-bottom:14px; align-items:flex-start; }
.kb-col{
  flex:1; min-width:230px; max-width:300px;
  background:var(--surface); border:1px solid var(--border); border-radius:14px;
  display:flex; flex-direction:column; max-height:calc(100vh - 220px);
}
.kb-col.drag-over{ border-color:var(--accent); box-shadow:0 0 0 3px rgba(91,140,255,.18); }
.kb-col-head{
  padding:12px 14px; display:flex; align-items:center; gap:8px; border-bottom:1px solid var(--border);
}
.kb-dot{ width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.kb-name{ font-size:12.5px; font-weight:700; flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.kb-count{ font-size:11px; color:var(--text3); font-family:var(--mono); }
.kb-add{
  background:none; border:none; color:var(--text3); cursor:pointer; padding:2px 5px;
  border-radius:6px; font-size:15px; line-height:1; transition:all .15s;
}
.kb-add:hover{ color:var(--accent); background:var(--surface3); }
.kb-cards{ flex:1; overflow-y:auto; padding:10px; display:flex; flex-direction:column; gap:8px; min-height:60px; }
.kb-empty{ font-size:11.5px; color:var(--text3); text-align:center; padding:16px 8px; border:1px dashed var(--border2); border-radius:10px; }
.deal-card{
  background:var(--surface2); border:1px solid var(--border); border-radius:10px;
  padding:10px 12px; cursor:grab; transition:border-color .15s, transform .15s, box-shadow .15s;
}
.deal-card:hover{ border-color:var(--border2); transform:translateY(-1px); box-shadow:0 6px 16px -8px rgba(0,0,0,.6); }
.deal-card.dragging{ opacity:.4; cursor:grabbing; }
.deal-title{ font-size:12.5px; font-weight:700; line-height:1.35; }
.deal-contact{ font-size:11px; color:var(--text3); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.deal-foot{ display:flex; align-items:center; justify-content:space-between; margin-top:8px; gap:8px; }
.deal-value{ font-family:var(--mono); font-size:12px; font-weight:700; color:var(--success); }
.deal-stage-select{
  font-size:10.5px; padding:2px 6px; border-radius:6px; width:auto;
  background:var(--surface3); border:1px solid var(--border2); color:var(--text2);
}
.deal-del{
  background:none; border:none; color:var(--text3); cursor:pointer; font-size:11px;
  padding:2px 4px; border-radius:5px; transition:all .15s;
}
.deal-del:hover{ color:var(--danger); background:var(--danger-soft); }

/* ─────────── MODAL ─────────── */
.modal-backdrop{
  position:fixed; inset:0; z-index:40; background:rgba(4,7,14,.72); backdrop-filter:blur(4px);
  display:flex; align-items:center; justify-content:center; padding:20px; animation:fadeIn .18s;
}
@keyframes fadeIn{ from{ opacity:0;} to{ opacity:1;} }
.modal{
  width:100%; max-width:560px; max-height:90vh; overflow-y:auto;
  background:var(--surface); border:1px solid var(--border2); border-radius:16px;
  box-shadow:var(--shadow-2); animation:modalIn .3s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes modalIn{ from{ opacity:0; transform:translateY(16px) scale(.98);} to{ opacity:1; transform:none;} }
.modal-head{ display:flex; align-items:center; justify-content:space-between; padding:18px 22px; border-bottom:1px solid var(--border); font-size:15px; font-weight:700; }
.modal-body{ padding:20px 22px 24px; }
.grid2{ display:grid; grid-template-columns:1fr 1fr; gap:0 14px; }
.span2{ grid-column:1 / -1; }

.close{ background:none; border:none; color:var(--text3); cursor:pointer; padding:6px; border-radius:8px; display:flex; transition:all .15s; }
.close:hover{ color:var(--text); background:var(--surface3); }
.close svg{ width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }

/* ─────────── DRAWER ─────────── */
#overlay{ position:fixed; inset:0; background:rgba(4,7,14,.6); z-index:30; opacity:0; pointer-events:none; transition:opacity .22s; backdrop-filter:blur(2px); }
#overlay.show{ opacity:1; pointer-events:auto; }
#drawer{
  position:fixed; top:0; right:0; bottom:0; width:min(520px,100%);
  background:var(--surface); border-left:1px solid var(--border2); z-index:31;
  transform:translateX(100%); transition:transform .26s cubic-bezier(.2,.8,.25,1);
  display:flex; flex-direction:column; box-shadow:-24px 0 60px -30px rgba(0,0,0,.8);
}
#drawer.show{ transform:translateX(0); }
.drawer-head{ display:flex; align-items:center; gap:12px; padding:16px 18px; border-bottom:1px solid var(--border); flex-shrink:0; }
.avatar{
  width:42px; height:42px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:13px; font-weight:800; color:#fff; background:linear-gradient(135deg,#4f7ef7,#7a5cf0);
}
.drawer-title-wrap{ flex:1; min-width:0; }
.drawer-name{ font-size:15px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.drawer-sub{ font-size:11.5px; color:var(--text3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.drawer-tabs{ display:flex; gap:2px; padding:10px 18px 0; border-bottom:1px solid var(--border); flex-shrink:0; }
.dtab{
  background:none; border:none; color:var(--text3); font-family:inherit;
  font-size:12.5px; font-weight:700; padding:8px 12px; cursor:pointer;
  border-bottom:2px solid transparent; margin-bottom:-1px; transition:color .15s;
}
.dtab:hover{ color:var(--text); }
.dtab.active{ color:var(--accent); border-bottom-color:var(--accent); }
.drawer-body{ flex:1; overflow-y:auto; padding:18px; }

.kv-list{ display:flex; flex-direction:column; }
.kv-row{ display:flex; justify-content:space-between; gap:12px; padding:9px 2px; border-bottom:1px solid rgba(35,44,64,.6); font-size:13px; }
.kv-row .k{ color:var(--text3); font-weight:600; flex-shrink:0; }
.kv-row .v{ text-align:right; color:var(--text); word-break:break-word; }

.note-add{ margin-bottom:14px; }
.note-add input{ font-size:13px; }
.notes-list{ display:flex; flex-direction:column; gap:8px; }
.note-item{
  background:var(--surface2); border:1px solid var(--border); border-radius:10px; padding:10px 12px;
}
.note-text{ font-size:12.5px; line-height:1.5; white-space:pre-wrap; word-break:break-word; }
.note-foot{ display:flex; justify-content:space-between; align-items:center; margin-top:6px; }
.note-time{ font-size:10.5px; color:var(--text3); }
.note-del{ background:none; border:none; color:var(--text3); cursor:pointer; font-size:11px; border-radius:5px; padding:2px 5px; }
.note-del:hover{ color:var(--danger); background:var(--danger-soft); }
.notes-empty{ font-size:12.5px; color:var(--text3); padding:16px 0; }

/* ─────────── SETTINGS ─────────── */
.grid-settings{ display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:start; }
.row-actions{ display:flex; gap:8px; margin-top:16px; flex-wrap:wrap; align-items:center; }
.row-actions.between{ justify-content:space-between; }
.check-label{ display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text2); cursor:pointer; }
.check-label input{ width:auto; }
.code-block{
  background:var(--bg0); border:1px solid var(--border); border-radius:10px;
  padding:12px 14px; font-family:var(--mono); font-size:11.5px; line-height:1.65;
  color:#c8d4ea; overflow-x:auto; white-space:pre-wrap; word-break:break-all; margin-top:10px;
}

.wh-log{ margin-top:16px; display:flex; flex-direction:column; gap:6px; }
.wh-log-empty{ font-size:12px; color:var(--text3); }
.wh-entry{
  display:flex; align-items:center; gap:10px; font-size:11.5px;
  background:var(--surface2); border:1px solid var(--border); border-radius:8px; padding:7px 10px;
}
.wh-entry .wh-status{ width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.wh-entry .wh-status.ok{ background:var(--success); }
.wh-entry .wh-status.err{ background:var(--danger); }
.wh-entry .wh-ev{ font-family:var(--mono); font-weight:700; color:var(--text); }
.wh-entry .wh-detail{ color:var(--text3); flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wh-entry .wh-time{ color:var(--text3); font-family:var(--mono); flex-shrink:0; }

.stage-row{
  display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid rgba(35,44,64,.6);
}
.stage-row input[type="color"]{
  width:34px; height:30px; padding:2px; border-radius:8px; flex-shrink:0; cursor:pointer;
}
.stage-row .stage-name-input{ flex:1; }
.stage-row .stage-count{ font-size:11px; color:var(--text3); font-family:var(--mono); flex-shrink:0; }
.stage-row .stage-del{ background:none; border:none; color:var(--text3); cursor:pointer; font-size:13px; padding:4px 6px; border-radius:6px; flex-shrink:0; }
.stage-row .stage-del:hover{ color:var(--danger); background:var(--danger-soft); }
.stage-win-flag{ font-size:9.5px; font-weight:800; letter-spacing:.05em; text-transform:uppercase; padding:2px 6px; border-radius:5px; flex-shrink:0; }
.stage-win-flag.won{ color:var(--success); background:var(--success-soft); border:1px solid rgba(52,211,153,.3); }
.stage-win-flag.lost{ color:var(--danger); background:var(--danger-soft); border:1px solid rgba(248,113,113,.3); }

/* ─────────── TOASTS ─────────── */
#toasts{ position:fixed; top:18px; right:18px; z-index:60; display:flex; flex-direction:column; gap:10px; width:min(340px,calc(100vw - 36px)); }
.toast{
  position:relative; overflow:hidden;
  background:var(--surface2); border:1px solid var(--border2); border-left:3px solid var(--accent);
  border-radius:12px; padding:12px 16px; font-size:13px; font-weight:600;
  box-shadow:var(--shadow-2); display:flex; align-items:flex-start; gap:10px;
  animation:toastIn .3s cubic-bezier(.2,.9,.3,1.15);
}
@keyframes toastIn{ from{ opacity:0; transform:translateX(24px);} to{ opacity:1; transform:none;} }
.toast.out{ animation:toastOut .25s forwards; }
@keyframes toastOut{ to{ opacity:0; transform:translateX(24px);} }
.toast svg{ width:16px; height:16px; margin-top:1px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.toast.success{ border-left-color:var(--success); } .toast.success svg{ color:var(--success); }
.toast.error{ border-left-color:var(--danger); } .toast.error svg{ color:var(--danger); }
.toast.info{ border-left-color:#38bdf8; } .toast.info svg{ color:#38bdf8; }
.toast .tbar{ position:absolute; bottom:0; left:0; height:2px; background:currentColor; opacity:.5; animation:tbar linear forwards; }
@keyframes tbar{ from{ width:100%;} to{ width:0%;} }

/* ─────────── RESPONSIVE ─────────── */
@media (max-width:1024px){
  .kpi-row{ grid-template-columns:repeat(2,1fr); }
  .grid-analytics, .grid-two, .grid-settings{ grid-template-columns:1fr; }
}
@media (max-width:860px){
  #app{ flex-direction:column; }
  .sidebar{ position:sticky; top:0; width:100%; height:auto; z-index:25; flex-direction:row; align-items:center; padding:0 14px; gap:8px; }
  .side-brand{ border-bottom:none; padding:10px 8px 10px 0; }
  .side-host{ display:none; }
  .side-nav{ flex-direction:row; padding:10px 4px; flex:1; overflow-x:auto; }
  .nav-item{ width:auto; padding:8px 10px; }
  .nav-item.active::before{ left:10px; right:10px; top:auto; bottom:-10px; width:auto; height:3px; }
  .side-foot{ border-top:none; padding:8px; flex-direction:row; align-items:center; }
  .phase-tag{ display:none; }
  .content{ padding:16px; }
  .hide-md{ display:none; }
  table{ min-width:520px; }
  .kanban{ flex-direction:column; overflow-x:visible; }
  .kb-col{ max-width:none; max-height:none; }
  .kb-cards{ max-height:300px; }
}
@media (max-width:560px){
  .kpi-row{ grid-template-columns:1fr 1fr; }
  .grid2{ grid-template-columns:1fr; }
  .content-foot{ flex-direction:column; }
}

@media (prefers-reduced-motion:reduce){
  *, *::before, *::after{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}

/* ═══════════ PHASE 2–3 ADDITIONS ═══════════ */

.modal.wide{ max-width:920px; }
.slug-row{ display:flex; align-items:stretch; }
.slug-prefix{
  display:flex; align-items:center; padding:0 12px; font-family:var(--mono); font-size:13px;
  background:var(--surface2); border:1px solid var(--border); border-right:none;
  border-radius:var(--radius-sm) 0 0 var(--radius-sm); color:var(--text3);
}
.slug-row input{ border-radius:0 var(--radius-sm) var(--radius-sm) 0; }
textarea.page-html{ font-family:var(--mono); font-size:12px; line-height:1.6; }

.status-pill{
  display:inline-flex; align-items:center; gap:6px;
  font-family:var(--mono); font-size:10.5px; font-weight:800; letter-spacing:.06em;
  padding:3px 10px; border-radius:20px;
}
.status-pill::before{ content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.status-pill.s2xx{ background:var(--success-soft); color:var(--success); }
.status-pill.s5xx{ background:var(--danger-soft); color:var(--danger); }

.rules-empty{
  background:var(--surface); border:1px dashed var(--border2); border-radius:14px;
  padding:48px 24px; text-align:center; color:var(--text2);
}
.rules-empty svg{ width:44px; height:44px; color:var(--text3); margin:0 auto 12px; display:block; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }

/* ── Automation builder ── */
.builder-block{
  background:var(--surface2); border:1px solid var(--border); border-radius:12px;
  padding:14px 16px; margin-top:18px;
}
.builder-head{ display:flex; align-items:baseline; justify-content:space-between; margin-bottom:12px; font-size:13px; }
.cond-row, .action-row{
  display:grid; grid-template-columns:1.1fr .9fr 1.6fr auto; gap:8px;
  align-items:center; margin-bottom:8px;
}
.action-row{ grid-template-columns:.9fr 1fr auto; }
.a-params{ display:flex; gap:8px; flex-wrap:wrap; }
.a-params input, .a-params select{ flex:1; min-width:120px; font-size:12.5px; padding:8px 10px; }
.a-params input.num{ flex:0 0 100px; min-width:100px; }
.cond-row input, .cond-row select, .action-row select{ font-size:12.5px; padding:8px 10px; }
.row-x{
  background:none; border:none; color:var(--text3); cursor:pointer; font-size:13px;
  padding:6px 8px; border-radius:8px; transition:all .15s; flex-shrink:0;
}
.row-x:hover{ color:var(--danger); background:var(--danger-soft); }
