/* ============================================================
   Doukht Bartar panel — unified design system (purple brand)
   Shared by the playbook panel (index) and smart-query (smart).
   ============================================================ */
@import url("https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css");

:root{
  /* surfaces */
  --bg:#0a0d13; --bg-elev:#11151c; --surface:#161b24; --surface-2:#1d2330; --surface-3:#252c3b;
  --border:#262d3b; --border-strong:#323a4a;
  /* text */
  --text:#e8edf5; --text-dim:#a3adc2; --text-muted:#6a7689;
  /* brand = purple */
  --brand:#a78bfa; --brand-2:#8b5cf6; --brand-soft:rgba(167,139,250,0.10); --brand-soft-2:rgba(167,139,250,0.18);
  /* secondary accent = blue */
  --accent:#5eaaff; --accent-2:#3d8be8; --accent-soft:rgba(94,170,255,0.10);
  /* semantic */
  --good:#3fce6c; --good-soft:rgba(63,206,108,0.12); --warn:#e8b94c; --warn-soft:rgba(232,185,76,0.12); --bad:#ff6b6b;
  /* shape */
  --radius:12px; --radius-sm:7px; --shadow:0 4px 16px rgba(0,0,0,0.35); --shadow-lg:0 12px 40px rgba(0,0,0,0.5);
  --sidebar-w:248px; --header-h:60px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; font-family:'Vazirmatn',system-ui,sans-serif; font-size:14px; line-height:1.6; color:var(--text);
  background:
    radial-gradient(1100px 560px at 88% -8%, rgba(167,139,250,0.07), transparent 60%),
    radial-gradient(820px 460px at -8% 108%, rgba(94,170,255,0.05), transparent 60%),
    var(--bg);
  -webkit-font-smoothing:antialiased;
}
::-webkit-scrollbar{width:10px; height:10px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--border-strong); border-radius:5px}
::-webkit-scrollbar-thumb:hover{background:#3e4759}
a{color:inherit; text-decoration:none}

/* ============ APP SHELL ============ */
.app{display:grid; grid-template-columns:1fr var(--sidebar-w); grid-template-rows:var(--header-h) 1fr;
  grid-template-areas:"header sidebar" "main sidebar"; min-height:100vh;}
.sidebar{grid-area:sidebar; background:linear-gradient(180deg,var(--surface),var(--bg-elev));
  border-left:1px solid var(--border); display:flex; flex-direction:column; padding:18px 14px; gap:6px;
  position:sticky; top:0; height:100vh; overflow-y:auto;}
.sb-brand{display:flex; align-items:center; gap:12px; padding:6px 8px 16px; border-bottom:1px solid var(--border); margin-bottom:10px;}
.sb-mark{width:38px; height:38px; border-radius:10px; background:linear-gradient(135deg,var(--brand),var(--brand-2));
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:18px; color:#fff;
  box-shadow:0 4px 14px rgba(167,139,250,0.4);}
.sb-brand h1{margin:0; font-size:15px; font-weight:600}
.sb-brand .sub{font-size:10.5px; color:var(--text-muted); margin-top:1px}
.sb-section{font-size:10px; color:var(--text-muted); font-weight:700; letter-spacing:.04em; padding:12px 10px 6px; text-transform:uppercase}
.sb-link{display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:var(--radius-sm); font-size:13px;
  color:var(--text-dim); cursor:pointer; transition:all .15s; border:1px solid transparent;}
.sb-link:hover{background:var(--surface-2); color:var(--text)}
.sb-link.active{background:var(--brand-soft-2); color:var(--brand); border-color:rgba(167,139,250,0.35); font-weight:600}
.sb-link svg{width:17px; height:17px; flex-shrink:0}
.sb-sub{display:flex; align-items:center; justify-content:space-between; padding:8px 12px 8px 30px; border-radius:var(--radius-sm);
  font-size:12px; color:var(--text-dim); cursor:pointer;}
.sb-sub:hover{background:var(--surface-2); color:var(--text)}
.sb-sub .c{font-size:10.5px; color:var(--text-muted); font-variant-numeric:tabular-nums}
.sb-spacer{flex:1}
.sb-foot{font-size:10.5px; color:var(--text-muted); padding:10px; border-top:1px solid var(--border); display:flex; align-items:center; gap:7px}
.dot{width:8px; height:8px; border-radius:50%; background:var(--good); box-shadow:0 0 0 3px var(--good-soft)}
.dot.bad{background:var(--bad); box-shadow:0 0 0 3px rgba(255,107,107,0.15)}

.topbar{grid-area:header; display:flex; align-items:center; justify-content:space-between; padding:0 28px;
  background:rgba(17,21,28,0.7); backdrop-filter:blur(12px); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:40;}
.topbar h2{margin:0; font-size:16px; font-weight:600}
.topbar .crumb{font-size:11.5px; color:var(--text-muted); margin-top:1px}
.topbar-right{display:flex; align-items:center; gap:14px; font-size:12px; color:var(--text-dim)}

.main{grid-area:main; padding:24px 28px 48px; overflow-x:hidden;}
.container{max-width:1500px; margin:0 auto;}

@media (max-width:900px){
  .app{grid-template-columns:1fr; grid-template-areas:"header" "main"; }
  .sidebar{position:fixed; right:0; top:0; z-index:60; transform:translateX(100%); transition:transform .2s; width:var(--sidebar-w);}
  .sidebar.open{transform:translateX(0)}
}

/* ============ CARDS / PANELS ============ */
.panel{background:linear-gradient(180deg,var(--surface),var(--bg-elev)); border:1px solid var(--border);
  border-radius:var(--radius); box-shadow:var(--shadow); padding:20px; margin-bottom:18px;}
.panel h3{margin:0 0 6px; font-size:15px; font-weight:600}
.section-title{font-size:13px; color:var(--text-dim); font-weight:600; margin:22px 0 12px; display:flex; align-items:center; gap:8px}

/* ============ BUTTONS ============ */
button{font-family:inherit; cursor:pointer; transition:all .15s;}
.btn{background:var(--surface-2); color:var(--text); border:1px solid var(--border-strong); border-radius:var(--radius-sm);
  padding:10px 18px; font-size:13px; font-weight:500; display:inline-flex; align-items:center; gap:8px;}
.btn:hover{background:var(--surface-3)}
.btn.primary{background:linear-gradient(180deg,var(--brand),var(--brand-2)); color:#fff; border-color:var(--brand);
  box-shadow:0 4px 12px rgba(167,139,250,0.3);}
.btn.primary:hover{transform:translateY(-1px); filter:brightness(1.05)}
.btn.accent{background:linear-gradient(180deg,var(--accent),var(--accent-2)); color:#fff; border-color:var(--accent);}
.btn:disabled{opacity:.5; cursor:not-allowed; transform:none !important}
.btn svg{width:15px; height:15px}

/* ============ INPUTS ============ */
.field{display:flex; flex-direction:column; gap:6px}
.field label{font-size:11.5px; color:var(--text-dim); font-weight:500; display:flex; align-items:center; gap:6px}
input,select,textarea{font-family:inherit}
.inp{background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px;
  color:var(--text); font-size:13px; width:100%; transition:all .15s;}
.inp:focus{outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft)}
.inp::placeholder{color:var(--text-muted)}

/* tooltip ? */
.info{position:relative; display:inline-flex; align-items:center; justify-content:center; width:15px; height:15px;
  border-radius:50%; background:var(--surface-3); color:var(--text-dim); font-size:10px; font-weight:600; cursor:help; border:1px solid var(--border-strong);}
.info:hover{background:var(--brand); color:#fff; border-color:var(--brand)}
.info::after{content:attr(data-tip); position:absolute; bottom:calc(100% + 8px); right:50%; transform:translateX(50%) translateY(-4px);
  background:#0a0d13; color:var(--text); padding:9px 12px; border-radius:6px; font-size:11.5px; font-weight:400; line-height:1.6;
  white-space:normal; width:max-content; max-width:280px; text-align:right; border:1px solid var(--border-strong);
  box-shadow:var(--shadow-lg); opacity:0; pointer-events:none; transition:opacity .18s, transform .18s; z-index:100;}
.info:hover::after{opacity:1; transform:translateX(50%) translateY(0)}

/* ============ TABS (playbooks) ============ */
.tabs{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:18px}
.tab{padding:9px 15px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm);
  cursor:pointer; font-size:12.5px; display:flex; align-items:center; gap:9px; transition:all .15s; color:var(--text);}
.tab:hover{background:var(--surface-2); border-color:var(--border-strong); transform:translateY(-1px)}
.tab.active{background:linear-gradient(180deg,var(--brand-2),#7c4ddf); border-color:var(--brand); color:#fff; box-shadow:0 4px 12px rgba(139,92,246,0.35)}
.tab .count{padding:2px 8px; border-radius:10px; background:var(--surface-3); color:var(--text-dim); font-size:11px; font-variant-numeric:tabular-nums}
.tab.active .count{background:rgba(255,255,255,0.18); color:#fff}

.desc-box{background:var(--brand-soft); border-right:3px solid var(--brand); border-radius:var(--radius-sm);
  padding:12px 16px; margin:14px 0 18px; font-size:12.5px; color:var(--text-dim); line-height:1.8;}
.desc-box strong{color:var(--brand); font-weight:600}

/* ============ FILTERS ============ */
.filters{display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:14px;}
.hint{font-size:10.5px; color:var(--text-muted)}
.hint .median-val{color:var(--brand); font-variant-numeric:tabular-nums}
.actions{display:flex; gap:10px; margin-top:18px; align-items:center; padding-top:18px; border-top:1px solid var(--border);}
.status{color:var(--text-dim); font-size:12.5px; margin-right:auto}
.status .num{color:var(--good); font-weight:600}

/* slice controls */
.slice-controls{background:var(--good-soft); border:1px solid rgba(63,206,108,0.18); border-radius:var(--radius-sm); padding:14px 16px; margin-bottom:16px;}
.slice-controls:empty{display:none}
.slice-header{font-size:12px; color:var(--good); font-weight:600; margin-bottom:10px; display:flex; align-items:center; gap:6px}
.slice-row{display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:12px; align-items:end}
.slice-cell{display:flex; flex-direction:column; gap:5px}
.slice-cell label{font-size:11.5px; color:var(--text-dim); display:flex; align-items:center; gap:6px}
.slice-cell .max-hint{font-size:10px; color:var(--text-muted)}

/* ============ TAG-SELECT (shared) ============ */
.tag-select{position:relative; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:5px 7px; min-height:36px; display:flex; flex-wrap:wrap; gap:5px; align-items:center; cursor:text;}
.tag-select:focus-within{border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft)}
.tag-select .tag{display:inline-flex; align-items:center; gap:4px; background:var(--brand-soft-2); color:var(--brand);
  border:1px solid rgba(167,139,250,0.3); border-radius:4px; padding:1px 5px; font-size:11px;}
.tag-select .tag .x{cursor:pointer; opacity:.6; padding:0 2px}
.tag-select .tag .x:hover{opacity:1}
.tag-select input,.tag-select select{flex:1; min-width:70px; border:none !important; background:transparent !important;
  padding:3px !important; font-size:12px; color:var(--text); box-shadow:none !important; outline:none !important;}
.tag-dropdown{position:absolute; top:calc(100% + 4px); right:0; left:0; background:var(--surface); border:1px solid var(--border-strong);
  border-radius:var(--radius-sm); box-shadow:var(--shadow-lg); max-height:360px; overflow-y:auto; z-index:30; display:none;}
.tag-dropdown.open{display:block}
.tag-dropdown .meta{padding:7px 12px; font-size:10.5px; color:var(--text-muted); background:var(--surface-2); border-bottom:1px solid var(--border); position:sticky; top:0;}
.tag-option{padding:8px 12px; cursor:pointer; font-size:12.5px; display:flex; justify-content:space-between; align-items:center; gap:8px; border-bottom:1px solid var(--border);}
.tag-option:hover,.tag-option.highlight,.tag-option.hl{background:var(--brand-soft); color:var(--brand)}
.tag-option .opt-count,.tag-option .opt-main{}
.tag-option .opt-count{font-size:10.5px; color:var(--text-muted); font-variant-numeric:tabular-nums; flex-shrink:0}
.tag-option .opt-main{display:flex; flex-direction:column; gap:3px; flex:1; min-width:0}
.tag-option .opt-label{font-size:12.5px; color:var(--text)}
.tag-option .opt-desc{font-size:10.5px; color:var(--text-muted); line-height:1.5; white-space:normal}
.tag-option:hover .opt-label,.tag-option.highlight .opt-label{color:var(--brand)}
.tag-option.empty{cursor:default; color:var(--text-muted); text-align:center; padding:14px}
.tag-option.empty:hover{background:transparent; color:var(--text-muted)}
.city-select{width:100%; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px 10px; color:var(--text); font-size:12.5px;}

/* ============ RESULTS TOOLBAR ============ */
.results{margin-top:20px}
.results-toolbar{display:flex; align-items:center; justify-content:space-between; padding:10px 14px; margin-bottom:10px;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm);}
.results-meta{font-size:12.5px; color:var(--text-dim)}
.results-meta .num{color:var(--good); font-weight:600; font-variant-numeric:tabular-nums}
.limit-picker{display:flex; align-items:center; gap:8px; font-size:12px; color:var(--text-dim)}
.limit-picker select{background:var(--bg); border:1px solid var(--border); border-radius:5px; padding:6px 10px; color:var(--text); font-family:inherit;}
.view-toggle{display:flex; gap:4px; background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:3px}
.view-toggle button{padding:5px 12px; font-size:11.5px; border:none; background:transparent; border-radius:4px; color:var(--text-dim)}
.view-toggle button.active{background:var(--surface-3); color:var(--brand)}

/* ============ TABLE ============ */
.table-wrap{overflow:auto; border:1px solid var(--border); border-radius:var(--radius); background:var(--bg-elev);
  box-shadow:var(--shadow); max-height:calc(100vh - 320px); min-height:200px;}
table{border-collapse:separate; border-spacing:0; width:100%; font-size:12.5px}
th,td{padding:11px 14px; text-align:right; border-bottom:1px solid var(--border); white-space:nowrap; max-width:300px; overflow:hidden; text-overflow:ellipsis;}
th{background:var(--surface-2); color:var(--text-dim); font-weight:600; font-size:11px; position:sticky; top:0; z-index:5; border-bottom:1px solid var(--border-strong);}
tbody tr:hover td{background:rgba(167,139,250,0.05)}
tbody tr:nth-child(even) td{background:rgba(255,255,255,0.012)}
td.long{max-width:380px; white-space:normal; line-height:1.7; font-size:12px}
td.num{font-variant-numeric:tabular-nums}
td.action{white-space:normal; max-width:320px; line-height:1.6; color:var(--text-dim); font-size:11.5px}
td.chips{white-space:normal; max-width:340px}
td.phone,th.phone-col{position:sticky; right:0; background:var(--bg-elev); z-index:3}
th.phone-col{background:var(--surface-2); z-index:6}
.phone-cell{display:inline-flex; align-items:center; gap:8px; direction:ltr; font-weight:500; font-variant-numeric:tabular-nums;}
.phone-cell .copy,.copy{opacity:0; width:22px; height:22px; padding:0; background:var(--surface-3); border:1px solid var(--border);
  border-radius:5px; display:inline-flex; align-items:center; justify-content:center; color:var(--text-dim);}
tr:hover .copy{opacity:1}
.copy:hover{color:var(--brand); border-color:var(--brand)}

/* ============ CHIPS / BADGES ============ */
.badge{display:inline-block; padding:2px 9px; border-radius:11px; font-size:11px; font-weight:500; background:var(--surface-3); border:1px solid var(--border);}
.badge.good{background:var(--good-soft); border-color:rgba(63,206,108,0.4); color:var(--good)}
.chip-list{display:flex; flex-wrap:wrap; gap:4px; align-items:center}
.chip{display:inline-flex; align-items:center; padding:2px 8px; border-radius:5px; background:var(--surface-2); border:1px solid var(--border);
  font-size:11px; line-height:1.5; color:var(--text-dim); max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.chip.rec{background:var(--good-soft); border-color:rgba(63,206,108,0.3); color:var(--good)}
.chip.owned{color:var(--text-dim)}
.chip.reason{background:var(--warn-soft); border-color:rgba(232,185,76,0.25); color:var(--warn)}
.chip-more{cursor:pointer; padding:2px 8px; border-radius:5px; background:transparent; border:1px dashed var(--border-strong); color:var(--text-muted); font-size:11px}
.chip-more:hover{color:var(--brand); border-color:var(--brand)}

/* ============ EMPTY / LOADING / TOAST ============ */
.empty,.loading{padding:46px 24px; text-align:center; color:var(--text-muted); font-size:13px}
.loading{display:flex; align-items:center; justify-content:center; gap:12px}
.spinner{width:18px; height:18px; border-radius:50%; border:2px solid var(--border-strong); border-top-color:var(--brand); animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.toast{position:fixed; bottom:24px; left:24px; background:var(--surface-2); border:1px solid var(--border-strong); border-radius:var(--radius-sm);
  padding:12px 16px; box-shadow:var(--shadow-lg); font-size:13px; transform:translateY(20px); opacity:0; pointer-events:none; transition:all .25s; z-index:200;}
.toast.show{transform:translateY(0); opacity:1}
.toast.good{border-right:3px solid var(--good)}

/* ============ SMART: ASK BOX ============ */
.ask-box{background:linear-gradient(180deg,var(--surface),var(--bg-elev)); border:1px solid var(--border);
  border-radius:var(--radius); box-shadow:var(--shadow); padding:22px; margin-bottom:20px;}
.ask-box h3{margin:0 0 4px}
.ask-box .ahint{color:var(--text-muted); font-size:12px; margin-bottom:14px}
.ask-row{display:flex; gap:10px; align-items:stretch}
.ask-row textarea{flex:1; background:var(--bg); border:1px solid var(--border-strong); border-radius:var(--radius-sm);
  padding:12px 14px; color:var(--text); font-family:inherit; font-size:14px; resize:vertical; min-height:54px; line-height:1.7;}
.ask-row textarea:focus{outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft)}
.examples{margin-top:12px; display:flex; flex-wrap:wrap; gap:7px}
.example-chip{font-size:11.5px; color:var(--text-dim); background:var(--surface-2); border:1px solid var(--border); border-radius:20px; padding:5px 12px; cursor:pointer;}
.example-chip:hover{border-color:var(--brand); color:var(--brand)}
.dsl-note{margin-top:14px; padding:11px 14px; background:var(--brand-soft); border-right:3px solid var(--brand); border-radius:var(--radius-sm); font-size:12.5px; display:none;}
.dsl-note.show{display:block}
.dsl-note .lbl{color:var(--brand); font-weight:600}
.dsl-note pre{margin:8px 0 0; font-size:10.5px; color:var(--text-muted); white-space:pre-wrap; direction:ltr; text-align:left; max-height:120px; overflow:auto; background:var(--bg); padding:8px; border-radius:5px;}

/* ============ SMART: PRESETS ============ */
.presets{display:grid; grid-template-columns:repeat(auto-fill,minmax(290px,1fr)); gap:12px;}
.preset{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; display:flex; flex-direction:column; gap:8px; transition:all .15s;}
.preset.ok:hover{border-color:var(--brand); background:var(--surface-2); transform:translateY(-2px)}
.preset.disabled{opacity:.55}
.preset .p-head{display:flex; align-items:flex-start; justify-content:space-between; gap:8px}
.preset .p-title{font-size:13.5px; font-weight:600}
.preset .p-desc{font-size:11.5px; color:var(--text-muted); line-height:1.6}
.p-badge{font-size:10px; padding:2px 8px; border-radius:10px; white-space:nowrap; flex-shrink:0}
.p-badge.soon,.p-badge.warn{background:var(--warn-soft); color:var(--warn); border:1px solid rgba(232,185,76,0.4)}
.p-params{display:flex; flex-direction:column; gap:8px; margin-top:6px}
.p-params .pp-label{font-size:11px; color:var(--text-dim)}

/* ============ SMART: CUSTOMER CARDS ============ */
.cards{display:grid; grid-template-columns:repeat(auto-fill,minmax(390px,1fr)); gap:14px; padding:2px}
.ccard{background:linear-gradient(180deg,var(--surface),var(--bg-elev)); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px; display:flex; flex-direction:column; gap:12px; box-shadow:var(--shadow);}
.ccard-head{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap}
.ccard-phone{font-size:16px; font-weight:600; direction:ltr; display:inline-flex; align-items:center; gap:8px; font-variant-numeric:tabular-nums}
.ccard-phone .copy{opacity:.6}
.ccard-phone .copy:hover{opacity:1}
.ccard-tags{display:flex; gap:6px; flex-wrap:wrap}
.dp{display:inline-flex; align-items:center; gap:6px; padding:5px 11px; border-radius:8px; font-size:11.5px;
  background:var(--surface-2); border:1px solid var(--border-strong); color:var(--text); cursor:default; user-select:text;}
.dp .dp-label{color:var(--text-muted); font-size:10.5px}
.dp .dp-val{font-weight:600; font-variant-numeric:tabular-nums}
.dp.tier{background:var(--warn-soft); border-color:rgba(232,185,76,0.4); color:var(--warn)}
.dp.city{background:var(--accent-soft); border-color:rgba(94,170,255,0.35); color:var(--accent)}
.dp.inst{background:var(--brand-soft-2); border-color:rgba(167,139,250,0.4); color:var(--brand)}
.dp.pay{background:var(--good-soft); border-color:rgba(63,206,108,0.35); color:var(--good)}
.dp.muted{opacity:.75}
.dp-grid{display:flex; flex-wrap:wrap; gap:7px}
.ccard-section{display:flex; flex-direction:column; gap:6px}
.ccard-section .sec-label{font-size:10.5px; color:var(--text-muted); font-weight:600}
.ccard-chips{display:flex; flex-wrap:wrap; gap:5px}
.ccard-rec{background:var(--good-soft); border:1px solid rgba(63,206,108,0.25); border-radius:8px; padding:9px 11px;}
.ccard-rec .sec-label{color:var(--good)}
.ccard-action{background:rgba(255,255,255,0.02); border:1px solid var(--border); border-radius:8px; padding:9px 11px; font-size:11.5px; color:var(--text-dim); line-height:1.7;}
.ccard-notes{background:rgba(255,255,255,0.015); border:1px solid var(--border); border-radius:8px; padding:9px 11px; font-size:11px; color:var(--text-muted); line-height:1.7; max-height:90px; overflow-y:auto;}
.detail-section{border:1px solid var(--border);border-radius:8px;margin-bottom:10px;overflow:hidden;background:rgba(255,255,255,.015)}
.detail-section-head{width:100%;display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;border:0;background:var(--surface-2);color:var(--text);font:inherit;font-size:13.5px;font-weight:700;text-align:right;cursor:pointer}
.detail-section-action{font-size:11px;color:var(--muted);font-weight:500}
.detail-section-body{padding:14px;font-size:13px;color:var(--dim);line-height:2}
.detail-note-box{white-space:pre-wrap;font-size:13.5px;line-height:2.15;color:var(--text);background:var(--surface-2);border:1px solid var(--border);border-radius:8px;padding:13px 14px;max-height:260px;overflow:auto}

/* ============ SMART: CALL BRIEF ============ */
.brief{background:var(--brand-soft); border:1px solid rgba(167,139,250,0.25); border-radius:8px; padding:11px 13px; display:flex; flex-direction:column; gap:8px;}
.brief-title{font-size:11.5px; font-weight:700; color:var(--brand); display:flex; align-items:center; gap:6px}
.brief-row{font-size:11.5px; line-height:1.65; color:var(--text)}
.brief-row b{color:var(--brand); font-weight:600}
.brief-bullets{margin:2px 0 0; padding-right:16px; display:flex; flex-direction:column; gap:3px}
.brief-bullets li{font-size:11.5px; line-height:1.6; color:var(--text-dim)}
.brief-warn li{color:var(--warn)}
.ai-btn{margin-top:2px; align-self:flex-start; background:linear-gradient(180deg,var(--brand),var(--brand-2)); color:#fff;
  border:none; border-radius:7px; padding:7px 14px; font-size:11.5px; font-weight:600; display:inline-flex; align-items:center; gap:6px;}
.ai-btn:hover{filter:brightness(1.1)}
.ai-btn:disabled{opacity:.6; cursor:not-allowed}
.ai-out{margin-top:8px; background:var(--bg); border:1px solid rgba(167,139,250,0.3); border-radius:8px; padding:12px 14px; font-size:12px; line-height:1.85; color:var(--text); white-space:pre-wrap; display:none;}
.ai-out.show{display:block}
.ai-out strong{color:var(--brand)}
.ai-copy{margin-top:8px; font-size:11px; padding:5px 11px; background:var(--surface-2); border:1px solid var(--border-strong); border-radius:6px; color:var(--text-dim); cursor:pointer}
.ai-copy:hover{color:var(--brand)}

/* ============ COMPAT (existing JS class names) ============ */
.copy-btn{opacity:0; width:24px; height:24px; padding:0; background:var(--surface-3); border:1px solid var(--border);
  border-radius:5px; display:inline-flex; align-items:center; justify-content:center; color:var(--text-dim);}
tr:hover .copy-btn{opacity:1}
.copy-btn:hover{color:var(--brand); border-color:var(--brand)}
.sb-sub.active{background:var(--brand-soft-2); color:var(--brand); font-weight:600}
.filter{display:flex; flex-direction:column; gap:6px}
.filter label{font-size:11.5px; color:var(--text-dim); display:flex; align-items:center; gap:6px; font-weight:500}
.filter input,.filter select{background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:10px 12px; color:var(--text); font-size:13px; width:100%; transition:all .15s;}
.filter input:focus,.filter select:focus{outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft)}
.filter .hint{font-size:10.5px; color:var(--text-muted); padding-right:4px}
.filter .hint .median-val{color:var(--brand); font-variant-numeric:tabular-nums}
.slice-cell input{background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm); padding:9px 11px; color:var(--text); font-size:13px;}
.slice-cell input:focus{outline:none; border-color:var(--good); box-shadow:0 0 0 3px rgba(63,206,108,0.15)}

/* mobile menu toggle */
.menu-btn{display:none; background:var(--surface-2); border:1px solid var(--border-strong); color:var(--text);
  width:36px; height:36px; border-radius:8px; align-items:center; justify-content:center; font-size:18px;}
@media (max-width:900px){ .menu-btn{display:inline-flex} }

.user-chip{display:flex; align-items:center; gap:8px; font-size:12px; color:var(--text-dim)}
.user-chip .uc-name{color:var(--text)}
.user-chip .uc-logout{padding:5px 10px; border:1px solid var(--border-strong); background:transparent; color:var(--text); border-radius:6px; cursor:pointer; font-size:12px}
.user-chip .uc-logout:hover{background:var(--surface-2)}

/* Optional cap shared by every CSV export surface. */
.export-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.export-row>span:first-child{flex:1;min-width:220px}
.export-limit{display:inline-flex;align-items:center;gap:7px;color:var(--text-dim);font-size:11px;white-space:nowrap}
.export-limit input{width:112px;min-height:38px;padding:7px 9px;border:1px solid var(--border-strong);border-radius:8px;background:var(--bg);color:var(--text);font:inherit;text-align:center}
.export-limit input:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
@media (max-width:600px){
  .export-row,.export-limit{width:100%}
  .export-limit{align-items:flex-start;flex-direction:column;gap:5px;white-space:normal}
  .export-limit input{width:100%;min-height:44px;text-align:right}
  .export-row .btn{width:100%;min-height:44px}
}
