:root{
  --navy:#1a3069; --blue:#2273d9; --blue-strong:#1650a7; --sky:#eaf2fc;
  --bg:#f5f8fd; --panel:#ffffff; --line:#d7e2f2; --ink:#1a2340; --dim:#64748f;
  --orange:#f0821e; --orange2:#ff9d3f;
  --good:#15803d; --warn:#b45309; --bad:#dc2626;
}
*{box-sizing:border-box; margin:0}
html{font-size:17px}
body{font-family:'Heebo',sans-serif; background:var(--bg); color:var(--ink); min-height:100vh;
  font-size:1rem}
a{color:var(--blue-strong); text-decoration:none}
main{max-width:1240px; margin:24px auto; padding:0 20px}

.topbar{display:flex; align-items:center; gap:22px; padding:10px 28px;
  background:#fff; border-bottom:3px solid var(--navy);
  position:sticky; top:0; z-index:10; box-shadow:0 2px 12px rgba(26,48,105,.08)}
.brand{display:flex; align-items:center; gap:10px}
.brand img{height:44px}
.topbar nav{display:flex; gap:6px}
.topbar nav a{color:var(--navy); font-weight:600; padding:7px 13px; border-radius:8px; font-size:17px}
.topbar nav a:hover{background:var(--sky); color:var(--blue-strong)}
.topsearch{flex:1; position:relative}
.topsearch input{width:100%; max-width:430px; padding:9px 16px; border-radius:20px;
  border:1.5px solid var(--line); background:var(--sky); color:var(--ink); font-family:inherit}
.topsearch input:focus{outline:none; border-color:var(--blue)}
.userbox{color:var(--dim); font-size:14px}
.flash{background:#e8f7ed; border:1px solid var(--good); color:#14532d;
  padding:10px 16px; border-radius:10px; margin-bottom:16px}

.grid{display:grid; gap:16px}
.g4{grid-template-columns:repeat(4,1fr)} .g3{grid-template-columns:repeat(3,1fr)}
.g2{grid-template-columns:2fr 1fr}
@media(max-width:900px){.g4,.g3,.g2{grid-template-columns:1fr}}

.card{background:var(--panel); border:1px solid var(--line); border-radius:14px;
  padding:18px 20px; box-shadow:0 3px 14px rgba(26,48,105,.06)}
.card h3{font-size:15px; color:var(--dim); font-weight:600; margin-bottom:6px}
.kpi{font-size:32px; font-weight:800; color:var(--navy)}
.kpi small{font-size:15px; color:var(--dim); font-weight:400}
.kpi.orange{color:var(--orange)}
.sub{color:var(--dim); font-size:14.5px; margin-top:4px}
.section-title{margin:26px 0 14px; font-size:22px; color:var(--navy); font-weight:800;
  border-right:4px solid var(--orange); padding-right:10px}

table{width:100%; border-collapse:collapse; font-size:16px}
th{color:var(--blue-strong); text-align:right; font-weight:700; padding:10px 12px;
  border-bottom:2px solid var(--line); font-size:14.5px; white-space:nowrap}
th.sortable{cursor:pointer; user-select:none}
th.sortable:hover{color:var(--orange)}
th .sort-ind{font-size:10px; color:var(--orange)}
td{padding:11px 12px; border-bottom:1px solid #e8eefa}
tr:hover td{background:var(--sky)}
.num{font-variant-numeric:tabular-nums; direction:ltr; text-align:right; unicode-bidi:isolate}
.thnum{text-align:right}
.datatable th, .datatable td{text-align:right}

.badge{display:inline-block; padding:3px 12px; border-radius:12px; font-size:14px; font-weight:700}
.b-חיים{background:#dbeafe; color:#1d4ed8} .b-בריאות{background:#dcfce7; color:#15803d}
.b-משכנתא{background:#ffedd5; color:#c2410c} .b-חיסכון{background:#f3e8ff; color:#7e22ce}

.btn{display:inline-block; background:var(--blue-strong);
  color:#fff; font-weight:700; border:none; padding:10px 22px; border-radius:10px;
  cursor:pointer; font-family:inherit; font-size:16px}
.btn:hover{background:var(--navy)}
.btn.orange{background:var(--orange)}
.btn.orange:hover{background:#d97110}
.btn.ghost{background:transparent; color:var(--blue-strong); border:1.5px solid var(--blue-strong)}
.btn.ghost:hover{background:var(--sky)}
input,select,textarea{background:#fff; border:1.5px solid var(--line); color:var(--ink);
  border-radius:8px; padding:9px 13px; font-family:inherit; font-size:15.5px}
input:focus,select:focus,textarea:focus{outline:none; border-color:var(--blue)}
label{font-size:14px; color:var(--dim); display:block; margin-bottom:3px}
.filters{display:flex; gap:12px; flex-wrap:wrap; align-items:end; margin-bottom:16px}

.login-wrap{max-width:400px; margin:9vh auto; text-align:center}
.login-wrap .card{padding:36px; border-top:4px solid var(--navy)}
.login-wrap img{max-width:280px; margin-bottom:14px}
.login-wrap input{width:100%; margin-bottom:12px}

.pol-head{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.pol-num{font-size:21px; font-weight:800; color:var(--navy)}
.muted{color:var(--dim)}
.timeline{list-style:none}
.timeline li{padding:10px 14px; border-right:3px solid var(--orange); margin-bottom:10px;
  background:var(--sky); border-radius:8px}
.timeline .meta{font-size:13.5px; color:var(--dim)}
.chip{background:var(--sky); border:1px solid var(--line); padding:4px 12px;
  border-radius:10px; font-size:14.5px; display:inline-block; margin:2px; color:var(--ink)}
a.chip:hover{border-color:var(--blue); background:#dcebfc}
.inline-form{display:flex; gap:8px; flex-wrap:wrap; align-items:end}
.danger{color:var(--bad)}

.contact-lines{font-size:16.5px; line-height:1.75}
.contact-lines .num{font-size:17px; font-weight:600}

.viewtoggle{display:flex; border:1.5px solid var(--blue-strong); border-radius:10px; overflow:hidden}
.viewtoggle a{padding:7px 16px; color:var(--blue-strong); font-weight:600; font-size:14px}
.viewtoggle a.on{background:var(--blue-strong); color:#fff}

.arrow{display:inline-block; transition:transform .15s; color:var(--orange); font-size:12px}
.arrow.open{transform:rotate(-90deg)}
.hh-row td{font-size:14.5px}

.suggest{position:absolute; top:100%; right:0; min-width:300px; z-index:50;
  background:#fff; border:1.5px solid var(--blue); border-radius:10px;
  box-shadow:0 10px 30px rgba(26,48,105,.25); overflow:hidden}
.suggest:empty{display:none}
.sitem{padding:9px 14px; cursor:pointer; font-size:14px; border-bottom:1px solid var(--line)}
.sitem:hover{background:var(--sky)}

.calendar{table-layout:fixed}
.calendar th{text-align:center; color:var(--blue-strong); padding:6px 2px}
.cal-day{vertical-align:top; height:82px; border:1px solid var(--line); padding:4px; font-size:11.5px}
.cal-empty{border:1px solid transparent}
.cal-num{font-weight:700; color:var(--dim); margin-bottom:3px}
.cal-today{background:var(--sky); outline:2px solid var(--orange); outline-offset:-2px}
.cal-today .cal-num{color:var(--orange)}
.cal-event{display:block; background:#dbeafe; color:#1d4ed8; border-radius:6px;
  padding:2px 5px; margin-bottom:3px; font-size:10.5px; line-height:1.35;
  overflow:hidden; white-space:nowrap; text-overflow:ellipsis}
.cal-event.k-פגישה{background:#ffedd5; color:#c2410c}
.cal-event.k-משימה{background:#fef9c3; color:#854d0e}
.cal-event.done{opacity:.45; text-decoration:line-through}
.cal-event:hover{filter:brightness(.93)}

/* התאמה לנייד */
@media(max-width:760px){
  .topbar{flex-wrap:wrap; gap:10px; padding:8px 12px}
  .brand img{height:32px}
  .topbar nav{order:3; width:100%; justify-content:space-around; gap:0}
  .topbar nav a{padding:6px 8px; font-size:13.5px}
  .topsearch{order:2; flex:1}
  .userbox{display:none}
  main{margin:12px auto; padding:0 10px}
  .card{padding:14px}
  .kpi{font-size:22px}
  .filters{gap:8px}
  table{font-size:12.5px}
  th,td{padding:6px 5px}
  .card:has(table){overflow-x:auto}
  h1{font-size:20px !important}
  .pol-num{font-size:15px}
}

.viewer{position:fixed; inset:0; background:rgba(15,25,50,.65); z-index:100;
  display:flex; align-items:center; justify-content:center; backdrop-filter:blur(3px)}
.viewer-box{width:min(1000px,92vw); height:88vh; background:#fff;
  border-top:4px solid var(--navy); border-radius:14px; display:flex; flex-direction:column; overflow:hidden}
.viewer-bar{display:flex; align-items:center; gap:12px; padding:10px 16px;
  border-bottom:1px solid var(--line)}
.viewer-bar span{margin-inline-end:auto; font-weight:700; color:var(--navy)}
.viewer-box iframe{flex:1; border:none; background:#fff}

/* תפריט פוליסות בכרטיס לקוח */
.pol-layout{display:grid; grid-template-columns:300px 1fr; gap:16px; align-items:start}
@media(max-width:900px){.pol-layout{grid-template-columns:1fr}}
.pol-menu{display:flex; flex-direction:column; gap:8px; position:sticky; top:80px}
.pol-item{background:#fff; border:1.5px solid var(--line); border-radius:12px;
  padding:12px 14px; cursor:pointer; transition:all .12s}
.pol-item:hover{border-color:var(--blue)}
.pol-item.active{border-color:var(--orange); border-width:2.5px; background:#fff8f0;
  box-shadow:0 4px 14px rgba(240,130,30,.15)}
.pol-item-top{display:flex; justify-content:space-between; align-items:center; gap:8px}
.pol-item-top b{font-size:17px}
.pol-item-sub{color:var(--dim); font-size:14px; margin-top:2px}
.pol-item-prem{font-weight:800; font-size:17px; color:var(--navy); margin-top:4px}
.orange-t{color:var(--orange) !important}
.pol-detail{display:none}
.pol-detail.active{display:block}
.prem-big{font-weight:800; font-size:20px; color:var(--navy)}
.chip-lg{font-size:15.5px; padding:6px 14px}
.family-bar{background:var(--sky); border:1.5px solid var(--line); border-radius:12px;
  padding:10px 16px; margin-bottom:12px; display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  font-size:16px}
.kpi-card{border-top:3px solid var(--blue)}

.back-btn{position:fixed; bottom:24px; left:24px; z-index:60;
  background:#fff; color:var(--blue-strong); border:2px solid var(--blue-strong);
  border-radius:24px; padding:10px 22px; font-family:inherit; font-size:16px; font-weight:700;
  cursor:pointer; box-shadow:0 4px 16px rgba(26,48,105,.2)}
.back-btn:hover{background:var(--blue-strong); color:#fff}
@media(max-width:760px){.back-btn{bottom:14px; left:14px; padding:8px 16px}}

/* כפתור התקנה כאפליקציה */
.install-btn{position:fixed; bottom:24px; right:24px; z-index:60;
  background:var(--orange); color:#fff; border:none; border-radius:24px;
  padding:10px 22px; font-family:inherit; font-size:16px; font-weight:700;
  cursor:pointer; box-shadow:0 4px 16px rgba(240,130,30,.35)}
.install-btn:hover{filter:brightness(.92)}
@media(max-width:760px){.install-btn{bottom:14px; right:14px; padding:9px 16px; font-size:15px}}

/* מובייל: ניווט מדורג בכרטיס לקוח — קטגוריה > פוליסות > כיסויים */
.m-subhead{display:none; align-items:center; gap:12px; margin-bottom:4px}
@media(max-width:760px){
  /* מסך ראשי: בלי רשימת פוליסות למטה — נכנסים דרך כרטיסי הקטגוריה */
  body:not([data-mview="cat"]):not([data-mview="pol"]) .pol-layout,
  body:not([data-mview="cat"]):not([data-mview="pol"]) .pol-sec-title{display:none}
  .cat-link{cursor:pointer; position:relative; padding-inline-start:14px}
  .cat-link::after{content:'‹'; position:absolute; left:14px; top:50%;
    transform:translateY(-50%); font-size:30px; color:var(--blue); opacity:.5}
  /* מסך קטגוריה / פוליסה: מציגים רק את אזור הפוליסות */
  body[data-mview="cat"] main > *:not(.pol-layout),
  body[data-mview="pol"] main > *:not(.pol-layout){display:none}
  body[data-mview="cat"] .back-btn, body[data-mview="pol"] .back-btn,
  body[data-mview="cat"] .install-btn, body[data-mview="pol"] .install-btn{display:none!important}
  body[data-mview="cat"] .m-subhead, body[data-mview="pol"] .m-subhead{display:flex}
  body[data-mview="cat"] .pol-detail-area{display:none}
  body[data-mview="pol"] .pol-menu{display:none}
  .pol-menu{position:static}
}

/* מסך נעילת אפליקציה — פתיחה בטביעת אצבע */
.fp-lock{display:none}
html.fp-locked .fp-lock{display:flex; position:fixed; inset:0; z-index:9999;
  background:linear-gradient(160deg,#f4f8fd,#dfeaf7); flex-direction:column;
  align-items:center; justify-content:center; gap:14px; text-align:center; padding:24px}
html.fp-locked .fp-lock img{width:110px}
html.fp-locked .fp-lock h2{color:var(--navy); font-size:26px}
html.fp-locked header.topbar, html.fp-locked main{display:none!important}
