/* ===================================================================
   ניהול פרויקטים – חשבים
   שפה עיצובית: סגול-אינדיגו עם הדרגות, כרטיסים רכים, מצב בהיר/כהה
   =================================================================== */

:root, :root[data-theme="light"] {
  --bg: #f3f4fb;
  --bg-glow-1: rgba(124, 92, 255, .14);
  --bg-glow-2: rgba(56, 189, 248, .12);
  --surface: #ffffff;
  --surface-2: #f7f8fd;
  --surface-3: #eef0f9;
  --border: #e5e7f2;
  --border-strong: #d6d9ea;
  --text: #14152b;
  --text-2: #3d4060;
  --muted: #7a7e9e;
  --primary: #7c5cff;
  --primary-ink: #5b3df5;
  --primary-soft: #efebff;
  --grad: linear-gradient(135deg, #7c5cff 0%, #a855f7 50%, #ec4899 100%);
  --danger: #ef4444;
  --danger-soft: #fdecec;
  --good: #10b981;
  --good-soft: #e3f8f0;
  --warn: #d97706;
  --warn-soft: #fff4e0;
  --blue: #3b82f6;
  --blue-soft: #e6f0ff;
  --sidebar: #0f1027;
  --sidebar-2: #181a3a;
  --sidebar-text: #b9bce0;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 21, 43, .04), 0 4px 16px rgba(20, 21, 43, .05);
  --shadow-lg: 0 12px 40px rgba(20, 21, 43, .14);
  --ring: 0 0 0 3px rgba(124, 92, 255, .25);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0b1a;
  --bg-glow-1: rgba(124, 92, 255, .20);
  --bg-glow-2: rgba(236, 72, 153, .10);
  --surface: #13152c;
  --surface-2: #181a35;
  --surface-3: #20234a;
  --border: #252850;
  --border-strong: #33376a;
  --text: #ecedfb;
  --text-2: #c3c6e8;
  --muted: #8b8fbb;
  --primary: #9b85ff;
  --primary-ink: #b6a6ff;
  --primary-soft: #262457;
  --danger: #f87171;
  --danger-soft: #3a1825;
  --good: #34d399;
  --good-soft: #10302a;
  --warn: #fbbf24;
  --warn-soft: #382a10;
  --blue: #60a5fa;
  --blue-soft: #15284a;
  --sidebar: #070815;
  --sidebar-2: #111330;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 16px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Rubik', 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(700px 500px at 0% 110%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0; font-weight: 700; letter-spacing: -.3px; }
h2 { font-size: 16px; margin: 0 0 14px; font-weight: 600; }
h3 { margin: 0 0 16px; font-weight: 600; }
.muted { color: var(--muted); }
.overdue { color: var(--danger) !important; }
.spacer { flex: 1; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ico { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
::selection { background: rgba(124, 92, 255, .25); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== פקדים ===== */
.btn {
  font: inherit; font-weight: 500; padding: 8px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border: none; color: #fff; padding: 9px 18px; box-shadow: 0 6px 18px rgba(124, 92, 255, .35); }
.btn.primary:hover { filter: brightness(1.07); box-shadow: 0 8px 24px rgba(124, 92, 255, .45); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  font: inherit; background: none; border: none; cursor: pointer; padding: 6px; border-radius: 8px;
  color: var(--muted); font-size: 16px; display: inline-flex; align-items: center; justify-content: center; transition: .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.small { font-size: 12px; padding: 3px 6px; }
.link-btn { font: inherit; background: none; border: none; color: var(--primary-ink); cursor: pointer; padding: 0 6px; font-weight: 500; }
.input, select, input[type=date], textarea {
  font: inherit; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.input { width: 100%; }
.input:focus, select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
textarea.input { resize: vertical; }
.search {
  width: 230px; padding-right: 36px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a7e9e' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat right 12px center;
}
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; white-space: nowrap; color: var(--text-2); }
input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--text-2);
}
.prio { font-size: 12px; font-weight: 500; white-space: nowrap; }
.ms-icon { color: #a855f7; }
.chip { display: inline-block; background: var(--primary-soft); color: var(--primary-ink); border-radius: 999px; padding: 2px 10px; margin: 1px 2px; font-size: 13px; }

.avatars { display: inline-flex; flex-direction: row; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--grad); color: #fff; font-size: 11.5px; font-weight: 600; border: 2px solid var(--surface); flex-shrink: 0;
}
.avatars .avatar + .avatar { margin-right: -9px; }
.avatar.more { background: var(--surface-3); color: var(--muted); }
.avatar.small { width: 26px; height: 26px; font-size: 10.5px; }

.progress { position: relative; height: 8px; background: var(--surface-3); border-radius: 99px; min-width: 90px; margin-left: 42px; }
.progress-fill { height: 100%; border-radius: 99px; background-image: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .35)); }
.progress span { position: absolute; left: -42px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; color: var(--text-2); width: 36px; text-align: left; }

/* ===== מבנה ===== */
#app { height: 100%; display: flex; }
.sidebar {
  width: 252px; flex-shrink: 0; color: var(--sidebar-text); display: flex; flex-direction: column; padding: 18px 12px 14px;
  background:
    radial-gradient(400px 260px at 100% 0%, rgba(124, 92, 255, .35), transparent 70%),
    radial-gradient(300px 300px at 0% 100%, rgba(236, 72, 153, .16), transparent 70%),
    linear-gradient(180deg, var(--sidebar-2), var(--sidebar));
  border-left: 1px solid rgba(255, 255, 255, .06);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: #fff; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 12px; background: var(--grad); display: inline-flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 8px 20px rgba(124, 92, 255, .45);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 17px; font-weight: 700; }
.brand-text span { font-size: 12.5px; opacity: .65; }
.brand.big { justify-content: center; color: var(--text); padding-bottom: 4px; }
.brand.big .logo { width: 46px; height: 46px; border-radius: 14px; }
.brand.big .brand-text b { font-size: 21px; }
.nav-main { display: flex; flex-direction: column; gap: 2px; }
.nav-main a, .nav-project {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--sidebar-text);
  text-decoration: none; font-size: 14.5px; transition: background .15s, color .15s; position: relative;
}
.nav-main a .ico { opacity: .8; }
.nav-main a:hover, .nav-project:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-main a.active, .nav-project.active { background: rgba(124, 92, 255, .22); color: #fff; }
.nav-main a.active::before, .nav-project.active::before {
  content: ''; position: absolute; right: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px 0 0 3px; background: var(--grad);
}
.nav-main a.active .ico { opacity: 1; color: #c4b5fd; }
.nav-label { font-size: 11.5px; letter-spacing: .6px; color: rgba(185, 188, 224, .55); padding: 22px 12px 8px; font-weight: 500; }
#nav-projects { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 1px; }
#nav-projects::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); }
.nav-project { font-size: 14px; padding: 7px 12px; }
.nav-project .dot { width: 8px; height: 8px; }
.nav-project span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box {
  display: flex; align-items: center; gap: 6px; padding: 10px; margin-top: 10px; border-radius: 14px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .06);
}
.user-box .avatar { border-color: transparent; width: 34px; height: 34px; }
.user-info { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-info b { color: #fff; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info .muted { color: rgba(185, 188, 224, .6); font-size: 12px; }
.user-box .icon-btn { color: rgba(185, 188, 224, .7); padding: 5px; }
.user-box .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

main { flex: 1; overflow: auto; min-width: 0; }
.page { padding: 28px 34px 60px; max-width: 1520px; animation: fade-in .25s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.empty { color: var(--muted); text-align: center; padding: 34px; }
.note { margin-top: 12px; font-size: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.group-title { margin: 26px 0 12px; font-size: 15px; font-weight: 600; color: var(--text-2); }

/* ===== דשבורד ===== */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
  transition: transform .2s, box-shadow .2s; --k: var(--primary); --k-soft: var(--primary-soft);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi::after { content: ''; position: absolute; left: -30px; bottom: -40px; width: 120px; height: 120px; border-radius: 50%; background: var(--k); opacity: .08; }
.kpi.violet { --k: #7c5cff; --k-soft: var(--primary-soft); }
.kpi.blue { --k: var(--blue); --k-soft: var(--blue-soft); }
.kpi.danger { --k: var(--danger); --k-soft: var(--danger-soft); }
.kpi.good { --k: var(--good); --k-soft: var(--good-soft); }
.kpi.neutral { --k: var(--muted); --k-soft: var(--surface-3); }
.kpi-icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--k-soft); color: var(--k); flex-shrink: 0; }
.kpi-value { font-size: 30px; font-weight: 700; line-height: 1.05; letter-spacing: -.5px; }
.kpi.danger .kpi-value { color: var(--danger); }
.kpi-label { color: var(--muted); font-size: 14px; margin-top: 2px; }
.table-wrap { overflow-x: auto; margin: 0 -22px -20px; }
table.grid, table.tasks { width: 100%; border-collapse: collapse; }
table.grid th, table.tasks th {
  text-align: right; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
table.grid td, table.tasks td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid tbody tr:last-child td, table.tasks tbody tr:last-child td { border-bottom: none; }
tr.clickable, .clickable { cursor: pointer; }
tr.clickable td, table.tasks tbody tr td { transition: background .12s; }
tr.clickable:hover td, table.tasks tbody tr:hover td { background: var(--surface-2); }
.progress-cell { width: 170px; }
.load-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 12px; padding: 7px 0; }
.load-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.load-bar { position: relative; height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.load-fill { position: absolute; top: 0; bottom: 0; right: 0; background: var(--grad); border-radius: 99px; }
.load-over { position: absolute; top: 0; bottom: 0; right: 0; background: var(--danger); border-radius: 99px; }
.load-num { font-size: 13.5px; white-space: nowrap; font-weight: 500; }
.up-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 10px; transition: background .12s; }
.up-row + .up-row { border-top: 1px solid var(--border); }
.up-row:hover { background: var(--surface-2); }
.up-date { width: 64px; flex-shrink: 0; font-weight: 600; font-size: 13px; text-align: center; padding: 4px 0; border-radius: 8px; background: var(--surface-3); color: var(--text-2); }
.up-date.overdue { background: var(--danger-soft); }
.up-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter { min-width: 150px; }

/* ===== פרויקטים ===== */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.project-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 20px 16px;
  color: var(--text); transition: transform .2s, box-shadow .2s, border-color .2s;
}
.project-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--pc, var(--primary)); }
.project-card::after { content: ''; position: absolute; top: -60px; left: -60px; width: 160px; height: 160px; border-radius: 50%; background: var(--pc, var(--primary)); opacity: .08; pointer-events: none; }
.project-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.pc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pc-head b { font-size: 16px; font-weight: 600; }
.pc-stats { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.project-dot { width: 14px; height: 14px; border-radius: 5px; box-shadow: 0 0 0 4px var(--surface-3); }
.head-progress { width: 180px; }
.project-meta { margin: -10px 0 18px; }
.project-desc { margin-top: 6px; color: var(--text-2); white-space: pre-wrap; max-width: 900px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; gap: 2px; background: var(--surface-3); padding: 4px; border-radius: 12px; }
.tab { padding: 7px 18px; border-radius: 9px; color: var(--muted); font-weight: 500; transition: .15s; }
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

table.tasks tbody tr { cursor: pointer; }
.check-col { width: 40px; text-align: center; }
.task-title { font-weight: 500; }
.sub-count { font-weight: 400; font-size: 12.5px; }
tr.is-done td { color: var(--muted); }
tr.is-done .task-title { text-decoration: line-through; text-decoration-color: var(--border-strong); }

/* ===== קנבן ===== */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 16px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-height: 220px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; }
.col-head b { font-weight: 600; }
.col-head .dot { width: 9px; height: 9px; }
.col-head .muted { background: var(--surface-3); border-radius: 99px; padding: 0 8px; font-size: 12.5px; }
.col-cards { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kcard {
  background: var(--surface); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); cursor: grab;
  border: 1px solid var(--border); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.kcard[draggable="false"] { cursor: pointer; }
.kcard:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kcard.dragging { opacity: .4; transform: rotate(2deg); }
.kcard-title { font-weight: 500; margin-bottom: 10px; line-height: 1.35; }
.kcard-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; flex-wrap: wrap; }

/* ===== גאנט ===== */
.gantt { display: flex; flex-direction: column; }
.g-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.seg { display: flex; background: var(--surface-3); padding: 3px; border-radius: 10px; }
.seg button { font: inherit; font-size: 13px; border: none; background: none; padding: 5px 14px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.g-hint { font-size: 12.5px; }
.g-scroll { overflow: auto; max-height: calc(100vh - 270px); min-height: 220px; }
.g-inner { position: relative; }
.g-head { display: flex; position: sticky; top: 0; z-index: 5; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.g-label {
  position: sticky; right: 0; z-index: 4; flex-shrink: 0; background: var(--surface); border-left: 1px solid var(--border);
  display: flex; align-items: center; gap: 7px; height: 38px; padding-left: 8px; overflow: hidden; white-space: nowrap;
}
.g-label a { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.g-label.header a { font-weight: 600; }
.g-corner { height: 48px; background: var(--surface-2); font-weight: 500; color: var(--muted); padding-right: 14px; }
.g-sub { color: var(--muted); font-size: 12px; margin-right: auto; padding-right: 6px; flex-shrink: 0; }
.g-timehead { position: relative; height: 48px; flex-shrink: 0; }
.g-hrow { position: absolute; right: 0; left: 0; height: 24px; }
.g-hrow.top { top: 0; }
.g-hrow.bottom { top: 24px; }
.g-cell {
  position: absolute; top: 0; height: 24px; border-right: 1px solid var(--border); font-size: 11.5px; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 2px; overflow: hidden; white-space: nowrap;
}
.g-hrow.top .g-cell { font-weight: 600; color: var(--text-2); justify-content: flex-start; padding-right: 8px; }
.g-cell.weekend { background: var(--surface-3); }
.g-cell span { font-size: 10px; }
.g-body { position: relative; }
.g-layer { position: absolute; top: 0; pointer-events: none; }
.g-weekend { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--muted) 7%, transparent); }
.g-monthline { position: absolute; top: 0; bottom: 0; border-right: 1px dashed var(--border-strong); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #ec4899; z-index: 1; box-shadow: 0 0 12px rgba(236, 72, 153, .6); }
.g-arrows { position: absolute; top: 0; pointer-events: none; z-index: 3; overflow: visible; }
.g-arrows path { fill: none; stroke: var(--muted); stroke-width: 1.5; opacity: .7; }
.g-arrows path.late { stroke: var(--danger); stroke-dasharray: 4 3; opacity: 1; }
.g-row { display: flex; height: 38px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.g-row.header { background: var(--surface-2); }
.g-row.header .g-label { background: var(--surface-2); }
.g-row:hover, .g-row:hover .g-label { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.g-track { position: relative; flex-shrink: 0; }
.g-track.nodates { cursor: copy; }
.g-track.nodates:hover { background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(124, 92, 255, .07) 6px 12px); }
.g-bar {
  position: absolute; top: 8px; height: 22px; border-radius: 99px; cursor: grab; overflow: hidden; z-index: 2;
  box-shadow: 0 3px 10px rgba(20, 21, 43, .18); transition: filter .15s, box-shadow .15s;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0));
}
.g-bar:hover { filter: brightness(1.08); box-shadow: 0 5px 16px rgba(20, 21, 43, .28); }
.g-bar.summary { top: 12px; height: 14px; border-radius: 4px; opacity: .9; }
.g-progress { position: absolute; top: 0; bottom: 0; right: 0; background: rgba(0, 0, 0, .2); }
.g-bar-label { position: relative; color: #fff; font-size: 12px; font-weight: 500; padding: 0 10px; line-height: 22px; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.g-bar.summary .g-bar-label { line-height: 14px; font-size: 11px; }
.g-handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.g-handle.start { right: 0; }
.g-handle.end { left: 0; }
.g-handle:hover { background: rgba(255, 255, 255, .45); }
.g-milestone {
  position: absolute; top: 11px; width: 16px; height: 16px; transform: rotate(45deg); cursor: grab; z-index: 2; border-radius: 3px;
  box-shadow: 0 0 0 3px var(--surface), 0 3px 10px rgba(124, 92, 255, .5);
}

/* ===== חלונות ===== */
.backdrop {
  position: fixed; inset: 0; background: rgba(10, 11, 26, .45); backdrop-filter: blur(4px); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 26px; width: 460px; max-width: calc(100vw - 32px);
  margin-top: 9vh; box-shadow: var(--shadow-lg); max-height: 82vh; overflow: auto; animation: pop .2s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal.wide { width: 660px; }
.modal .field, .drawer .field { margin-bottom: 14px; }
.modal .input + .field { margin-top: 14px; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: 580px; max-width: 100vw; background: var(--surface); overflow-y: auto;
  box-shadow: 20px 0 60px rgba(0, 0, 0, .25); border-right: 1px solid var(--border); animation: slide .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes slide { from { transform: translateX(-60px); opacity: 0; } }
.actions { display: flex; gap: 8px; margin-top: 20px; align-items: center; }
.confirm-msg { font-size: 16px; margin: 0; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field select, .field input[type=date] { width: 100%; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--surface); cursor: pointer; box-shadow: 0 0 0 1px var(--border); transition: transform .15s; }
.swatch:hover { transform: scale(1.12); }
.swatch.active { box-shadow: 0 0 0 2px var(--text); }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px); opacity: 0; transition: .25s; z-index: 100;
  background: #14152b; color: #fff; padding: 11px 20px; border-radius: 12px; box-shadow: var(--shadow-lg); max-width: 90vw;
  border: 1px solid rgba(255, 255, 255, .08);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-ok::before { content: '✓ '; color: #34d399; font-weight: 700; }
.toast-error { background: #dc2626; }

/* ===== מגירת משימה ===== */
.task-panel { padding: 18px 26px 40px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.crumbs { font-size: 13.5px; color: var(--muted); }
.title-input {
  font: inherit; font-size: 23px; font-weight: 700; width: 100%; border: 1px solid transparent; border-radius: 10px;
  padding: 6px 10px; margin: 0 -10px 14px; background: transparent; color: var(--text);
}
.title-input:hover { border-color: var(--border); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 16px 16px 2px; }
input.overdue { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.section-title { font-weight: 600; margin: 22px 0 10px; font-size: 14.5px; }
.desc { width: 100%; font: inherit; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; resize: vertical; background: var(--surface); color: var(--text); }
.subtask, .dep { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.subtask a, .dep a { color: var(--text); }
.subtask a.done { text-decoration: line-through; color: var(--muted); }
.subtask .muted { margin-right: auto; font-size: 12.5px; }
.subtasks + .input { margin-top: 8px; }
.deps + select { margin-top: 8px; width: 100%; }
.dep .icon-btn { margin-right: auto; }
.warn { color: var(--warn); font-size: 12.5px; }
.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment-body { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 8px 12px; }
.comment-meta { font-size: 12.5px; color: var(--muted); }
.comment-text { white-space: pre-wrap; margin-top: 3px; line-height: 1.5; }
.comments + .input { margin-top: 8px; }
.task-panel .comments ~ .btn.small { margin-top: 8px; }

.assignee-picker { position: relative; }
.picker-btn { font: inherit; width: 100%; min-height: 38px; text-align: right; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 4px 6px; cursor: pointer; }
.picker-menu {
  position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 20; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 300px; overflow-y: auto; padding: 6px;
}
.picker-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.picker-item:hover { background: var(--surface-2); }
.picker-menu .btn { width: 100%; margin-top: 4px; justify-content: center; }

/* ===== כניסה ===== */
.auth {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px;
  background:
    radial-gradient(600px 400px at 20% 20%, rgba(124, 92, 255, .4), transparent 60%),
    radial-gradient(500px 400px at 80% 80%, rgba(236, 72, 153, .28), transparent 60%),
    radial-gradient(400px 300px at 85% 10%, rgba(56, 189, 248, .22), transparent 60%),
    #0f1027;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  padding: 34px; width: 400px; max-width: 100%; display: flex; flex-direction: column; gap: 12px; animation: pop .3s ease-out;
}
.auth-card h2 { text-align: center; margin: 4px 0 6px; font-size: 15px; color: var(--muted); font-weight: 500; }
.auth-card input[dir=ltr] { text-align: right; }
.auth-card .input { padding: 11px 14px; }
.auth-card .btn.primary { padding: 12px; margin-top: 4px; }
.auth-msg { font-size: 14px; color: var(--good); text-align: center; min-height: 1em; }
.auth-msg.error { color: var(--danger); }
.auth-links { display: flex; justify-content: space-between; font-size: 13.5px; }

/* ===== הרשאות ===== */
fieldset.plain { border: none; margin: 0; padding: 0; min-width: 0; }
fieldset.plain:disabled .title-input, fieldset.plain:disabled .desc { background: transparent; color: var(--text); }
fieldset.plain:disabled .picker-btn { cursor: default; background: var(--surface-2); }
.readonly-note { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.badge.readonly { background: var(--warn-soft); color: var(--warn); }
.add-member { display: flex; gap: 8px; margin-top: 14px; }
.add-member select:first-child { flex: 1; }
.role-help { margin-top: 16px; font-size: 13px; line-height: 1.8; }

/* ===== מסכים צרים ===== */
@media (max-width: 900px) {
  #app { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 4px; }
  .brand { padding: 2px 4px; }
  .brand-text span { display: none; }
  .nav-main { flex-direction: row; flex-wrap: wrap; }
  .nav-main a { padding: 7px 10px; font-size: 13.5px; }
  .nav-main a.active::before { display: none; }
  .nav-label, #nav-projects { display: none; }
  .user-box { margin: 0 auto 0 0; padding: 4px; background: none; border: none; }
  .user-info { display: none; }
  .page { padding: 18px 16px 40px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .two-col, .form-grid, .fields { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 270px); }
  .search { width: 100%; }
  .drawer { width: 100vw; }
}

/* ===== סינון לפי מחלקה ===== */
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 20px; }
.filter-chip {
  font: inherit; font-size: 13.5px; display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; transition: .15s;
}
.filter-chip span { background: var(--surface-3); color: var(--muted); border-radius: 999px; padding: 0 8px; font-size: 12px; min-width: 22px; text-align: center; }
.filter-chip:hover { border-color: var(--border-strong); }
.filter-chip.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(124, 92, 255, .35); }
.filter-chip.active span { background: rgba(255, 255, 255, .25); color: #fff; }

/* ===== קנבן: עמודות דינמיות ויעד גרירה ===== */
.col { border-top: 3px solid var(--sc, var(--border)); transition: background .15s, box-shadow .15s; }
.col.drop-target { background: color-mix(in srgb, var(--sc, var(--primary)) 10%, var(--surface-2)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--sc, var(--primary)) 45%, transparent); }

/* ===== הגדרות ===== */
.card-head { padding: 20px 22px 6px; }
.card-head h2 { margin-bottom: 6px; }
.card-head p { margin: 0 0 8px; font-size: 14px; }
.order-cell { width: 70px; white-space: nowrap; }
.order-cell .icon-btn:disabled { opacity: .25; cursor: default; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; font-weight: 500; background: color-mix(in srgb, var(--sc) 14%, transparent); color: var(--text); }
.done-badge { background: var(--good-soft); color: var(--good); }
.row-actions { text-align: left; white-space: nowrap; }
.danger-link { color: var(--danger); }

/* ===== צבע אישי לכל עובד ===== */
.chip { display: inline-flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--pc, var(--primary)) 14%, transparent); color: var(--text); }
.chip .dot { width: 8px; height: 8px; }
.picker-item .dot, .load-name .dot { width: 9px; height: 9px; }
table.grid td .avatar.small { vertical-align: middle; margin-left: 6px; }
.swatch:disabled { opacity: .18; cursor: not-allowed; transform: none; }

/* ===== מתג בהיר / כהה ===== */
.theme-switch {
  display: flex; gap: 2px; padding: 3px; border-radius: 12px; margin-top: 10px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08);
}
.theme-switch button {
  flex: 1; font: inherit; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 10px; border: none; border-radius: 9px; background: none; color: var(--sidebar-text); cursor: pointer; transition: .15s;
}
.theme-switch button:hover { color: #fff; }
.theme-switch button.active { background: var(--grad); color: #fff; box-shadow: 0 4px 12px rgba(124, 92, 255, .4); }
.auth { position: relative; }
.theme-switch.floating { position: absolute; top: 18px; left: 18px; margin: 0; width: 190px; backdrop-filter: blur(6px); }
@media (max-width: 900px) {
  .sidebar > .theme-switch { margin: 0; order: 9; }
  .sidebar > .theme-switch span { display: none; }
}
:root[data-theme="light"] .auth {
  background:
    radial-gradient(600px 400px at 20% 20%, rgba(124, 92, 255, .22), transparent 60%),
    radial-gradient(500px 400px at 80% 80%, rgba(236, 72, 153, .16), transparent 60%),
    radial-gradient(400px 300px at 85% 10%, rgba(56, 189, 248, .16), transparent 60%),
    #eef0fb;
}
:root[data-theme="light"] .theme-switch.floating { background: rgba(255, 255, 255, .7); border-color: var(--border); }
:root[data-theme="light"] .theme-switch.floating button:not(.active) { color: var(--text-2); }
.people-table th:first-child, .people-table td:first-child { width: 30%; }
.people-table th:nth-child(2), .people-table td:nth-child(2) { width: 28%; }
.card-head.with-action { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between; }
.card-head.with-action .btn { flex-shrink: 0; }
.view-toggle { margin-right: 8px; }
.form-note { font-size: 13px; margin: 4px 0 0; }
