:root {
  --bg: #f6f2ed;
  --surface: #ffffff;
  --surface-2: #faf7f3;
  --ink: #231c17;
  --ink-2: #5c5249;
  --ink-3: #8f857b;
  --line: #e8e0d6;
  --line-2: #d9cfc3;
  --accent: #9a6a45;
  --accent-ink: #7b5232;
  --accent-soft: #f3e8dc;
  --dark: #231c17;
  --good: #1f7a4d;
  --good-soft: #e3f3ea;
  --warn: #9a6200;
  --warn-soft: #fbf0d9;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --wa: #128c7e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(35, 28, 23, .05), 0 4px 18px rgba(35, 28, 23, .06);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); font-size: 14px; line-height: 1.45; }
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }

.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }

/* sidebar */
.sidebar { background: var(--dark); color: #efe6dc; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 10px; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #3a2e25, #1a1410); border: 1px solid #5a4636; display: grid; place-items: center; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 20px; color: #d9b38c; letter-spacing: .5px; }
.brand-name { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 21px; font-weight: 600; color: #fff; line-height: 1.1; }
.brand-sub { font-size: 12px; color: #b5a593; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: #d8cdc1; text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: #3a2e25; color: #fff; }
.nav .ico { width: 18px; height: 18px; flex: none; color: #c79c74; }
.nav .ico svg { width: 18px; height: 18px; display: block; }
.nav-group { margin: 14px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8f7f6e; }
.sidebar-foot { margin-top: auto; font-size: 12px; color: #b5a593; padding: 10px; border-top: 1px solid #3a2e25; }
.sidebar-foot .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3ecf8e; margin-right: 6px; }
.sidebar-foot .dot.off { background: #e5534b; }

/* main */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: rgba(246, 242, 237, .92); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.topbar-right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.menu-btn { display: none; border: 0; background: none; font-size: 20px; cursor: pointer; }
.save-state { font-size: 12.5px; color: var(--ink-3); }
.save-state.saving { color: var(--warn); }
.save-state.saved { color: var(--good); }
.save-state.error { color: var(--bad); }
.view { padding: 24px 28px 60px; max-width: 1320px; width: 100%; }

/* basics */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--dark); color: #fff; border-color: var(--dark); }
.btn-primary:hover { background: #3a2e25; }
.btn-wa { background: var(--wa); color: #fff; border-color: var(--wa); }
.btn-wa:hover { background: #0e7569; border-color: #0e7569; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: 6px 8px; border-radius: 8px; color: var(--ink-3); font-size: 15px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-soft); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card h2, .section-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.lead-text { color: var(--ink-2); margin: 0 0 18px; max-width: 760px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill.sample { background: var(--warn-soft); color: var(--warn); border-color: #f0dcae; }
.pill.good { background: var(--good-soft); color: var(--good); border-color: #c4e6d3; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: #f2c5c1; }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: #e7d3bf; }

input[type=text], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=email], input[type=url], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 10px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(154, 106, 69, .15); }
textarea { resize: vertical; min-height: 64px; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
label.field .hint { font-weight: 400; color: var(--ink-3); }
label.field input, label.field textarea, label.field select { font-weight: 400; color: var(--ink); }
.banner > span { flex: 1; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: 13px; }

/* toggle */
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: #d4cbc1; border-radius: 99px; transition: .2s; cursor: pointer; }
.toggle span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.toggle input:checked + span { background: var(--good); }
.toggle input:checked + span::before { transform: translateX(16px); }

/* KPI tiles */
.kpi { padding: 16px 18px; }
.kpi .label { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; }
.kpi .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* bar charts */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; position: relative; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; position: relative; cursor: default; }
.bars .bar { width: 100%; max-width: 30px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .col:hover .bar { background: var(--accent-ink); }
.bars .x { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.bars .tip { position: absolute; bottom: calc(100% - 4px); background: var(--dark); color: #fff; font-size: 12px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0; transform: translateY(4px); transition: .12s; z-index: 2; }
.bars .col:hover .tip { opacity: 1; transform: none; }
.axis-line { border-top: 1px solid var(--line); }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 34px; gap: 10px; align-items: center; font-size: 13px; }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 0 4px 4px 0; }
.hbar .fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 3px; }
.hbar .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }

/* knowledge: prices editor */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 300px; }
.cat { margin-bottom: 18px; overflow: hidden; }
.cat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cat-head input { font-weight: 600; border-color: transparent; background: transparent; max-width: 320px; padding: 4px 6px; }
.cat-head input:hover { border-color: var(--line-2); }
.price-grid { display: grid; grid-template-columns: minmax(200px, 2.2fr) 110px 110px minmax(90px, .8fr) minmax(160px, 1.6fr) 54px 44px 72px; gap: 8px; align-items: center; padding: 8px 16px; }
.price-grid.head { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding-top: 10px; padding-bottom: 4px; }
.price-row { border-bottom: 1px solid var(--line); }
.price-row:last-child { border-bottom: 0; }
.price-row.inactive { opacity: .5; }
.price-row .name-cell { display: flex; flex-direction: column; gap: 4px; }
.money { position: relative; }
.money input { padding-left: 38px; font-variant-numeric: tabular-nums; }
.money::before { content: 'AED'; position: absolute; left: 9px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--ink-3); font-weight: 600; pointer-events: none; }
.details-row { padding: 0 16px 12px; display: grid; grid-template-columns: 1fr; gap: 6px; }
.details-row[hidden] { display: none; }
.details-row textarea { min-height: 54px; font-size: 13px; }
.center { text-align: center; }
.check.center { justify-content: center; }
.m-only { display: none; }

/* offers */
.offer { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.offer.off { opacity: .55; }
.offer .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* faq */
.faq { padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; }
.faq + .faq { border-top: 1px solid var(--line); }

/* documents */
.drop { display: block; border: 2px dashed var(--line-2); border-radius: var(--radius); background: var(--surface); padding: 34px 20px; text-align: center; cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .big { font-size: 17px; font-weight: 600; margin: 6px 0 4px; }
.drop .types { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.doc { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; }
.doc + .doc { border-top: 1px solid var(--line); }
.doc .ext { width: 40px; height: 46px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.doc .preview { font-size: 12.5px; color: var(--ink-3); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 3px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 30%; animation: indet 1.2s infinite ease-in-out; }
@keyframes indet { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

/* banners */
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--warn-soft); border: 1px solid #f0dcae; color: #6b4600; margin-bottom: 18px; font-size: 13.5px; }
.banner.info { background: var(--accent-soft); border-color: #e7d3bf; color: var(--accent-ink); }
.banner .btn { margin-left: auto; }

/* empty */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }

/* toast + modal */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: var(--dark); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; font-size: 13.5px; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--bad); }
.modal { position: fixed; inset: 0; background: rgba(35, 28, 23, .45); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: 16px; width: min(760px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* tabs (mobile knowledge) */
.unanswered-item { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.unanswered-item + .unanswered-item { border-top: 1px solid var(--line); }
.unanswered-item .q { font-weight: 500; }
.answer-form { display: flex; gap: 8px; }

@media (max-width: 1100px) {
  .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .price-grid { grid-template-columns: minmax(160px, 2fr) 100px 100px 90px 54px 44px 72px; }
  .price-grid .note-col { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .menu-btn { display: block; }
  .topbar { padding: 14px 16px; }
  .view { padding: 16px 16px 60px; }
  .g-2, .g-3, .g-5 { grid-template-columns: 1fr 1fr; }
  .price-grid.head { display: none; }
  .price-grid { grid-template-columns: 1fr 1fr; }
  .price-grid .name-cell { grid-column: 1 / -1; }
  .price-grid .note-col { display: block; grid-column: 1 / -1; }
  .save-state { display: none; }
  .m-only { display: inline; }
  .check.center { justify-content: flex-start; text-align: left; }
}
@media (max-width: 520px) {
  .g-2, .g-3, .g-5 { grid-template-columns: 1fr; }
  .offer .two { grid-template-columns: 1fr; }
}

/* embedded inside the presentation diagram */
body.embed .app { grid-template-columns: 1fr; }
body.embed .sidebar, body.embed .topbar { display: none; }
body.embed .view { padding-top: 22px; }
body.embed .phone { top: 18px; max-height: calc(100vh - 40px); }
body.embed .inbox { height: calc(100vh - 46px); }
@media (max-width: 520px) {
  body.embed .phone { min-height: 0; max-height: none; height: calc(100vh - 32px); }
  body.embed .view { padding-top: 12px; }
}
@media (max-width: 760px) {
  body.embed .inbox { height: auto; }
  body.embed .inbox-list { max-height: 330px; }
}

/* presentation tour: the thing the viewer is asked to click */
.tour-pulse { animation: tour-pulse 1.3s ease-in-out infinite; position: relative; z-index: 60; }
@keyframes tour-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(18, 140, 126, .55); } 50% { box-shadow: 0 0 0 8px rgba(18, 140, 126, 0); } }

/* video: one element alone on screen */
#focusStage { position: fixed; inset: 0; z-index: 300; background: var(--bg); overflow: hidden; }
#focusStage[hidden] { display: none; }
#focusStage .fs-inner { width: calc(100% - 28px); margin: 0 14px; transform-origin: top center; }
#focusStage .card { box-shadow: 0 10px 40px rgba(35, 28, 23, .12); }
