/* Page-specific styles for /partnerships. Loaded before app.css; later global polish still wins. */

/* ── partnerships as cards ────────────────────────────── */
.ptree{display:flex;flex-direction:column;gap:14px}
.pnode{background:var(--surface);border:1px solid var(--border);
  border-radius:14px;box-shadow:var(--sh);overflow:hidden;transition:box-shadow .15s,border-color .15s}
.pnode:hover{box-shadow:0 4px 16px rgba(15,23,42,.08)}
.pnode.is-live{border-left:4px solid var(--ok)}
.pnode.is-idle{border-left:4px solid #cbd5e1}
.pnode>summary{cursor:pointer;padding:14px 18px;list-style:none;
  display:flex;align-items:center;gap:12px}
.pnode>summary::-webkit-details-marker{display:none}
.pnode>summary::after{content:"⌄";margin-left:auto;color:var(--muted);font-size:18px;
  transition:transform .2s;flex:0 0 auto}
.pnode[open]>summary::after{transform:rotate(180deg)}
.pnode>summary:hover{background:#fafafe}
.pnode[open]>summary{border-bottom:1px solid var(--border)}
/* Аватар-кружок партнёрки с первой буквой. */
.pn-avatar{flex:0 0 40px;width:40px;height:40px;border-radius:11px;display:grid;place-items:center;
  font-weight:800;font-size:17px;color:#fff;background:linear-gradient(135deg,#6366f1,#8b5cf6)}
.pn-idle .pn-avatar{background:linear-gradient(135deg,#cbd5e1,#94a3b8)}
.pn-main{flex:1;min-width:0}
.pn-name{font-weight:700;font-size:16px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.pn-num{font-size:12px;font-weight:700;color:var(--muted);background:#f1f5f9;
  padding:2px 8px;border-radius:7px}
.pn-meta{color:var(--muted);font-size:12px;margin-top:3px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.pn-dot{font-size:8px;opacity:.5}
.pn-status{font-size:11px;font-weight:700;padding:2px 9px;border-radius:20px;white-space:nowrap}
.pn-status.live{background:#dcfce7;color:#166534}
.pn-status.idle{background:#f1f5f9;color:#94a3b8}
.pn-status.readiness-ready{background:#dcfce7;color:#166534}
.pn-status.readiness-review{background:#fef3c7;color:#92400e}
.pn-status.readiness-problem{background:#fee2e2;color:#991b1b}
.pn-status.readiness-draft{background:#eef2ff;color:#3730a3}
.pn-preview{display:flex;flex-direction:column;gap:6px;margin-top:9px}
.pn-preview-row{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.pn-preview-label{font-size:11px;font-weight:800;color:#94a3b8;text-transform:uppercase;min-width:48px}
.pn-chip{display:inline-flex;align-items:center;gap:4px;max-width:180px;
  padding:4px 9px;border-radius:999px;font-size:12px;font-weight:700;line-height:1.2;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pn-chip-casino{background:#eef2ff;color:#3730a3;border:1px solid #c7d2fe}
.pn-chip-geo{background:#ecfdf5;color:#047857;border:1px solid #bbf7d0}
.pn-chip-more{background:#f8fafc;color:var(--muted);border:1px solid var(--border)}
.pbody{padding:16px 18px;background:#fcfcfd}

/* Блок привязанных сайтов */
.pn-sites{background:#fff;border:1px solid var(--border);border-radius:12px;padding:13px 15px;margin-bottom:14px}
.pn-sites-head{font-weight:600;font-size:13px;margin-bottom:9px;display:flex;align-items:center;gap:8px}
.pn-sites-chips{display:flex;flex-wrap:wrap;gap:7px}
.site-chip{display:inline-flex;align-items:center;gap:6px;background:#ede9fe;color:#5b21b6;
  border-radius:20px;padding:5px 12px;font-size:12px;font-weight:600;text-decoration:none;transition:background .12s}
.site-chip:hover{background:#ddd6fe;text-decoration:none}
.site-chip .sc-clicks{background:rgba(255,255,255,.7);border-radius:10px;padding:0 6px;font-size:11px}

/* Казино — секции */
.cnode{background:#fff;border:1px solid var(--border);border-radius:12px;
  padding:12px 14px;margin-bottom:10px}
.cnode:last-of-type{margin-bottom:0}
.cnode>summary{cursor:pointer;font-weight:600;font-size:14px;list-style:none;display:flex;align-items:center;
  gap:8px}
.cnode>summary::-webkit-details-marker{display:none}
.cnode>summary:hover{color:var(--accent)}
.cnode-del{margin-left:auto}

/* GEO-чипы */
.geo-pill{display:inline-flex;gap:5px;align-items:center;background:#f8fafc;border:1px solid var(--border);
  border-radius:10px;padding:5px 11px;margin:3px 5px 3px 0;font-size:12px;font-weight:500}
.geo-pill[open]{display:block;background:#fff;border-color:#c7d2fe;box-shadow:0 2px 8px rgba(79,70,229,.08);
  padding:10px 12px;margin-bottom:8px}
.geo-pill>summary{list-style:none;cursor:pointer;display:inline-flex;align-items:center;gap:5px}
.geo-pill>summary::-webkit-details-marker{display:none}
.geo-code{font-weight:700;color:var(--accent)}

.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:16px}

/* Desktop workspace: list on the left, selected partnership on the right. */
.partnerships-workspace{
  display:grid;
  grid-template-columns:minmax(360px,.82fr) minmax(420px,1.18fr);
  gap:18px;
  align-items:start;
}

.partnerships-list-pane{
  min-width:0;
}

.partnership-panel{
  position:sticky;
  top:14px;
  z-index:2;
  min-width:0;
  max-height:calc(100vh - 28px);
  overflow:auto;
  padding:16px;
  border:1px solid var(--border);
  border-radius:22px;
  background:rgba(255,255,255,.9);
  box-shadow:var(--sh);
  -webkit-overflow-scrolling:touch;
}

.partnership-panel .notes-acc:first-child,
.partnership-panel .postback-acc:first-child{
  margin-top:0;
}

.partnerships-workspace .pnode.is-selected{
  border-color:rgba(0,113,227,.32);
  box-shadow:0 10px 30px rgba(0,113,227,.10);
}

@media (min-width:861px){
  .partnerships-workspace .pnode>.pbody{
    display:none;
  }
}

@media (max-width:860px){
  .partnerships-workspace{
    display:block;
  }

  .partnership-panel{
    display:none;
  }
}

/* ── Partnerships workspace polish ─────────────────────────────────────── */
.partner-tools{
  position:relative;
  z-index:1;
  display:grid;
  grid-template-columns:minmax(180px,1fr) auto minmax(0,230px) auto auto;
  align-items:center;
  gap:10px;
  margin-bottom:14px;
  padding:10px;
  border:1px solid var(--border);
  border-radius:8px;
  background:rgba(255,255,255,.92);
  box-shadow:var(--sh);
  backdrop-filter:saturate(180%) blur(14px);
  -webkit-backdrop-filter:saturate(180%) blur(14px);
}
.partner-search{width:100%;min-width:0}
.partner-import-form{
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px;
  align-items:center;
}
.partner-import-file{
  min-width:0;
  width:100%;
  max-width:100%;
}
.partner-tools-meta{
  min-width:72px;
  text-align:right;
  font-size:12px;
  font-weight:700;
}
.partner-empty{display:none}
.partner-empty:not([hidden]){display:block}
.pnode[hidden]{display:none}
.pn-warn,.cnode-warn,.geo-ref-missing{
  color:#b42318;
  background:#fff1f0;
  border:1px solid #ffd5d2;
  border-radius:999px;
  padding:2px 8px;
  font-size:11px;
  font-weight:750;
}
.ptree.is-compact{gap:8px}
.ptree.is-compact .pnode>summary{min-height:52px;padding:10px 14px}
.ptree.is-compact .pn-avatar{width:32px;height:32px;flex-basis:32px;font-size:14px}
.ptree.is-compact .pn-preview{display:none}
.ptree.is-compact .pn-name{font-size:14px}
.ptree.is-compact .pn-meta{margin-top:1px}
.ptree.is-compact .pn-open-detail{display:none}
#partner-compact.is-active{
  color:#0057b8;
  background:#eef6ff;
  border-color:#cfe7ff;
}
.cnode-title{font-weight:760;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cnode-count{
  color:#475467;
  background:#f2f4f7;
  border:1px solid #e4e7ec;
  border-radius:999px;
  padding:2px 8px;
  font-size:11px;
  font-weight:750;
}
.geo-missing-ref{
  border-color:#ffd5d2;
  background:#fffafa;
}
.geo-edit-mark{margin-left:4px;opacity:.55}
.geo-add-form{
  margin:8px 0 0;
  padding-top:10px;
  border-top:1px dashed var(--border);
  background:linear-gradient(180deg,rgba(247,249,252,0),rgba(247,249,252,.7));
}
.postback-acc{
  margin-top:10px;
  border:1px solid #e4e7ec;
  border-radius:12px;
  background:rgba(248,250,252,.76);
  padding:8px 10px;
}
.postback-acc>summary{
  cursor:pointer;
  font-weight:750;
  color:#344054;
}
.postback-form{
  display:grid;
  grid-template-columns:repeat(4,minmax(130px,1fr)) auto;
  gap:8px;
  align-items:end;
  margin-top:10px;
}
.postback-form label{
  display:flex;
  flex-direction:column;
  gap:5px;
  color:var(--muted);
  font-size:12px;
  font-weight:650;
}
.postback-ready{
  display:grid;
  gap:6px;
  margin-top:10px;
}
.postback-copy-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px;
  align-items:stretch;
}
.postback-url{
  width:100%;
  min-width:0;
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  font-size:12px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.postback-copy-row .copy-btn{
  min-width:128px;
  justify-content:center;
}
.geo-bulk-box{
  display:grid;
  grid-template-columns:minmax(220px,1fr) minmax(260px,1.2fr) auto;
  gap:10px;
  align-items:end;
  margin-bottom:8px;
}
.geo-bulk-field{
  display:flex;
  flex-direction:column;
  gap:5px;
  color:var(--muted);
  font-size:12px;
  font-weight:650;
}
.geo-bulk-codes{
  min-height:86px;
  resize:vertical;
  line-height:1.45;
}
.geo-bulk-select{
  min-height:112px;
  padding:8px;
}
.geo-bulk-select option{
  padding:4px 8px;
  border-radius:6px;
}
.geo-bulk-actions{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.geo-bulk-actions .btn{
  min-height:32px;
  white-space:nowrap;
}
.geo-add-save-row{
  align-items:stretch;
  margin-bottom:0;
}
.geo-edit-save-row{
  align-items:stretch;
  margin-bottom:0;
}
.geo-add-save-row .btn,.geo-edit-save-row .btn{
  flex:0 0 auto;
  min-width:160px;
}
@media (max-width:860px){
  .partner-tools{
    position:static;
    display:flex;
    flex-wrap:wrap;
    backdrop-filter:none;
    -webkit-backdrop-filter:none;
  }
  .partner-search{flex:1 1 100%;min-width:0}
  .partner-import-form{flex:1 1 100%;grid-template-columns:1fr auto}
  .partner-tools-meta{text-align:left;min-width:auto}
  .postback-form{grid-template-columns:1fr}
  .postback-copy-row{grid-template-columns:1fr}
  .geo-bulk-box{grid-template-columns:1fr}
  .geo-bulk-actions{flex-direction:row;flex-wrap:wrap}
  .geo-add-save-row .btn,.geo-edit-save-row .btn{width:100%}
}

/* Partnership UX refinement extracted from app.css */
/* ── Partnership UX refinement ─────────────────────────────────────────── */
.partner-tools{
  border-radius:18px;
  padding:12px;
}

.partner-tools .btn{
  min-height:38px;
  padding:8px 14px;
}

.ptree{
  gap:12px;
}

.pnode{
  border-radius:22px;
  overflow:hidden;
}

.pnode.is-live,
.pnode.is-idle{
  border-left:0;
}

.pnode::before{
  content:"";
  display:block;
  height:3px;
  background:#d0d5dd;
}

.pnode.is-live::before{
  background:linear-gradient(90deg,#34c759,#a3e635);
}

.pnode>summary{
  min-height:76px;
  padding:16px 18px;
  gap:14px;
}

.pnode[open]>summary{
  border-bottom-color:rgba(228,232,239,.72);
  background:#fff;
}

.pnode>summary::after{
  content:"";
  width:8px;
  height:8px;
  border-right:2px solid #98a2b3;
  border-bottom:2px solid #98a2b3;
  transform:rotate(45deg);
  margin-left:10px;
}

.pnode[open]>summary::after{
  transform:rotate(225deg);
}

.pn-avatar{
  width:44px;
  height:44px;
  flex-basis:44px;
  border-radius:14px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.35);
}

.pn-num{
  background:#f5f5f7;
  color:#667085;
  border:1px solid #ececf0;
}

.pn-meta{
  gap:7px;
  color:#86868b;
}

.pn-dot{
  width:3px;
  height:3px;
  border-radius:50%;
  background:#c7c7cc;
  color:transparent;
}

.pn-status{
  padding:3px 10px;
  letter-spacing:-.01em;
}

.pn-preview{
  margin-top:10px;
  gap:7px;
}

.pn-preview-label{
  color:#98a2b3;
  letter-spacing:.02em;
}

.pdelete-form .btn{
  width:36px;
  height:36px;
  padding:0!important;
  border-radius:50%;
  background:#f5f5f7;
  color:#667085;
}

.pdelete-form .btn:hover{
  background:#ffeceb;
  color:#d92d20;
}

.pbody{
  padding:18px;
  background:linear-gradient(180deg,#fbfcfe 0,#f7f9fc 100%);
}

.partner-loading{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:72px;
  padding:18px;
  color:#667085;
  background:#fff;
  border:1px solid #edf0f5;
  border-radius:18px;
  font-weight:600;
}

.partner-spinner{
  width:16px;
  height:16px;
  border-radius:50%;
  border:2px solid #e5e7eb;
  border-top-color:#1d1d1f;
  animation:crm-spin .8s linear infinite;
}

@keyframes crm-spin{
  to{transform:rotate(360deg)}
}

.partner-empty-state{
  display:flex;
  align-items:center;
  gap:14px;
  padding:18px;
  margin-bottom:12px;
  background:#fff;
  border:1px dashed #d7dde7;
  border-radius:18px;
}

.partner-empty-state p{
  margin:3px 0 0;
}

.partner-empty-icon{
  width:44px;
  height:44px;
  flex:0 0 44px;
  display:grid;
  place-items:center;
  border-radius:14px;
  background:#f5f5f7;
}

.notes-acc,
.postback-acc{
  margin:0 0 12px;
  border:1px solid #edf0f5;
  border-radius:18px;
  background:#fff;
  padding:0;
  overflow:hidden;
}

.notes-acc>summary,
.postback-acc>summary{
  min-height:46px;
  display:flex;
  align-items:center;
  gap:8px;
  padding:12px 14px;
  color:#344054;
  font-size:14px;
  font-weight:700;
  list-style:none;
}

.notes-acc>summary::-webkit-details-marker,
.postback-acc>summary::-webkit-details-marker{
  display:none;
}

.notes-acc>summary::before,
.postback-acc>summary::before{
  content:"";
  width:7px;
  height:7px;
  border-right:2px solid #98a2b3;
  border-bottom:2px solid #98a2b3;
  transform:rotate(-45deg);
  transition:transform .18s ease;
}

.notes-acc[open]>summary::before,
.postback-acc[open]>summary::before{
  transform:rotate(45deg);
}

.notes-acc .na-body,
.postback-acc .postback-form,
.postback-acc .postback-ready{
  padding:0 14px 14px;
}

.postback-form{
  grid-template-columns:repeat(2,minmax(180px,1fr));
  margin-top:0;
}

.postback-form .btn{
  grid-column:auto;
  justify-self:start;
  min-height:38px;
}

.postback-ready{
  border-top:1px solid #edf0f5;
  margin-top:0;
  padding-top:14px!important;
  background:#fcfcfd;
}

.pn-sites{
  border:0;
  border-radius:18px;
  background:#fff;
  box-shadow:inset 0 0 0 1px #edf0f5;
}

.cnode{
  border:0;
  border-radius:18px;
  padding:0;
  background:#fff;
  box-shadow:inset 0 0 0 1px #edf0f5;
  overflow:hidden;
}

.cnode>summary{
  padding:13px 14px;
  min-height:50px;
}

.cnode>summary:hover{
  color:#1d1d1f;
  background:#fbfcfe;
}

.cnode>summary::before{
  content:"";
  width:7px;
  height:7px;
  border-right:2px solid #98a2b3;
  border-bottom:2px solid #98a2b3;
  transform:rotate(45deg);
  transition:transform .18s ease;
}

.cnode[open]>summary::before{
  transform:rotate(225deg);
}

.cnode>div,
.cnode>.geo-add-form{
  margin-left:14px;
  margin-right:14px;
}

.cnode-del .btn{
  border-radius:50%;
  width:30px;
  height:30px;
  padding:0!important;
  min-height:30px!important;
}

.geo-add-form{
  margin-top:4px;
  padding:14px 0 16px;
  border-top:1px solid #edf0f5;
  background:transparent;
}

.geo-bulk-box{
  grid-template-columns:minmax(220px,1fr) minmax(240px,1fr) auto;
}

.geo-bulk-codes,
.geo-bulk-select{
  border-radius:14px;
}

.geo-add-save-row{
  margin-top:8px;
}

.casino-add-card{
  display:grid;
  grid-template-columns:minmax(180px,1fr) minmax(220px,1.3fr) auto;
  gap:12px;
  align-items:center;
  margin-top:12px;
  padding:14px;
  background:#fff;
  border:1px solid #edf0f5;
  border-radius:18px;
}

.casino-add-card .muted{
  margin-top:2px;
  font-size:12px;
}

.casino-add-card .input{
  width:100%;
}

.casino-add-card .btn{
  min-height:38px;
}

@media (max-width:860px){
  .pbody{
    padding:12px;
  }

  .postback-form,
  .casino-add-card{
    grid-template-columns:1fr;
  }

  .casino-add-card .btn{
    width:100%;
  }
}

@media (prefers-reduced-motion:reduce){
  .partner-spinner{
    animation:none;
  }
}

/* Final partnership workbench pass: calmer selected panel and collapsed GEO forms. */
.partner-panel-head{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
  padding:14px;
  border:1px solid #edf0f5;
  border-radius:20px;
  background:linear-gradient(180deg,#fff,#f8fbff);
}

.partner-panel-title{
  flex:1;
  min-width:0;
}

.partner-panel-title b{
  font-size:20px;
  letter-spacing:-.03em;
}

.partner-panel-meta{
  display:flex;
  align-items:center;
  gap:7px;
  flex-wrap:wrap;
  margin-top:6px;
  color:#667085;
  font-size:12px;
  font-weight:650;
}

.partner-panel-head>.btn{
  flex:0 0 auto;
}

.geo-add-acc{
  margin:10px 14px 14px;
  border:1px dashed #d7dde7;
  border-radius:16px;
  background:#fbfcff;
  overflow:hidden;
}

.geo-add-acc>summary{
  min-height:42px;
  display:flex;
  align-items:center;
  padding:10px 13px;
  cursor:pointer;
  list-style:none;
  color:#0057b8;
  font-weight:800;
}

.geo-add-acc>summary::-webkit-details-marker{
  display:none;
}

.geo-add-acc>summary:hover{
  background:#f3f8ff;
}

.geo-add-acc .geo-add-form{
  margin:0;
  padding:14px;
  border-top:1px solid #edf0f5;
  background:#fff;
}

.cnode>.geo-add-acc{
  margin-left:14px;
  margin-right:14px;
}

@media (max-width:860px){
  .partner-panel-head{
    flex-wrap:wrap;
  }

  .partner-panel-head>.btn{
    width:100%;
  }
}

.postback-acc .postback-copy-row,
.partnership-mobile-workspace .postback-copy-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px;
  align-items:stretch;
}

.postback-acc .postback-url,
.partnership-mobile-workspace .postback-url{
  min-width:0;
  width:100%;
}

.postback-acc .postback-copy-row .copy-btn,
.partnership-mobile-workspace .postback-copy-row .copy-btn{
  min-width:128px;
  padding-inline:16px;
}

@media (max-width:860px){
  .postback-acc .postback-copy-row,
  .partnership-mobile-workspace .postback-copy-row{
    grid-template-columns:1fr;
  }
}
