@font-face {
  font-family: "Noto Sans Hebrew";
  src: url("fonts/NotoSansHebrew.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("fonts/NotoSans.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --navy: #14213d; --navy-fg: #f3eee3; --gold: #b8914a; --gold-fg: #14120c;
  --bg: #eef3f8; --line: #b7c3d4; --text: #0e1a2e; --muted: #2f3c50;
  --ok: #2e8b57; --excess: #2f6fb5; --shortfall: #e07b1f; --trapped: #c0392b; --draft: #8a8f99;
}
* { box-sizing: border-box; }
html { height: 100dvh; overflow: hidden; overscroll-behavior: none; scrollbar-width: auto; scrollbar-color: var(--navy) #dce4ee; }
html::-webkit-scrollbar, body::-webkit-scrollbar, *::-webkit-scrollbar { width: 16px; height: 16px; }
html::-webkit-scrollbar-thumb, body::-webkit-scrollbar-thumb, *::-webkit-scrollbar-thumb { background: var(--navy); }
body { margin: 0; font-family: "Noto Sans Hebrew", "Noto Sans", sans-serif; background: var(--bg); color: var(--text); font-size: 18px; height: 100dvh; overflow: auto; overscroll-behavior: none; }
a { color: var(--navy); }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
h1 { font-size: 32px; color: var(--navy); margin: 0 0 16px; font-weight: 700; }
h2 { font-size: 22px; color: var(--navy); margin: 24px 0 10px; font-weight: 700; }

.office-rail { background: var(--navy); color: var(--navy-fg); display: flex; flex-wrap: wrap;
  align-items: flex-end; justify-content: space-between; gap: 16px; padding: 16px 20px 12px; }
.office-rail .kicker { margin: 0; font-size: 16px; letter-spacing: 0.28em; color: var(--gold); }
.office-rail .title { margin: 4px 0 0; font-size: 32px; line-height: 1.15; color: var(--navy-fg); }
.office-rail nav { display: flex; flex-wrap: wrap; gap: 8px; }
.office-rail nav a { display: inline-flex; min-height: 44px; min-width: 44px; align-items: center; justify-content: center;
  padding: 8px 16px; border: 1px solid color-mix(in srgb, var(--navy-fg) 25%, transparent);
  color: var(--navy-fg); text-decoration: none; }
.office-rail nav a:hover { border-color: var(--gold); color: var(--gold); }
.office-rail nav a.on { background: var(--gold); color: var(--gold-fg); border-color: var(--gold); }

.top { background: var(--navy); color: var(--navy-fg); display: flex; align-items: center; gap: 16px; padding: 12px 20px;
       border-bottom: 2px solid var(--gold); flex-wrap: wrap; }
.top a { color: var(--navy-fg); text-decoration: none; display: inline-flex; min-height: 44px; align-items: center; }
.top .brand { font-weight: 700; font-size: 18px; color: var(--gold); }
.top nav { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.top nav a { padding: 8px 12px; }
.top nav a:hover { color: var(--gold); }
.top .year select { margin-inline-start: 6px; }
.top .logout span { opacity: .8; }
button.link { background: none; border: 0; color: var(--gold); cursor: pointer; font: inherit; min-height: 44px; padding: 8px 12px; text-decoration: underline; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px; margin-bottom: 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 200px; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.spacer { flex: 1; }

label { display: block; font-weight: 600; font-size: 16px; margin-bottom: 12px; }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input:not([type]),
select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid #c4cad6; border-radius: 6px;
  font: inherit; background: #fff;
}
textarea { min-height: 90px; line-height: 1.5; }
input.num { direction: ltr; text-align: right; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: auto; margin: 0; }

.btn { display: inline-block; background: var(--navy); color: var(--navy-fg); border: 0; border-radius: 6px; padding: 9px 18px;
       font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn.secondary { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
.btn.danger { background: var(--trapped); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
th { background: #eef0f4; font-size: 15px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: left; direction: ltr; white-space: nowrap; }
tr.muted td { color: var(--muted); }
tr.group td { background: #f8f9fb; font-weight: 600; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.flash.ok { background: #e6f4ec; color: #1e6b41; }
.flash.error { background: #fdecea; color: #9b2c20; }
.warn { background: #fff4e5; border: 1px solid #f3c58b; color: #8a4b08; padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; }
.warn ul { margin: 6px 0 0; padding-inline-start: 20px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok); } .badge.excess { background: var(--excess); }
.badge.shortfall { background: var(--shortfall); } .badge.trapped { background: var(--trapped); }
.badge.draft { background: var(--draft); } .badge.none { background: #fff; color: var(--muted); border: 1px dashed #b5bcc9; }
.pos { color: var(--excess); } .neg { color: var(--shortfall); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters a { padding: 6px 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); text-decoration: none; font-size: 14px; }
.filters a.on { background: var(--navy); color: #fff; border-color: var(--navy); }

.steps { display: flex; gap: 4px; margin-bottom: 20px; counter-reset: s; flex-wrap: wrap; }
.steps a, .steps span { flex: 1; text-align: center; padding: 8px 6px; background: #e6e9ef; color: var(--muted);
  text-decoration: none; font-size: 13px; border-radius: 4px; min-width: 110px; }
.steps .on { background: var(--navy); color: #fff; font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 6px; padding: 12px 14px; }
.kpi b { display: block; font-size: 20px; color: var(--navy); margin-top: 4px; direction: ltr; text-align: right; }
.kpi span { font-size: 13px; color: var(--muted); }
.login { max-width: 440px; margin: 48px auto; display: flex; flex-direction: column; gap: 16px; }
.login h1 { font-size: 36px; line-height: 1.1; }
.login .hint { color: var(--muted); font-size: 16px; margin: 0; }
.google-enter {
  display: flex; min-height: 52px; align-items: center; justify-content: center;
  background: #fff; color: var(--text); border: 1px solid var(--line);
  text-decoration: none; font-weight: 600; font-size: 18px; padding: 12px 16px;
}
.muted { color: var(--muted); }
dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.info dt { color: var(--muted); } dl.info dd { margin: 0; }

details.folder { background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
details.folder > summary { cursor: pointer; padding: 10px 14px; font-size: 16px; }
details.folder table { border-top: 1px solid var(--line); }
td.files { font-size: 13px; line-height: 1.7; }

.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; margin: 12px 0 0;
        border: 2px dashed #c9b27f; border-radius: 10px; background: #fbf8f1; cursor: pointer; text-align: center; font-weight: 400; }
.drop input[type=file] { display: none; }
.drop b { font-size: 16px; color: var(--navy); }
.drop small { color: var(--muted); }
.drop.over { background: #f3ead6; border-color: var(--gold); }
.drop.has-file { border-style: solid; border-color: var(--ok); background: #eef7f1; }

.logo-now { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px;
            border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.logo-now img { max-height: 90px; max-width: 260px; }
.logo-text { display: flex; flex-direction: column; align-items: center; background: var(--navy); color: #fff;
             padding: 12px 22px; border-radius: 6px; }
.logo-text span { color: var(--gold); font-size: 12px; letter-spacing: 3px; border-top: 1px solid var(--gold); margin-top: 3px; padding-top: 2px; }

.sent-ok { display: inline-flex; align-items: center; gap: 6px; color: #1e6b41; font-size: 13px; line-height: 1.2; }
.sent-ok small { color: var(--muted); }
.open-year { position: relative; }
.open-year summary { cursor: pointer; color: #e8d3a8; font-size: 13px; list-style: none; text-decoration: underline; }
.open-year form { position: absolute; top: 26px; right: 0; z-index: 5; background: #fff; padding: 10px; border-radius: 6px;
                  box-shadow: 0 4px 14px rgba(0,0,0,.2); display: flex; gap: 6px; }
.open-year input { width: 90px; margin: 0; }

.systitle { font-size: 28px; margin-bottom: 18px; border-bottom: 3px solid var(--gold); padding-bottom: 8px; }
.search { display: flex; gap: 6px; align-items: center; }
.search input { margin: 0; width: 230px; }
.rowbtns { white-space: nowrap; }
.rowbtns form { display: inline; }
.preview-layout { display: grid; grid-template-columns: minmax(320px, 2fr) 3fr; gap: 16px; align-items: start; }
.viewpane iframe { width: 100%; height: 1100px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.editpane textarea { min-height: 70px; }
.finalbar { border-top: 1px solid var(--line); padding-top: 14px; }
.btn.big { font-size: 16px; padding: 12px 22px; background: var(--ok); }
.calcdetails summary { cursor: pointer; font-weight: 600; color: var(--navy); }
main { max-width: 1400px; }
@media (max-width: 1000px) { .preview-layout { grid-template-columns: 1fr; } }

.divresult { margin-top: 10px; padding: 10px 14px; border-radius: 6px; border-right: 4px solid var(--line); background: #f6f7fa; }
.divresult.ok { background: #e6f4ec; border-color: var(--ok); color: #1e6b41; }
.divresult.ask { background: #fff4e5; border-color: var(--shortfall); color: #8a4b08; }
.divresult.err { background: #fdecea; border-color: var(--trapped); color: #9b2c20; }
