:root {
  --navy: #2C5EAD;
  --blue: #1591DC;
  --sky: #4BB8FA;
  --ice: #C4E2F5;
  --ink: #15294d;
  --muted: #5d6f8c;
  --line: #e2ebf5;
  --bg: #f5f9fd;
  --card: #ffffff;
  --ok: #17a673;
  --bad: #d64545;
  --warn: #e3a008;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(44, 94, 173, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "IBM Plex Sans Arabic", "Tajawal", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5em; }
.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(560px, 100% - 32px); margin-inline: auto; }

/* Header */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 1.2rem; }
.brand img { width: 38px; height: 38px; }
.brand small { color: var(--blue); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav form { margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; border: 1.5px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; transition: .15s; white-space: nowrap;
  background: var(--navy); color: #fff;
}
.btn:hover { filter: brightness(1.08); }
.btn-blue { background: linear-gradient(135deg, var(--blue), var(--navy)); }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--ice); }
.btn-outline:hover { border-color: var(--sky); }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-wa { background: #25D366; color: #fff; }
.btn-danger { background: #fff; color: var(--bad); border-color: #f3caca; }
.btn-sm { padding: 6px 12px; font-size: .88rem; border-radius: 10px; }
.btn-lg { padding: 14px 26px; font-size: 1.08rem; }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 12px; margin: 16px 0; font-weight: 500; }
.flash.success { background: #e6f7f0; color: #0f6e4c; }
.flash.error { background: #fdecec; color: #9b2c2c; }

/* Hero */
.hero { background: radial-gradient(1200px 500px at 85% -10%, var(--ice), transparent 60%), linear-gradient(180deg, #fff, var(--bg)); padding: 64px 0 40px; }
.hero .container { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); }
.hero h1 span { background: linear-gradient(135deg, var(--sky), var(--navy)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 1.15rem; max-width: 34em; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.phone-mock { width: min(330px, 100%); margin-inline: auto; background: #0e1b33; border-radius: 36px; padding: 14px; box-shadow: 0 30px 60px rgba(21, 41, 77, .25); }
.phone-mock .screen { background: #e9f1f8; border-radius: 26px; overflow: hidden; padding: 14px; }
.wa-bubble { background: #fff; border-radius: 12px; padding: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.08); font-size: .88rem; }
.wa-bubble .card-img { border-radius: 8px; aspect-ratio: 4/5; background: linear-gradient(160deg, var(--navy), var(--blue) 55%, var(--sky)); display: grid; place-items: center; color: #fff; text-align: center; font-family: "Aref Ruqaa", serif; font-size: 2.6rem; line-height: 1.3; padding: 16px; }
.wa-bubble .card-img small { display: block; font-family: "IBM Plex Sans Arabic"; font-size: .8rem; opacity: .85; margin: 8px 0; line-height: 1.6; }
.wa-bubble p { margin: 8px 4px; }
.wa-bubble .wa-btn { border-top: 1px solid #eee; text-align: center; color: #1591DC; padding-top: 8px; font-weight: 600; }

.section { padding: 56px 0; }
.section h2 { text-align: center; font-size: 1.8rem; }
.section .lead { text-align: center; color: var(--muted); margin-bottom: 32px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.step { background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.step .num { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--ice); color: var(--navy); font-weight: 700; margin-bottom: 10px; }
.step p { color: var(--muted); margin: 0; font-size: .95rem; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.feature b { display: block; margin-bottom: 4px; }
.feature span { color: var(--muted); font-size: .95rem; }
.cta { background: linear-gradient(135deg, var(--navy), var(--blue)); color: #fff; border-radius: 24px; padding: 40px; text-align: center; }
.cta p { opacity: .9; }
.cta .btn { background: #fff; color: var(--navy); }

/* Cards & forms */
.page { padding: 32px 0 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 1.6rem; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.panel h2 { font-size: 1.2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
label .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.field { margin-bottom: 16px; }
input, select, textarea {
  width: 100%; font: inherit; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 4px rgba(75, 184, 250, .15); }
input[type="tel"], input[type="email"] { direction: ltr; text-align: right; }
textarea { min-height: 110px; resize: vertical; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.auth-box { max-width: 440px; margin: 48px auto; }

/* Dashboard */
.event-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.event-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: var(--ink); display: flex; flex-direction: column; }
.event-card .thumb { aspect-ratio: 4/3; background: var(--ice) center/cover no-repeat; }
.event-card .body { padding: 16px; }
.event-card h3 { font-size: 1.1rem; margin-bottom: 2px; }
.empty { text-align: center; padding: 56px 20px; }

/* Event page */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.6rem; color: var(--navy); line-height: 1.2; }
.stat span { color: var(--muted); font-size: .88rem; }
.event-layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.card-preview img { border-radius: 12px; border: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
td form { margin: 0; display: inline; }
.ltr { direction: ltr; unicode-bidi: embed; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.b-pending { background: #eef2f7; color: #5d6f8c; }
.b-accepted { background: #e6f7f0; color: #0f6e4c; }
.b-declined { background: #fdecec; color: #9b2c2c; }
.b-sent, .b-delivered { background: #e7f3fd; color: #1567a8; }
.b-read { background: #d8eefc; color: #2C5EAD; }
.b-failed { background: #fdecec; color: #9b2c2c; }
.b-not_sent { background: #f4f4f4; color: #888; }
.b-manual { background: #e7f3fd; color: #1567a8; }
details summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.msg { border-bottom: 1px solid var(--line); padding: 10px 0; }
.msg:last-child { border: 0; }
.msg b { color: var(--navy); }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

/* Design page */
.design-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start; }
.designs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.design-opt { border: 2.5px solid transparent; border-radius: 14px; padding: 6px; background: #fff; cursor: pointer; box-shadow: var(--shadow); text-align: center; font-weight: 600; font-size: .9rem; }
.design-opt canvas { width: 100%; height: auto; border-radius: 10px; display: block; margin-bottom: 6px; }
.design-opt.active { border-color: var(--blue); }
.preview-box { position: sticky; top: 88px; }
.preview-box canvas { width: 100%; height: auto; border-radius: 14px; box-shadow: var(--shadow); }

/* Scan */
#reader { width: 100%; max-width: 420px; margin: 0 auto 16px; border-radius: 16px; overflow: hidden; }
.scan-result { border-radius: 14px; padding: 18px; text-align: center; font-size: 1.15rem; font-weight: 700; display: none; }
.scan-result.ok { display: block; background: #e6f7f0; color: #0f6e4c; }
.scan-result.err { display: block; background: #fdecec; color: #9b2c2c; }
.scan-result.warn { display: block; background: #fff6e0; color: #8a5a00; }

.site-footer { padding: 28px 0; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); background: #fff; }
.site-footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .hero .container, .event-layout, .design-layout { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .features { grid-template-columns: 1fr; }
  .preview-box { position: static; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .steps { grid-template-columns: 1fr; }
  .site-header .container { height: auto; padding: 10px 0; }
  .brand small { display: none; }
  .panel { padding: 18px; }
  .hide-sm { display: none; }
}

/* ===== Wizard stepper ===== */
.stepper { display: flex; align-items: center; justify-content: center; gap: 0; margin: 0 auto 22px; max-width: 560px; }
.stepper .st { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); min-width: 70px; }
.stepper .st b { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #e9eef5; color: var(--muted); font-size: .95rem; }
.stepper .st small { font-size: .82rem; }
.stepper .st.cur b { background: var(--navy); color: #fff; box-shadow: 0 0 0 5px rgba(44, 94, 173, .15); }
.stepper .st.cur small { color: var(--navy); font-weight: 700; }
.stepper .st.done b { background: var(--ice); color: var(--navy); }
.stepper .line { flex: 1; height: 2px; background: #e2ebf5; margin-bottom: 22px; }
.stepper .line.done { background: var(--sky); }
.center { text-align: center; }

/* ===== Summary ===== */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 4px; }
.donut-wrap { display: flex; align-items: center; gap: 24px; justify-content: space-between; }
.donut { width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.donut > div { width: 100px; height: 100px; border-radius: 50%; background: #fff; display: grid; place-items: center; align-content: center; text-align: center; }
.donut b { font-size: 2rem; color: var(--ink); line-height: 1; }
.donut small { color: var(--muted); font-size: .78rem; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.legend li i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.legend li b { margin-inline-start: auto; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.balance .bal-head { display: flex; justify-content: space-between; align-items: baseline; }
.balance .bal-head b { font-size: 1.4rem; color: var(--ink); }
.bal-bar { height: 6px; background: #edf2f8; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bal-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--sky), var(--navy)); border-radius: 99px; margin-inline-start: auto; }
.menu { padding: 8px 20px; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 500; }
.menu a:last-child { border: 0; }
.menu a span { width: 26px; text-align: center; }
.menu a b { margin-inline-start: auto; color: var(--muted); font-weight: 500; font-size: .9rem; }

.cohost { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.cohost-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cohost .chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.cohost-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ===== Preview ===== */
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; max-width: 900px; margin: 0 auto; }
.wa-chat { background: #e7ddd3; border-radius: 20px; padding: 18px; max-width: 380px; margin: 0 auto; }
.wa-chat .wa-bubble { max-width: 320px; }
.phone-frame { width: 340px; max-width: 100%; height: 680px; margin: 0 auto; border: 12px solid #0e1b33; border-radius: 40px; overflow: hidden; background: #fff; box-shadow: 0 24px 50px rgba(21, 41, 77, .2); }
.phone-frame iframe { width: 100%; height: 100%; border: 0; }

/* ===== Scan & attendance ===== */
.confirm-box { text-align: center; border: 2px solid var(--ice); border-radius: 16px; padding: 18px; margin-top: 12px; }
.counter { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 12px; }
.counter b { font-size: 2.2rem; min-width: 50px; color: var(--navy); }
.counter .btn { width: 52px; height: 52px; font-size: 1.6rem; padding: 0; }
.att-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.att-row:last-child { border: 0; }

@media (max-width: 900px) {
  .summary-grid, .preview-grid { grid-template-columns: 1fr; }
}

/* ===== Footer business info ===== */
.site-footer .container { align-items: flex-start; }
.foot-brand { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.foot-brand img { width: 28px; height: 28px; }
.biz { font-size: .88rem; color: var(--muted); }
.biz-label { font-size: .78rem; }
.biz-name { color: var(--ink); font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.biz ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: auto auto; gap: 2px 20px; }
.biz b { color: var(--ink); font-weight: 600; }
@media (max-width: 560px) { .biz ul { grid-template-columns: 1fr; } }
