/**
 * B.H. Copyright (c) 2026 Yemot HaMashiach Ltd.
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * Yemot HaMashiach Ltd. ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Yemot HaMashiach Ltd.
 *
 * Unauthorized copying of this file, via any medium, is strictly prohibited.
 */

/* פלטת ימות: פטרול ותכלת על רקע תכלת בהיר, צהוב שמש להקצאה האוטומטית.
   צבע רק כשיש לו משמעות: ירוק = יש קו, אלמוגי = אין קו, תכלת = מופנה לטלפון. */
:root {
  --petrol: #0f5872;
  --blue: #1a8bad;
  --sky: #3fb2d2;
  --sky-soft: #e2f3f9;
  --bg: #f3f9fc;
  --card: #ffffff;
  --ink: #143a4b;
  --muted: #5e7a88;
  --line: #d5e9f1;
  --sun: #f5b82e;
  --sun-soft: #fff4d6;
  --coral: #ee6a5c;
  --coral-soft: #fde8e5;
  --green: #2a9d6f;
  --green-soft: #e1f5ec;
  --grey-soft: #eef2f4;
  --shadow: 0 10px 30px -14px rgba(15, 88, 114, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Assistant', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  min-height: 100vh;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
input, select, textarea, button { font: inherit; color: inherit; }

.waves {
  position: fixed;
  inset: 0 0 auto 0;
  height: 420px;
  z-index: -1;
  background:
    radial-gradient(55% 110% at 88% -25%, rgba(26, 139, 173, 0.16), transparent 70%),
    radial-gradient(45% 90% at 45% -35%, rgba(63, 178, 210, 0.12), transparent 70%),
    radial-gradient(40% 90% at 8% -30%, rgba(245, 184, 46, 0.12), transparent 70%),
    linear-gradient(180deg, #e8f5fa, var(--bg));
  -webkit-mask-image: linear-gradient(180deg, #000 50%, transparent);
  mask-image: linear-gradient(180deg, #000 50%, transparent);
}

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(63, 178, 210, 0.25); }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; color: var(--petrol); }
label small { font-weight: 400; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--blue); }

/* ---------- כפתורים ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; border-radius: 999px; padding: 10px 20px;
  font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform 0.1s, background 0.15s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -8px var(--blue); }
.btn.primary:hover { background: var(--petrol); }
.btn.ghost { background: var(--sky-soft); color: var(--petrol); }
.btn.ghost:hover { background: #cfeaf4; }
.btn.warn { background: var(--sun); color: #4a3500; box-shadow: 0 6px 16px -8px #c48a00; }
.btn.danger { background: var(--coral-soft); color: #b13b2f; }
.btn.small { padding: 7px 14px; font-size: 14px; }
.btn.wide { width: 100%; padding: 12px; }
.btn.icon-only { padding: 10px; }
.link-quiet { color: var(--blue); text-align: center; font-size: 14px; }
.form-error { color: #b13b2f; margin: 0; min-height: 1.2em; font-weight: 600; }

/* ---------- כניסה ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(400px, 100%); background: var(--card); border-radius: 24px; padding: 32px 28px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.brand h1 { font-size: 26px; font-weight: 800; color: var(--petrol); }
.brand p { margin: 2px 0 0; color: var(--muted); }
.brand-mark {
  width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center;
  background: var(--blue); color: #fff; box-shadow: 0 8px 18px -8px var(--blue); flex: none;
}
.brand-mark .ico { width: 26px; height: 26px; }
.brand.small { margin: 0; }
.brand.small h1 { font-size: 21px; }
.brand.small p { font-size: 14px; }
.brand.small .brand-mark { width: 42px; height: 42px; border-radius: 13px; }

/* ---------- מסגרת ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 28px; max-width: 1200px; margin: 0 auto;
}
.me { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--sky-soft); color: var(--petrol); font-weight: 800; font-size: 17px;
}
.role-tag { background: var(--sun-soft); color: #8a6100; padding: 3px 10px; border-radius: 999px; font-size: 13px; }

.page { max-width: 1200px; margin: 0 auto; padding: 4px 28px 60px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.6); color: var(--petrol); font-weight: 700;
  padding: 10px 18px; border-radius: 999px; transition: background 0.15s;
}
.tab:hover { background: var(--card); }
.tab.active { background: var(--petrol); color: #fff; box-shadow: 0 8px 18px -10px var(--petrol); }
.tab .count { background: var(--sky-soft); color: var(--petrol); border-radius: 999px; padding: 0 9px; font-size: 13px; }
.tab.active .count { background: rgba(255, 255, 255, 0.22); color: #fff; }

.notice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--sun-soft); color: #6b4c00; border-radius: 14px; padding: 12px 16px;
  margin-bottom: 16px; font-weight: 600;
}
.notice.error { background: var(--coral-soft); color: #9c3127; }
.notice .btn { margin-inline-start: auto; }

/* ---------- סיכום ---------- */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--card); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px;
}
.stat .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--sky); flex: none; }
.stat.ok .dot { background: var(--green); }
.stat.bad .dot { background: var(--coral); }
.stat.free .dot { background: var(--sun); }
.stat b { font-size: 28px; font-weight: 800; color: var(--petrol); line-height: 1; }
.stat span { color: var(--muted); font-weight: 600; font-size: 14px; }

/* ---------- סרגל ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.search { position: relative; flex-direction: row; width: min(300px, 100%); }
.search > span { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.search input { padding-inline-start: 38px; background: var(--card); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--line); background: var(--card); color: var(--petrol);
  border-radius: 999px; padding: 6px 14px; font-weight: 600; cursor: pointer; font-size: 14px;
}
.chip.active { background: var(--sky-soft); border-color: var(--sky); }

/* ---------- רשימות ---------- */
.list { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: grid; grid-template-columns: 44px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.3fr) auto;
  align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: #f9fcfe; }
.row .name { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: 14px; direction: ltr; text-align: right; unicode-bidi: plaintext; }
.row .meta { color: var(--muted); font-size: 14px; }
.row .actions { display: flex; gap: 6px; justify-content: flex-end; }
.avatar.ok { background: var(--green-soft); color: #1d7552; }
.avatar.bad { background: var(--coral-soft); color: #b13b2f; }
.avatar.fwd { background: var(--sky-soft); color: var(--blue); }

.tag {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px;
  font-size: 14px; font-weight: 700; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.tag.ok { background: var(--green-soft); color: #1d7552; }
.tag.bad { background: var(--coral-soft); color: #b13b2f; }
.tag.fwd { background: var(--sky-soft); color: var(--petrol); }
.tag.other { background: var(--sun-soft); color: #7a5600; }
.tag.free { background: var(--sun-soft); color: #7a5600; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.reg { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.reg::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #b9c7ce; }
.reg.on { color: #1d7552; }
.reg.on::before { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--petrol); margin-bottom: 6px; font-size: 19px; }
.empty .btn { margin-top: 14px; }

/* ---------- הגדרות ---------- */
.lead { color: var(--muted); margin: 0 0 16px; max-width: 720px; line-height: 1.6; }
.key-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.key-card {
  background: var(--card); border-radius: 22px; padding: 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.key-head { display: flex; gap: 12px; align-items: center; }
.key-head h2 { font-size: 20px; color: var(--petrol); }
.key-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.key-mark { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--sky-soft); color: var(--blue); flex: none; }
.key-mark.sun { background: var(--sun-soft); color: #8a6100; }
.key-mark .ico { width: 24px; height: 24px; }
.key-state { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.key-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- חלונות ---------- */
.dialog {
  border: 0; border-radius: 22px; padding: 0; width: min(480px, calc(100% - 32px));
  box-shadow: 0 30px 60px -20px rgba(15, 88, 114, 0.45); color: var(--ink);
}
.dialog.wide { width: min(720px, calc(100% - 32px)); }
.dialog::backdrop { background: rgba(15, 88, 114, 0.28); }
.dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h2 { color: var(--petrol); font-size: 21px; }
.dialog-sub { color: var(--muted); margin: -6px 0 0; line-height: 1.5; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }

.choices { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; }
.choice {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  border: 1.5px solid var(--line); cursor: pointer; font-weight: 600; color: var(--ink);
  flex-direction: row;
}
.choice:has(input:checked) { border-color: var(--sky); background: var(--sky-soft); }
.choice input { width: 18px; height: 18px; accent-color: var(--blue); flex: none; }
.choice .grow { flex: 1; }
.choice small { color: var(--muted); font-weight: 500; }
.choice.create { border-style: dashed; color: var(--blue); }

.plan { display: flex; flex-direction: column; gap: 8px; }
.plan-list { max-height: 330px; overflow: auto; border: 1.5px solid var(--line); border-radius: 14px; }
.plan-row { display: flex; flex-direction: row; color: var(--ink); align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.plan-row:last-child { border-bottom: 0; }
.plan-row .grow { flex: 1; font-weight: 600; }
.plan-row small { color: var(--muted); }
.plan-row input { width: 18px; height: 18px; accent-color: var(--blue); }
.plan-row.failed { background: var(--coral-soft); }
.plan-note { background: var(--sun-soft); color: #6b4c00; border-radius: 12px; padding: 10px 12px; font-weight: 600; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--petrol); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-weight: 700; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}
.toast.error { background: #c2483b; }

.loading { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 860px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .key-cards { grid-template-columns: 1fr; }
  .row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas: 'av info act' 'av tag tag';
    row-gap: 8px;
  }
  .row > .avatar { grid-area: av; align-self: start; }
  .row > .info { grid-area: info; }
  .row > .actions { grid-area: act; }
  .row > .col-tag { grid-area: tag; }
  .row .col-mid { display: none; }
}
@media (max-width: 560px) {
  .topbar { padding: 12px 16px; }
  .page { padding: 4px 16px 48px; }
  .me #me-name { display: none; }
  .brand.small p { display: none; }
  .search { width: 100%; }
}
