/* רכיבים: כפתורים, שדות, כרטיסים, תגיות, טאבים, דיאלוגים, טוסטים, תפריטים, שלדים */

/* ---------- כפתורים ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-block-size: var(--touch); padding: 0 18px;
  border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s; position: relative; user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
[data-theme="dark"] .btn-danger { color: #1a0505; }
.btn-soft { background: var(--brand-soft); color: var(--brand-text); }
.btn-soft:hover:not(:disabled) { background: var(--brand-soft-2); }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { min-block-size: 36px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn-block { inline-size: 100%; }
.btn.is-busy { color: transparent !important; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: ''; position: absolute; inline-size: 18px; block-size: 18px; border-radius: 50%; border: 2px solid currentColor;
  border-color: var(--text-3) transparent var(--text-3) transparent; animation: spin 0.8s linear infinite;
}
.btn-primary.is-busy::after { border-color: var(--brand-contrast) transparent var(--brand-contrast) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  inline-size: var(--touch); block-size: var(--touch); display: inline-grid; place-items: center; border-radius: 10px; border: 0;
  background: transparent; color: var(--text-2); flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { inline-size: 36px; block-size: 36px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- שדות ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-block-end: 16px; min-inline-size: 0; }
.field > label, .label { font-weight: 600; font-size: 14px; color: var(--text); }
.field-help { font-size: 13px; color: var(--text-3); }
.field-error { font-size: 13px; color: var(--danger-text); font-weight: 500; }
.input, .select, textarea.input {
  inline-size: 100%; min-block-size: var(--touch); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 16px; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { resize: vertical; line-height: 1.6; }
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input::placeholder { color: var(--text-3); opacity: 0.85; }
.select { padding-block: 8px; cursor: pointer; }
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group > .input { flex: 1; min-inline-size: 0; }
.input-wrap { position: relative; }
/* ריפוד סימטרי: השדה עשוי להיות LTR (סיסמה/טוקן) בתוך ממשק RTL */
.input-wrap .input { padding-inline: 48px; }
.input-wrap .icon-btn { position: absolute; inset-inline-end: 0; inset-block-start: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; min-block-size: var(--touch); cursor: pointer; }
.checkbox-row input { inline-size: 20px; block-size: 20px; accent-color: var(--brand); flex: none; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-inline-size: 0; }
legend { font-weight: 600; font-size: 14px; margin-block-end: 8px; padding: 0; }

/* מתג */
.switch-row { margin-block-end: 12px; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; min-block-size: var(--touch); }
.switch-input { position: absolute; opacity: 0; inline-size: 1px; block-size: 1px; }
.switch-track { inline-size: 46px; block-size: 28px; border-radius: 14px; background: var(--border-strong); position: relative; flex: none; transition: background 0.2s; }
.switch-thumb { position: absolute; inset-block-start: 3px; inset-inline-start: 3px; inline-size: 22px; block-size: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: inset-inline-start 0.2s; }
.switch-input:checked + .switch-track { background: var(--brand); }
.switch-input:checked + .switch-track .switch-thumb { inset-inline-start: 21px; }
.switch-input:focus-visible + .switch-track { box-shadow: var(--focus); }
.switch-text { display: flex; flex-direction: column; }
.switch-label { font-weight: 600; }

/* ---------- כרטיסים ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); min-inline-size: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block-end: 12px; }
.card-title { font-size: 16px; font-weight: 700; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card-grid > .card { margin: 0; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card-link { text-decoration: none; color: inherit; display: block; transition: border-color 0.15s, box-shadow 0.15s; }
.card-link:hover { border-color: var(--brand); box-shadow: var(--shadow); }

/* ---------- תגיות סטטוס וצ'יפים ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: color-mix(in srgb, var(--st, var(--st-draft)) 14%, transparent); color: var(--st, var(--st-draft)); }
.badge .dot { inline-size: 7px; block-size: 7px; border-radius: 50%; background: currentColor; }
:root:not([data-theme="dark"]) .badge { color: color-mix(in srgb, var(--st, var(--st-draft)) 85%, #000); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge { color: var(--st, var(--st-draft)); } }
.st-draft { --st: var(--st-draft); } .st-pending { --st: var(--st-pending); } .st-changes { --st: var(--st-changes); }
.st-approved { --st: var(--st-approved); } .st-scheduled { --st: var(--st-scheduled); } .st-publishing { --st: var(--st-publishing); }
.st-published { --st: var(--st-published); } .st-partial { --st: var(--st-partial); } .st-failed { --st: var(--st-failed); }
.badge-stable { --st: var(--st-published); } .badge-experimental { --st: var(--st-pending); } .badge-soon { --st: var(--st-draft); }
.badge-danger { --st: var(--st-failed); } .badge-info { --st: var(--st-scheduled); }

.prov-badge { display: inline-grid; place-items: center; border-radius: 50%; background: var(--c); color: #fff; flex: none; }
.prov-badge .icon { stroke-width: 2; }
.ch-chip { display: inline-flex; align-items: center; gap: 6px; padding-block: 3px; padding-inline: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; font-weight: 500; max-inline-size: 100%; }
.ch-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--text); }
.tag-chip .dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--c); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- טאבים ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-block-end: 1px solid var(--border); margin-block-end: 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; min-block-size: var(--touch); padding: 0 14px; border: 0; background: none; white-space: nowrap;
  color: var(--text-2); font-weight: 600; font-size: 15px; border-block-end: 3px solid transparent; margin-block-end: -1px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--brand-text); border-block-end-color: var(--brand); }
.tab-count { background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 700; min-inline-size: 22px; text-align: center; }
.tab-count.danger { background: var(--danger); color: #fff; }
.tabs.pills { border: 0; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: 12px; display: inline-flex; max-inline-size: 100%; }
.tabs.pills .tab { border: 0; border-radius: 9px; min-block-size: 38px; margin: 0; padding: 0 14px; }
.tabs.pills .tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- דיאלוגים ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  inline-size: min(560px, calc(100vw - 32px)); max-block-size: min(88dvh, 900px); display: flex; flex-direction: column; overflow: hidden;
}
dialog.modal:not([open]) { display: none; }
dialog.modal::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
dialog.modal-sm { inline-size: min(440px, calc(100vw - 32px)); }
dialog.modal-lg { inline-size: min(860px, calc(100vw - 32px)); }
dialog.modal-xl { inline-size: min(1080px, calc(100vw - 32px)); }
dialog.modal[open] { animation: pop 0.18s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 10px; padding-inline-end: 8px; border-block-end: 1px solid var(--border); }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-block-start: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
@media (max-width: 767px) {
  dialog.modal.sheet {
    inline-size: 100vw; max-inline-size: 100vw; margin: 0; margin-block-start: auto; border-end-start-radius: 0; border-end-end-radius: 0;
    max-block-size: 92dvh; padding-block-end: env(safe-area-inset-bottom);
  }
  dialog.modal.sheet[open] { animation: sheet 0.22s ease-out; }
  dialog.modal-full.sheet { max-block-size: 100dvh; block-size: 100dvh; border-radius: 0; }
  .modal-foot .btn { flex: 1; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0.4; } }

/* ---------- טוסטים ---------- */
.toasts[popover] { inset: auto; margin: 0; border: 0; padding: 0; background: transparent; overflow: visible; color: inherit; }
.toasts { position: fixed; z-index: 1000; inset-block-end: 20px; inset-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; max-inline-size: min(420px, calc(100vw - 32px)); pointer-events: none; }
@media (max-width: 767px) { .toasts { inset-inline: 16px; inset-block-end: calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 12px); max-inline-size: none; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 8px; padding-inline-start: 14px; border-radius: 12px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); animation: toastIn 0.2s ease-out; font-weight: 500;
}
.toast.out { opacity: 0; transform: translateY(6px); transition: 0.2s; }
.toast-msg { flex: 1; }
.toast-error { background: var(--danger); color: #fff; }
.toast-success .icon { color: #6ee7a0; }
.toast-warning .icon { color: #f5c451; }
.toast-action { background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 8px; min-block-size: 34px; padding: 0 10px; font-weight: 700; }
.toast-close { background: transparent; border: 0; color: inherit; opacity: 0.8; inline-size: 34px; block-size: 34px; display: grid; place-items: center; border-radius: 8px; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }

/* ---------- תפריט ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; z-index: 50; inset-inline-end: 0; inset-block-start: calc(100% + 4px); min-inline-size: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
}
.menu-item { display: flex; align-items: center; gap: 10px; min-block-size: var(--touch); padding: 0 12px; border: 0; background: none; border-radius: 8px; text-align: start; font-size: 15px; color: var(--text); white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); box-shadow: none; }
.menu-item.danger { color: var(--danger-text); }
.menu-item:disabled { opacity: 0.45; }

/* ---------- שלדים, ריק ---------- */
.skel-wrap { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.skel { block-size: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel-title { block-size: 20px; inline-size: 50%; margin-block-end: 12px; }
.skel-card .skel { margin-block-end: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text-2); }
.empty-icon { inline-size: 64px; block-size: 64px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); display: grid; place-items: center; margin-block-end: 4px; }
.empty h3 { font-size: 18px; color: var(--text); }
.empty p { max-inline-size: 420px; }
.empty .btn { margin-block-start: 8px; }

/* ---------- הודעות ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--info-soft); color: var(--info-text); font-size: 14.5px; margin-block-end: 16px; }
.alert .icon { margin-block-start: 2px; }
.alert-warning { background: var(--warning-soft); color: var(--warning-text); }
.alert-danger { background: var(--danger-soft); color: var(--danger-text); }
.alert-success { background: var(--success-soft); color: var(--success-text); }
.alert-body { flex: 1; min-inline-size: 0; }
.alert-body strong { display: block; margin-block-end: 2px; }

/* ---------- פלטת צבעים ---------- */
.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { inline-size: 34px; block-size: 34px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); position: relative; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--text); }
.swatch-custom { background: conic-gradient(#f43f5e, #f59e0b, #22c55e, #06b6d4, #6366f1, #d946ef, #f43f5e); overflow: hidden; cursor: pointer; }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; inline-size: 100%; block-size: 100%; }

/* ---------- רשימות ---------- */
.list { display: flex; flex-direction: column; list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-block-end: 1px solid var(--border); min-block-size: 60px; }
.list-row:last-child { border-block-end: 0; }
.list-main { flex: 1; min-inline-size: 0; }
.list-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sub { font-size: 13.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 15px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 600; min-inline-size: 0; overflow-wrap: anywhere; }

.progress { block-size: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; block-size: 100%; background: var(--brand); border-radius: 3px; transition: inline-size 0.2s; }

.divider { block-size: 1px; background: var(--border); margin-block: 16px; border: 0; }
.kbd-hint { font-size: 12px; color: var(--text-3); }
.spacer { flex: 1; }

/* טופס בכרטיס: ריווח בין שדות */
.stack { display: flex; flex-direction: column; gap: 12px; }
.page-narrow > .card + .card { margin-block-start: 16px; }
.side-user-text { color: inherit; text-decoration: none; }
.side-user-text:hover .side-user-name { text-decoration: underline; }

/* חלון הסבר להתקנת האפליקציה (כשהדפדפן לא נותן כפתור התקנה משלו) */
.install-help { text-align: center; }
.install-icon { display: block; margin-inline: auto; border-radius: 18px; box-shadow: 0 4px 16px rgb(0 0 0 / 15%); }
.install-help p { color: var(--text-2); margin-block: 12px 16px; line-height: 1.6; }
.install-steps { text-align: start; margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 10px; line-height: 1.5; }
.install-steps li::marker { color: var(--brand); font-weight: 700; }

/* אפשרויות הפרסום הישיר לטיקטוק (דרישות ה-UX של טיקטוק) */
.tt-opts { margin-block-start: 16px; display: flex; flex-direction: column; gap: 14px; }
.tt-head { display: flex; align-items: center; gap: 8px; }
.tt-head h3 { margin: 0; font-size: 16px; }
.tt-who { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.tt-avatar { border-radius: 50%; flex: none; object-fit: cover; }
.tt-avatar-empty { inline-size: 40px; block-size: 40px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.tt-toggles, .tt-commercial, .tt-commercial-kinds { display: flex; flex-direction: column; gap: 10px; }
.tt-commercial { padding-block-start: 12px; border-block-start: 1px solid var(--border); }
.tt-commercial-kinds { padding-inline-start: 16px; border-inline-start: 2px solid var(--border); }
.tt-music { font-size: 12.5px; color: var(--text-3); margin: 0; line-height: 1.5; }
.cmp-actions .tt-music { max-inline-size: 42ch; }

/* בורר שפת הממשק */
.lang-btn .lang-code { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.lang-menu { position: fixed; z-index: 60; min-inline-size: 190px; }
.lang-menu .menu-item { justify-content: flex-start; }
.lang-menu .menu-item.is-active { background: var(--surface-2); font-weight: 600; }
.lang-flag { font-size: 18px; line-height: 1; }
.lang-check { margin-inline-start: auto; color: var(--brand); }
