:root {
  --navy: #142D4E;
  --navy-2: #1d3d66;
  --lime: #B9F46A;
  --lime-soft: #eefcd9;
  --orange: #FF6B35;
  --orange-soft: #fff0ea;
  --slate: #64748B;
  --off: #F7F8FA;
  --white: #fff;
  --line: #e3e7ee;
  --ink: #142D4E;
  --input-bg: #fffbe6; /* the sheet's yellow input cells, softened */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 45, 78, .06), 0 4px 16px rgba(20, 45, 78, .06);
  --side-w: 248px;
  --top-h: 56px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  background: var(--off);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
a { color: var(--navy); }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .4em; }
h1 { font-size: 1.45rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .6em; }
.muted { color: var(--slate); }
.small { font-size: .85rem; }
.error { color: #c2410c; min-height: 1.4em; font-weight: 600; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* Logo */
.logo { font-weight: 800; font-size: 1.35rem; color: var(--white); text-decoration: none; letter-spacing: .5px; direction: ltr; display: inline-block; }
.logo span { color: var(--lime); }
.logo small { font-weight: 600; font-size: .8em; opacity: .85; }
.logo.big { font-size: 2.2rem; color: var(--navy); }

/* Boot */
.boot { min-height: 100vh; display: grid; place-content: center; gap: 18px; background: var(--navy); justify-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: var(--lime); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons and inputs */
.btn {
  font: inherit; font-weight: 700; border: 1px solid var(--line); background: var(--white); color: var(--navy);
  padding: 9px 16px; border-radius: 10px; cursor: pointer; min-height: 42px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; text-decoration: none;
}
.btn:hover { border-color: var(--navy); }
.btn.primary { background: var(--navy); color: var(--white); border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.lime { background: var(--lime); border-color: var(--lime); color: var(--navy); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: #b42318; }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 1.4rem; cursor: pointer; min-width: 44px; min-height: 44px; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 12px; }
input, select, textarea {
  font: inherit; width: 100%; margin-top: 4px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--input-bg); color: var(--ink); min-height: 42px;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lime); outline-offset: 1px; border-color: var(--navy); }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--navy); }
.pw { position: relative; display: block; }
.pw-toggle { position: absolute; inset-inline-start: 6px; top: 50%; transform: translateY(-40%); background: none; border: 0; cursor: pointer; font-size: 1rem; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; background: radial-gradient(1200px 500px at 50% -10%, #234a7a 0%, var(--navy) 60%); }
.login-card { width: 100%; max-width: 400px; background: var(--white); border-radius: 20px; padding: 28px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.tagline { font-weight: 700; color: var(--orange); margin-bottom: 18px; }

/* Layout */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); background: var(--navy); color: var(--white);
  display: flex; align-items: center; gap: 8px; padding: 0 8px; padding-top: env(safe-area-inset-top);
}
.save-state { margin-inline-start: auto; font-size: .8rem; color: var(--lime); padding: 0 8px; }
.save-state.err { color: #ffb4a0; }
.sidebar {
  position: fixed; z-index: 40; top: 0; bottom: 0; inset-inline-start: 0; width: var(--side-w); max-width: 84vw;
  background: var(--white); border-inline-end: 1px solid var(--line); padding: 14px 10px; overflow-y: auto;
  transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column;
}
.sidebar.open { transform: none; }
.scrim { position: fixed; inset: 0; background: rgba(20,45,78,.4); z-index: 35; }
.side-user { padding: 6px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.user-name { font-weight: 800; }
.nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px; color: var(--navy);
  text-decoration: none; font: inherit; font-weight: 600; background: none; border: 0; cursor: pointer; text-align: start;
}
.nav-link:hover { background: var(--off); }
.nav-link.active { background: var(--navy); color: var(--white); }
.nav-link .ic { width: 22px; text-align: center; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; }
.view { padding: 18px 16px 80px; max-width: 1100px; margin: 0 auto; outline: none; }

@media (min-width: 900px) {
  .menu-btn { display: none; }
  .topbar { padding-inline-start: 20px; }
  .sidebar { transform: none; top: var(--top-h); z-index: 20; }
  .scrim { display: none !important; }
  .view { margin-inline-start: var(--side-w); padding: 26px 32px 60px; margin-inline-end: auto; }
  @supports (margin-inline-start: 0) { .view { max-width: calc(1100px + var(--side-w)); } }
}

/* Page header */
.page-head { margin-bottom: 16px; }
.page-head p { color: var(--slate); }
.kicker { color: var(--orange); font-weight: 700; font-size: .85rem; }

/* Cards and grids */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.navy { background: var(--navy); color: var(--white); border-color: var(--navy); }
.card.navy .muted { color: #b9c6d8; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.two { grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid.two { grid-template-columns: 1fr 1fr; } }
.tile {
  display: block; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--navy);
  box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--navy); }
.tile .ic { font-size: 1.5rem; }
.tile b { display: block; margin: 4px 0 2px; }
.tile span { color: var(--slate); font-size: .82rem; line-height: 1.5; display: block; }

.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .v { font-size: 1.6rem; font-weight: 800; line-height: 1.2; direction: ltr; text-align: right; unicode-bidi: plaintext; }
.stat .l { color: var(--slate); font-size: .82rem; }
.stat.lime { background: var(--lime-soft); border-color: #d6f4ad; }
.stat.text .v { font-size: 1.05rem; direction: rtl; }

.pill { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--off); color: var(--slate); border: 1px solid var(--line); white-space: nowrap; }
.pill.lime { background: var(--lime); color: var(--navy); border-color: var(--lime); }
.pill.orange { background: var(--orange-soft); color: #c2410c; border-color: #ffd2c0; }
.pill.navy { background: var(--navy); color: var(--white); border-color: var(--navy); }

.progress { height: 12px; background: #e8edf3; border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--lime); border-radius: 99px; transition: width .3s; }

/* Assessment */
.q { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.q:last-child { border-bottom: 0; }
.q .note { color: var(--slate); font-size: .8rem; }
.status-line { padding: 10px 14px; border-radius: 12px; font-weight: 700; }
.status-line.ok { background: var(--lime-soft); color: #2d5b05; }
.status-line.no { background: var(--orange-soft); color: #c2410c; }

/* Recommendations */
.rec { position: relative; }
.rec .rank { display: inline-block; margin-bottom: 10px; }
.score-ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem;
  background: conic-gradient(var(--lime) calc(var(--p) * 1%), #e8edf3 0); position: relative; flex: none; }
.score-ring::before { content: ""; position: absolute; inset: 7px; background: var(--white); border-radius: 50%; }
.score-ring b { position: relative; }
.rec-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: 1fr; gap: 2px 12px; margin: 0; }
.kv dt { color: var(--slate); font-size: .8rem; font-weight: 700; margin-top: 8px; }
.kv dd { margin: 0; }
@media (min-width: 700px) { .kv { grid-template-columns: 150px 1fr; } .kv dt { margin-top: 0; } }

/* Filters */
.filters { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
.filters label { margin: 0; font-size: .78rem; }
.filters .full { grid-column: 1 / -1; }
@media (min-width: 800px) { .filters { grid-template-columns: repeat(4, 1fr); } .filters .full { grid-column: span 2; } }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .85rem; }

details.opp { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow); }
details.opp > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
details.opp > summary::-webkit-details-marker { display: none; }
details.opp > summary .t { flex: 1; min-width: 0; }
details.opp > summary .t b { display: block; }
details.opp > summary .t span { color: var(--slate); font-size: .8rem; direction: ltr; display: block; text-align: right; }
details.opp .body { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.bar { font-size: .72rem; color: var(--slate); text-align: center; }
.bar .dots { display: flex; gap: 2px; justify-content: center; margin-top: 2px; direction: ltr; }
.bar .dots i { width: 9px; height: 9px; border-radius: 2px; background: #e3e7ee; }
.bar .dots i.on { background: var(--navy); }
.bar .dots.hi i.on { background: #6aa520; }
.bar .dots.lo i.on { background: var(--orange); }
.fit { min-width: 52px; text-align: center; font-weight: 800; border-radius: 10px; padding: 4px 6px; background: var(--off); font-size: .95rem; }
.fit.ok { background: var(--lime); }
.fit.later { background: var(--orange-soft); color: #c2410c; font-size: .66rem; line-height: 1.3; }

/* Plan */
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .day { flex: none; width: 76px; font-size: .78rem; color: var(--slate); font-weight: 700; }
.task .txt { flex: 1; min-width: 0; }
.task .time { font-size: .78rem; color: var(--slate); }
.task.done .txt b { text-decoration: line-through; color: var(--slate); }
.task.done { background: linear-gradient(90deg, transparent, var(--lime-soft)); }
.task input[type="text"] { min-height: 36px; padding: 5px 10px; font-size: .85rem; margin-top: 6px; background: var(--white); }
.toggle { flex: none; border: 2px solid var(--line); background: var(--white); border-radius: 10px; min-width: 64px; min-height: 40px; cursor: pointer; font: inherit; font-weight: 700; color: var(--slate); }
.toggle.on { background: var(--lime); border-color: var(--lime); color: var(--navy); }
.week { margin: 14px 0 0; color: var(--orange); font-weight: 800; font-size: .9rem; }

/* Trackers */
.row-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow); }
.row-card.good { border-color: #b7e27a; background: #fbfff5; }
.row-card > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.row-card > summary::-webkit-details-marker { display: none; }
.row-card > summary .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row-card > summary .t b { display: block; }
.row-card > summary .t span { color: var(--slate); font-size: .8rem; }
.row-card .fields { padding: 4px 14px 14px; display: grid; gap: 0 12px; grid-template-columns: 1fr; border-top: 1px solid var(--line); }
@media (min-width: 640px) { .row-card .fields { grid-template-columns: 1fr 1fr; } }
.row-card .fields label { margin: 10px 0 0; }
.row-card .fields .full { grid-column: 1 / -1; }
.computed { margin-top: 4px; min-height: 42px; padding: 9px 12px; border-radius: 10px; background: var(--off); border: 1px dashed var(--line); font-weight: 700; }
.computed.overdue { background: var(--orange-soft); color: #c2410c; border-color: #ffd2c0; }
.row-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; margin-top: 10px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
.empty { text-align: center; color: var(--slate); padding: 28px 10px; border: 2px dashed var(--line); border-radius: var(--radius); }

/* Pricing */
.price-big { font-size: 2.4rem; font-weight: 800; color: var(--navy); direction: ltr; text-align: right; }
table.simple { width: 100%; border-collapse: collapse; }
table.simple th, table.simple td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
table.simple th { font-size: .78rem; color: var(--slate); }
table.simple input { min-height: 36px; padding: 4px 8px; }

/* Guide */
.pdf-bar { position: sticky; top: var(--top-h); z-index: 10; background: var(--off); padding: 8px 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pdf-bar input { width: 70px; min-height: 36px; padding: 4px 8px; margin: 0; text-align: center; }
.pdf-pages { display: grid; gap: 12px; justify-items: center; }
.pdf-page { background: var(--white); box-shadow: var(--shadow); border-radius: 6px; overflow: hidden; position: relative; max-width: 100%; }
.pdf-page canvas { display: block; width: 100%; height: auto; }
.pdf-page .pn { position: absolute; bottom: 6px; inset-inline-start: 8px; font-size: .72rem; background: rgba(20,45,78,.7); color: #fff; padding: 0 8px; border-radius: 99px; }

dialog { border: 0; border-radius: 16px; padding: 22px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(20,45,78,.5); }
.row-btns { display: flex; gap: 8px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--navy); color: var(--white); padding: 10px 18px; border-radius: 12px; z-index: 60; box-shadow: var(--shadow); font-weight: 600; max-width: calc(100vw - 32px); }

/* Admin */
.admin-wrap { max-width: 960px; margin: 0 auto; padding: 18px 16px 60px; }
.user-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.user-row .who { flex: 1 1 220px; min-width: 0; }
.user-row .who b { display: block; overflow-wrap: anywhere; }
.copybox { white-space: pre-wrap; background: var(--off); border: 1px dashed var(--line); border-radius: 10px; padding: 10px; font-size: .9rem; }

@media print {
  .topbar, .sidebar, .scrim, .btn, .pdf-bar { display: none !important; }
  .view { margin: 0; padding: 0; }
}
