/* HORIZON - premium neumorphic UI. Brand: #003300 (green) and #A68A65 (sand gold). */
@font-face { font-family: "GE SS Two"; src: local("GE SS Two Medium"), local("GE SS Two"); font-weight: 400 700; font-display: swap; }
:root {
  --font: "GE SS Two", "Segoe UI", "SF Pro Text", system-ui, -apple-system, "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  --green: #003300; --gold: #A68A65;
  --bg: #e8ebe6; --bg2: #f2f4ef; --card: #e8ebe6;
  --text: #17261b; --muted: #5a6a5f; --head: #003300; --accent: #003300; --on-accent: #ffffff; --hi: #A68A65;
  --sh-hi: #ffffff; --sh-lo: #c4c9c1;
  --out: 7px 7px 16px var(--sh-lo), -7px -7px 16px var(--sh-hi);
  --out-sm: 4px 4px 9px var(--sh-lo), -4px -4px 9px var(--sh-hi);
  --in: inset 4px 4px 9px var(--sh-lo), inset -4px -4px 9px var(--sh-hi);
  --line: rgba(0, 51, 0, .10);
  --danger: #a23b3b; --ok: #2c7a47; --warn: #a8741f; --info: #36698a;
  --radius: 16px; --row: 44px;
}
[data-theme="dark"] {
  --bg: #1b1f1d; --bg2: #232826; --card: #1b1f1d;
  --text: #e5eae6; --muted: #9eaaa2; --head: #d8c39d; --accent: #3a7d4b; --on-accent: #ffffff; --hi: #cdb48b;
  --sh-hi: #262c29; --sh-lo: #101312; --line: rgba(255, 255, 255, .09);
  --danger: #e0807f; --ok: #6cc08a; --warn: #e0b45f; --info: #7db6d9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); overflow: hidden; font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
h1, h2, h3, h4 { color: var(--head); margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
a { color: var(--accent); }
[data-theme="dark"] a { color: var(--hi); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100%; font-size: 2rem; letter-spacing: .3em; color: var(--head); }
#bar { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 9999; background: linear-gradient(90deg, var(--green), var(--gold)); transform: scaleX(0); transform-origin: left; opacity: 0; transition: transform .4s, opacity .3s; }
#bar.on { opacity: 1; transform: scaleX(.8); }
[dir="rtl"] #bar { transform-origin: right; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; transition: grid-template-columns .2s; }
.shell.collapsed { grid-template-columns: 76px 1fr; }
.side { display: flex; flex-direction: column; padding: 16px 12px; gap: 6px; overflow: hidden; background: var(--bg); box-shadow: 6px 0 14px -8px var(--sh-lo); z-index: 5; }
[dir="rtl"] .side { box-shadow: -6px 0 14px -8px var(--sh-lo); }
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 14px; min-height: 64px; }
.brand img { height: 46px; max-width: 150px; object-fit: contain; flex: none; }
[data-theme="dark"] .brand img { filter: brightness(0) invert(1); opacity: .9; }   /* the green logo turns light on the dark theme */
.login-card .brand { flex-direction: column; gap: 12px; }
.login-card .brand img { height: 104px; }
.wordmark { font-weight: 700; letter-spacing: .22em; color: var(--head); font-size: 1.1rem; }
.brand small { display: block; color: var(--muted); font-size: .7rem; letter-spacing: .02em; }
.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 4px 4px 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text); text-decoration: none; white-space: nowrap; }
.nav a:hover { box-shadow: var(--out-sm); }
.nav a.on { box-shadow: var(--in); color: var(--head); font-weight: 600; }
.nav a.on .ico { color: var(--hi); }
.ico { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.collapsed .nav a span, .collapsed .brand > div, .collapsed .side-foot span { display: none; }
.collapsed .brand { justify-content: center; padding-inline: 0; }
.side-foot { display: flex; flex-direction: column; gap: 6px; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.content { min-height: 0; }
.top { display: flex; align-items: center; gap: 10px; padding: 12px 20px; min-height: 68px; }
.top .grow { flex: 1; min-width: 0; }
.who { display: flex; flex-direction: column; line-height: 1.2; text-align: start; }
.who b { color: var(--head); } .who small { color: var(--muted); }
.ini { display: none; font-weight: 700; color: var(--head); min-width: 22px; text-align: center; }
.content { flex: 1; overflow: auto; padding: 8px 22px 28px; scroll-behavior: smooth; }
.view { max-width: 1500px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.page-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-title h1 { margin: 0; }
.page-title .grow { flex: 1; }
.save-chip { font-size: .8rem; color: var(--muted); min-width: 64px; }
.save-chip.err { color: var(--danger); }

/* ---------- surfaces ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--out); padding: 18px; min-width: 0; }
.card.flat { box-shadow: var(--in); }
.card h2 { display: flex; align-items: center; gap: 8px; }
.card h2 .grow { flex: 1; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: 1.6rem; font-weight: 700; color: var(--head); }
.stat .l { color: var(--muted); font-size: .85rem; }
.stat .s { font-size: .8rem; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* ---------- controls ---------- */
.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; background: var(--card); color: var(--text); padding: 9px 16px; border-radius: 12px; box-shadow: var(--out-sm); transition: box-shadow .15s, transform .05s; white-space: nowrap; min-height: 40px; }
.btn:hover { box-shadow: 2px 2px 5px var(--sh-lo), -2px -2px 5px var(--sh-hi); }
.btn:active { box-shadow: var(--in); }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: 4px 4px 10px rgba(0,0,0,.22), -3px -3px 8px var(--sh-hi); }
.btn.gold { background: var(--gold); color: #1d1608; }
.btn.danger { color: var(--danger); }
.btn.menu-btn { display: none; }
.btn.sm { padding: 5px 11px; min-height: 32px; font-size: .85rem; border-radius: 10px; }
.btn.icon { padding: 8px; min-width: 40px; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .nav a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--hi); outline-offset: 2px; }
input, select, textarea { width: 100%; background: var(--bg); border: 0; border-radius: 12px; padding: 10px 14px; box-shadow: var(--in); min-height: 42px; }
textarea { min-height: 84px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 34px; }
[dir="rtl"] select { background-position: 18px 55%, 13px 55%; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--accent); box-shadow: none; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; color: var(--muted); min-width: 0; }
label.f > span:first-child { padding-inline-start: 4px; }
label.f .req { color: var(--danger); }
label.f.bad input, label.f.bad select, label.f.bad textarea { box-shadow: var(--in), 0 0 0 2px var(--danger); }
.err-text { color: var(--danger); font-size: .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.chk { display: flex; align-items: center; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .search { flex: 1 1 220px; min-width: 160px; max-width: 360px; }
.toolbar select, .toolbar input[type="date"] { width: auto; min-width: 140px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { border: 0; cursor: pointer; background: var(--bg); padding: 8px 16px; border-radius: 12px; box-shadow: var(--out-sm); color: var(--text); }
.tab.on { box-shadow: var(--in); color: var(--head); font-weight: 600; }
.tab .n { margin-inline-start: 6px; font-size: .75rem; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; background: var(--bg); box-shadow: var(--out-sm); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: rgba(0,51,0,.1); color: var(--head); white-space: nowrap; }
.b-ok { background: rgba(44,122,71,.16); color: var(--ok); } .b-bad { background: rgba(162,59,59,.15); color: var(--danger); }
.b-warn { background: rgba(168,116,31,.17); color: var(--warn); } .b-info { background: rgba(54,105,138,.16); color: var(--info); } .b-gold { background: rgba(166,138,101,.25); color: var(--head); }
.link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--accent); text-decoration: underline; }
[data-theme="dark"] .link { color: var(--hi); }

/* ---------- tables ---------- */
.tbl-wrap { overflow: auto; max-height: min(62vh, 720px); border-radius: 12px; box-shadow: var(--in); }
.tbl-wrap.short { max-height: calc(var(--row) * 7 + 44px); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { position: sticky; top: 0; background: var(--bg2); text-align: start; padding: 10px 12px; white-space: nowrap; color: var(--head); font-weight: 600; z-index: 1; user-select: none; }
th.sort { cursor: pointer; }
td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; min-height: var(--row); }
tbody tr:hover { background: rgba(166,138,101,.10); }
tr.click { cursor: pointer; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
td.act { white-space: nowrap; text-align: end; }
.trunc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.skel { height: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--bg2), var(--bg), var(--bg2)); background-size: 200% 100%; animation: sk 1.2s infinite linear; margin: 10px 0; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- lists / timeline ---------- */
.list { display: flex; flex-direction: column; }
.list.scroll { overflow: auto; border-radius: 12px; box-shadow: var(--in); }
.list.rows7 { max-height: calc(var(--row) * 7); }
.list.rows3 { max-height: 300px; }
.item, .tl-item { flex: none; }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; min-height: var(--row); border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 600; } .item .d { color: var(--muted); font-size: .82rem; }
.tl-item { padding: 12px 14px; border-top: 1px solid var(--line); }
.tl-item:first-child { border-top: 0; }
.bar { height: 10px; border-radius: 6px; background: var(--bg); box-shadow: var(--in); overflow: hidden; display: flex; }
.bar > i { display: block; height: 100%; }
.s-Available { background: var(--ok); } .s-Reserved { background: var(--warn); } .s-Sold { background: var(--info); } .s-Unavailable { background: #8a8f8b; }

/* ---------- units grid ---------- */
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.unit { border: 0; cursor: pointer; text-align: start; padding: 12px; border-radius: 14px; background: var(--card); box-shadow: var(--out-sm); color: var(--text); border-inline-start: 5px solid var(--ok); }
.unit.Reserved { border-inline-start-color: var(--warn); } .unit.Sold { border-inline-start-color: var(--info); } .unit.Unavailable { border-inline-start-color: #8a8f8b; opacity: .8; }
.unit { min-width: 0; } .unit b, .unit small { display: block; } .unit small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .unit b { color: var(--head); } .unit small { color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; }

/* ---------- picker / modal / toast ---------- */
.pick { position: relative; }
.pick .menu { position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 60; max-height: 240px; overflow: auto; background: var(--bg2); border-radius: 12px; box-shadow: var(--out); }
.pick .opt { padding: 9px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.pick .opt:hover, .pick .opt.on { background: rgba(166,138,101,.2); }
.back { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(10, 20, 12, .45); padding: 16px; backdrop-filter: blur(2px); }
.modal { width: min(720px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--bg); border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal.wide { width: min(1000px, 100%); } .modal.narrow { width: min(460px, 100%); }
.modal header { display: flex; align-items: center; gap: 10px; padding: 16px 20px 8px; }
.modal header h2 { margin: 0; flex: 1; }
.modal .body { padding: 8px 20px 12px; overflow: auto; }
.modal footer { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 20px 18px; }
#toasts { position: fixed; z-index: 300; inset-block-end: 18px; inset-inline-end: 18px; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 36px)); }
.toast { padding: 12px 16px; border-radius: 14px; background: var(--bg2); box-shadow: var(--out); border-inline-start: 5px solid var(--ok); animation: pop .2s; }
.toast.err { border-color: var(--danger); } .toast.warn { border-color: var(--warn); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.notif { position: absolute; z-index: 70; inset-inline-end: 12px; top: 64px; width: min(400px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--bg2); border-radius: 16px; box-shadow: var(--out); padding: 8px; }
.dot { background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; padding: 1px 6px; margin-inline-start: -8px; align-self: flex-start; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.4rem; letter-spacing: .12em; padding: 14px; text-align: center; border-radius: 12px; box-shadow: var(--in); user-select: all; color: var(--head); }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .b1 { fill: var(--accent); } .chart .b2 { fill: var(--hi); } .chart .axis { stroke: var(--line); }
[data-theme="dark"] .chart .b1 { fill: #4c9a60; }
.chart .ln { stroke: var(--accent); fill: none; stroke-width: 2.5; } .chart .ln2 { stroke: var(--hi); fill: none; stroke-width: 2.5; }
.dn0 { stroke: var(--accent); } .dn1 { stroke: var(--hi); } .dn2 { stroke: var(--info); } .dn3 { stroke: var(--warn); } .dn4 { stroke: var(--danger); } .dn5 { stroke: #8a8f8b; } .dn6 { stroke: var(--ok); }
.k0 { background: var(--accent); } .k1 { background: var(--hi); } .k2 { background: var(--info); } .k3 { background: var(--warn); } .k4 { background: var(--danger); } .k5 { background: #8a8f8b; } .k6 { background: var(--ok); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal .h { text-align: center; color: var(--muted); font-size: .8rem; }
.cal .day { min-height: 92px; padding: 6px; border-radius: 12px; box-shadow: var(--in); font-size: .78rem; overflow: hidden; }
.cal .day.today { outline: 2px solid var(--hi); } .cal .day.off { opacity: .45; }
.cal .ev { display: block; margin-top: 3px; padding: 2px 6px; border-radius: 6px; background: rgba(0,51,0,.14); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.task { background: rgba(166,138,101,.3); } .cal .ev.campaign { background: rgba(54,105,138,.2); }
.matrix td, .matrix th { text-align: center; } .matrix td:first-child, .matrix th:first-child { text-align: start; }

/* ---------- login ---------- */
.login-wrap { height: 100%; display: grid; place-items: center; padding: 16px; overflow: auto; }
.login-card { width: min(440px, 100%); padding: 30px; display: flex; flex-direction: column; gap: 14px; }
.login-card .brand { justify-content: center; }
.login-tools { position: fixed; inset-block-start: 14px; inset-inline-end: 14px; display: flex; gap: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; transform: translateX(-105%); transition: transform .2s; box-shadow: 10px 0 30px rgba(0,0,0,.3); }
  [dir="rtl"] .side { transform: translateX(105%); }
  .shell.open .side { transform: none; }
  .shell.collapsed .nav a span, .shell.collapsed .brand > div, .shell.collapsed .side-foot span { display: initial; }
  .btn.menu-btn { display: inline-flex; }
  .content { padding: 6px 12px 24px; }
  .top { padding: 10px 12px; }
  .who { display: none; } .ini { display: inline; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; }
  .scrim { position: fixed; inset: 0; z-index: 4; background: rgba(0,0,0,.4); }
  .toolbar select, .toolbar input[type="date"] { flex: 1 1 140px; }
  .cal .day { min-height: 64px; } .cal .ev { font-size: .68rem; }
}
@media print { .side, .top, .toolbar, .btn { display: none !important; } body { overflow: visible; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- assistant ---------- */
.ast-fab { position: fixed; inset-block-end: 18px; inset-inline-end: 18px; z-index: 50; border-radius: 999px; }
.ast-panel { position: fixed; inset-block-end: 76px; inset-inline-end: 18px; z-index: 60; width: min(400px, calc(100vw - 24px)); height: min(560px, calc(100dvh - 100px)); display: flex; flex-direction: column; background: var(--bg); border-radius: 18px; box-shadow: 0 16px 50px rgba(0,0,0,.35); }
.ast-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; color: var(--head); }
.ast-log { flex: 1; overflow: auto; padding: 6px 14px; display: flex; flex-direction: column; gap: 10px; }
.ast-msg { max-width: 92%; padding: 9px 13px; border-radius: 14px; overflow-wrap: anywhere; box-shadow: var(--out-sm); }
.ast-msg.me { align-self: flex-end; background: var(--accent); color: var(--on-accent); }
.ast-msg.bot { align-self: flex-start; background: var(--bg2); }
.ast-fb { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.ast-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 14px; max-height: 86px; overflow: auto; }
.ast-chips .chip { cursor: pointer; border: 0; color: inherit; font-size: .8rem; text-align: start; }
.ast-in { display: flex; gap: 8px; padding: 8px 14px; }
.ast-note { font-size: .72rem; color: var(--muted); padding: 0 14px 10px; }
@media (max-width: 860px) { .ast-fab span { display: none; } }
