/* עיצוב CRM מקצועי לשוק מיוזיק.
   נטען אחרי app.css. שתי ערכות: crm (בהיר) ו-crm-dark (כהה).
   עקרונות: משטחים ניטרליים, צבע הדגשה אחד (כתום המותג) רק לפעולות ולמה שחשוב,
   היררכיה ברורה, צפיפות נוחה במחשב (טבלאות), כרטיסים במובייל, ומסגרות דקות במקום צללים כבדים. */

[data-theme="crm"] {
  --bg: #F4F5F7;
  --bg-fx: none;
  --surface: #FFFFFF;
  --surface-2: #F2F4F7;
  --surface-3: #E9ECF1;
  --text: #101828;
  --muted: #667085;
  --line: #E4E7EC;
  --accent: #E8590C;
  --accent-ink: #C2410C;
  --accent-soft: #FFF1E7;
  --on-accent: #FFFFFF;
  --hero: #101828;
  --on-hero: #FFFFFF;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgb(16 24 40 / .05);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / .12);
  --glass: none;
  --nav-bg: #FFFFFF;
  --nav-text: #667085;
  --nav-active: #C2410C;
  --nav-active-bg: #FFF1E7;
  --font-head: 'Heebo', system-ui, sans-serif;
  --head-weight: 800;
  --num-weight: 800;
  color-scheme: light;
}
[data-theme="crm-dark"] {
  --bg: #0B0D12;
  --bg-fx: none;
  --surface: #12151C;
  --surface-2: #181C25;
  --surface-3: #202532;
  --text: #E6E8EC;
  --muted: #98A2B3;
  --line: #242A36;
  --accent: #F97316;
  --accent-ink: #FDBA74;
  --accent-soft: rgb(249 115 22 / .14);
  --on-accent: #111111;
  --hero: #F97316;
  --on-hero: #111111;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-lg: 0 16px 40px rgb(0 0 0 / .5);
  --glass: none;
  --nav-bg: #10131A;
  --nav-text: #98A2B3;
  --nav-active: #FDBA74;
  --nav-active-bg: rgb(249 115 22 / .14);
  --font-head: 'Heebo', system-ui, sans-serif;
  --head-weight: 800;
  --num-weight: 800;
  color-scheme: dark;
}

/* ---------- רכיבים משותפים לשתי הערכות ---------- */
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) {
  --c-red: #E5484D; --c-orange: #F76B15; --c-yellow: #D99A00; --c-green: #16A34A; --c-teal: #0E9F9A; --c-blue: #2E6BE6; --c-purple: #7C4DCC; --c-gray: #8B8D98;
}
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) body { font-size: 16px; letter-spacing: -.005em; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) h1,
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) h2 { letter-spacing: -.02em; }

/* כותרת עליונה */
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .top { min-height: 64px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .top__title h1 { font-size: 21px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .icon-btn { width: 42px; height: 42px; border: 1px solid var(--line); box-shadow: none; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .avatar { width: 40px; height: 40px; font-size: 14px; color: var(--accent-ink); background: var(--accent-soft); }
.gsearch { display: none; }
.top__search { display: grid; }
[data-theme="photo-immersive"] .top__search, [data-theme="playful-blocks"] .top__search { display: none; }

/* כרטיסים ורשימות */
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .card,
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .item,
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .kpi,
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .action { box-shadow: var(--shadow); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .item { padding: 12px 14px; border-radius: 12px; transition: border-color .15s, background .15s; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .item:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .item__av { width: 40px; height: 40px; border-radius: 50%; font-size: 14px; color: var(--accent-ink); background: var(--accent-soft); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .list { gap: 8px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .section { margin-top: 28px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .section__head h2 { font-size: 17px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .section__head a { color: var(--accent-ink); font-size: 14px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .money { font-weight: 700; font-variant-numeric: tabular-nums; }

/* תגיות מצב: עדינות, עם נקודה, פינות קטנות */
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .status { height: 26px; padding: 0 9px; border-radius: 7px; font-size: 13px; font-weight: 700; color: color-mix(in srgb, var(--c) 82%, var(--text)); background: color-mix(in srgb, var(--c) 13%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .statuses button { height: 36px; border-radius: 8px; font-size: 14px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .statuses button.on { color: #fff; }

/* מסננים וכפתורים */
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .chip-btn { height: 36px; border-radius: 8px; font-weight: 600; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .chip-btn.on { color: var(--accent-ink); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .btn { min-height: 48px; border-radius: 10px; font-weight: 700; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .btn--sm { min-height: 40px; border-radius: 8px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .btn--primary { box-shadow: 0 1px 2px rgb(16 24 40 / .08), inset 0 -1px 0 rgb(0 0 0 / .12); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .fab { height: 52px; border-radius: 14px; box-shadow: var(--shadow-lg); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .search input { height: 46px; border-radius: 10px; box-shadow: none; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .search .i { top: 12px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .seg-view { border-radius: 10px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .seg-view button { border-radius: 8px; height: 34px; }

/* טפסים */
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .f input,
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .f textarea,
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .f select { min-height: 48px; border-radius: 10px; border-width: 1px; font-size: 16px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .pills label { height: 40px; border-radius: 8px; border-width: 1px; font-weight: 600; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .pills label:has(input:checked) { color: var(--accent-ink); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .pills label.st:has(input:checked) { color: #fff; background: var(--c); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .switch { border-width: 1px; border-radius: 10px; }

/* דשבורד */
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .greet h1 { font-size: 26px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .kpi { padding: 16px 18px; border-radius: 14px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .kpi b { font-size: 28px; font-variant-numeric: tabular-nums; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .kpi:first-child b { font-size: 34px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .kpi span { font-size: 13.5px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .kpi:first-child { background: var(--hero); }

/* כרטיס פרטים */
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .detail-hero h2 { font-size: 24px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .action { border-radius: 12px; padding: 10px 6px; font-size: 13.5px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .action .i { color: var(--accent-ink); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .fields div { padding: 12px 0; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .fields dt { font-weight: 500; }

/* לוח עמודות */
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .col__head { font-size: 15px; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .col .item { border-radius: 10px; }

/* ניווט תחתון במובייל: סרגל נקי עם תוויות */
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .nav { left: 0; right: 0; bottom: 0; max-width: none; margin: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; backdrop-filter: blur(14px); background: color-mix(in srgb, var(--nav-bg) 92%, transparent); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .nav a { min-width: 0; flex: 1; padding: 7px 4px; border-radius: 10px; font-size: 11.5px; font-weight: 600; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .nav a span { display: block; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .nav a.on { font-weight: 800; }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .fab { bottom: calc(84px + env(safe-area-inset-bottom)); }
:is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .toast { border-radius: 12px; }

/* ---------- תפריט צד (רק במחשב) ---------- */
.side { display: none; }

/* ---------- טבלה (רק במחשב) ---------- */
.tbl-wrap { margin-top: 14px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
.tbl th { position: sticky; top: 0; z-index: 1; padding: 10px 12px; text-align: right; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; line-height: 1.3; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); max-width: 140px; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.tbl tbody tr { cursor: pointer; transition: background .12s; }
.tbl tbody tr:hover, .tbl tbody tr:focus-visible { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); outline: none; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: left; font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl .late { color: var(--c-red); font-weight: 700; }
.tbl__title { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.tbl__av { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; font-size: 12px; font-weight: 800; color: var(--accent-ink, var(--accent)); background: var(--accent-soft, var(--surface-2)); }

/* ---------- ציר פעילות ---------- */
.tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.tl li { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding-bottom: 14px; }
.tl li::before { content: ""; position: absolute; top: 26px; bottom: 0; right: 13px; width: 2px; background: var(--line); }
.tl li:last-child::before { display: none; }
.tl__dot { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--c, var(--c-gray)) 15%, var(--surface)); color: var(--c, var(--c-gray)); }
.tl__dot .i { width: 15px; height: 15px; }
.tl b { display: block; font-size: 14.5px; font-weight: 700; }
.tl p { margin: 2px 0 0; font-size: 14px; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.tl small { font-size: 12.5px; color: var(--muted); }

/* בין טאבלט למחשב: סרגל תחתון ותוכן ממורכז */
@media (min-width: 960px) and (max-width: 1023px) {
  :is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .app { margin: 0 auto; max-width: 760px; padding-bottom: 120px; }
  :is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .savebar { right: 0; }
}

/* ---------- מחשב ---------- */
@media (min-width: 1024px) {
  :is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .nav { display: none; }
  :is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .side { position: fixed; z-index: 30; top: 0; bottom: 0; right: 0; width: 248px; display: flex; flex-direction: column; background: var(--nav-bg); border-left: 1px solid var(--line); }
  .side__brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
  .side__brand img { width: 36px; height: 36px; border-radius: 10px; }
  .side__brand b { display: block; font-size: 15px; font-weight: 800; line-height: 1.2; }
  .side__brand small { display: block; font-size: 13px; color: var(--muted); }
  .side__scroll { flex: 1; overflow-y: auto; padding: 10px 10px 20px; scrollbar-width: thin; }
  .side__group { display: grid; gap: 2px; margin-top: 10px; }
  .side__label { padding: 6px 10px 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
  .side a:not(.side__brand) { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--text); }
  .side a:not(.side__brand) .i { width: 19px; height: 19px; color: var(--muted); }
  .side a:not(.side__brand):hover { background: var(--surface-2); }
  .side a.on { color: var(--nav-active); background: var(--nav-active-bg); font-weight: 800; }
  .side a.on .i { color: var(--nav-active); }
  .side a em { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 7px; display: grid; place-items: center; border-radius: 999px; font-style: normal; font-size: 12px; font-weight: 800; color: #fff; background: var(--c-red); }

  :is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .app { max-width: 1280px; margin: 0 248px 0 auto; padding: 0 28px 110px; }
  .gsearch { position: relative; display: block; width: min(380px, 34vw); }
  .gsearch input { width: 100%; height: 42px; padding: 0 40px 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); outline: none; font-size: 15px; }
  .gsearch input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
  .gsearch .i { position: absolute; top: 10px; right: 12px; width: 20px; height: 20px; color: var(--muted); }
  .top__search { display: none !important; }
  .top { padding: 14px 0; margin-bottom: 8px; }
  .top__title h1 { font-size: 24px; }

  :is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .savebar { right: 248px; }
  .fab { left: 32px; bottom: 28px !important; }
  .toast { bottom: 28px; }

  .kpis, .kpis:has(.kpi:nth-child(4)), :is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis:has(.kpi:nth-child(4)) .kpi:not(:first-child) b { font-size: 28px; }
  :is([data-theme="crm"], [data-theme="crm-dark"], [data-theme="stage"]) .quick { display: none; }
  .kpis .kpi:first-child { grid-column: auto; }
  .home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; align-items: start; }
  .home-grid .list { grid-template-columns: minmax(0, 1fr); }

  .dgrid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 24px; align-items: start; }
  .dside > .section:first-child, .dside > section:first-child { margin-top: 6px; }
  .dside .list { grid-template-columns: minmax(0, 1fr); }
  .dside { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; padding-bottom: 20px; scrollbar-width: thin; }

  .col { width: 290px; }
  .board { margin-inline: 0; padding-inline: 0; }
}
