@font-face { font-family: Tajawal; src: url(/static/fonts/Tajawal-Medium.ttf) format("truetype"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: Tajawal; src: url(/static/fonts/Tajawal-Bold.ttf) format("truetype"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: Tajawal; src: url(/static/fonts/Tajawal-ExtraBold.ttf) format("truetype"); font-weight: 800 900; font-display: swap; }

:root {
  --teal-950: #0C3540; --teal: #155263; --teal-700: #1d6f85; --teal-500: #2c8ba3; --teal-300: #7fb8c8; --teal-100: #dcedf1; --teal-50: #eef6f8;
  --or: #FF6F3C; --or2: #FF9A3C; --gold: #FFC93C;
  --cream: #FBF7F3; --cream2: #F3ECE4; --line: #E4D9CD; --muted: #786A5F; --ink: #1C1613; --ink2: #362E29;
  --green: #257A55; --green-bg: #E2F1E9; --red: #C2462B; --red-bg: #FBE7E0; --amber: #9a5c06; --amber-bg: #FCEFD8;
  --shadow: 0 1px 2px rgba(54,46,41,.06), 0 6px 18px rgba(54,46,41,.06);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Tajawal, system-ui, sans-serif; font-weight: 500; font-size: 15px; line-height: 1.6; color: var(--ink); background: var(--cream); }
a { color: var(--teal-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 800; line-height: 1.25; color: var(--teal-950); margin: 0 0 .5em; }
h1 { font-size: 28px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0 0 .8em; }
code, pre, .mono { font-family: var(--mono); font-size: 13px; }
:not(pre) > code { background: var(--cream2); color: var(--teal-950); padding: 1px 6px; border-radius: 6px; word-break: break-word; }
small, .muted { color: var(--muted); }
.center { text-align: center; }
.inline { display: inline-flex; gap: 10px; align-items: center; margin: 0; }
.hl { background: linear-gradient(transparent 58%, rgba(255,201,60,.75) 58%, rgba(255,201,60,.75) 92%, transparent 92%); padding: 0 2px; }

/* top bar */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--teal-950); font-weight: 900; font-size: 20px; text-decoration: none !important; }
.mark { width: 32px; height: 32px; border-radius: 10px; background: var(--teal); color: var(--gold); display: grid; place-items: center; font-size: 19px; font-weight: 900; padding-bottom: 2px; }
.brand .tag { font-size: 11px; font-weight: 700; color: var(--or); background: #fff2ea; border-radius: 999px; padding: 1px 8px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--ink2); padding: 6px 10px; border-radius: 10px; font-weight: 700; font-size: 14px; }
.nav a:hover { background: var(--cream2); text-decoration: none; }
.nav a.on { background: var(--teal-50); color: var(--teal); }
.right { display: flex; gap: 8px; align-items: center; }
.who { font-weight: 700; color: var(--ink2); font-size: 14px; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; font-size: 18px; cursor: pointer; }

main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 40px; }
.foot { max-width: 1180px; margin: 0 auto; padding: 20px 16px 40px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.flash { max-width: 1148px; margin: 14px auto 0; padding: 10px 14px; border-radius: 12px; background: var(--green-bg); color: var(--green); font-weight: 700; }
.flash.err { background: var(--red-bg); color: var(--red); }
@media (max-width: 1180px) { .flash { margin: 14px 16px 0; } }

/* cards, buttons, forms */
.card { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card.narrow { max-width: 560px; margin: 40px auto; }
.card.tint { background: var(--teal-50); box-shadow: none; border: 1px solid var(--teal-100); }
.card.sticky { background: #FFF3B0; box-shadow: none; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--teal); color: #fff; border: 0; border-radius: 12px; padding: 9px 16px; font: inherit; font-weight: 800; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn.accent { background: var(--or); }
.btn.ghost { background: #fff; color: var(--teal); box-shadow: inset 0 0 0 1.5px var(--teal-100); }
.btn.danger { background: #fff; color: var(--red); box-shadow: inset 0 0 0 1.5px #f2c9bb; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.form label { display: block; font-weight: 700; color: var(--ink2); margin-bottom: 12px; font-size: 14px; }
.form small { display: block; font-weight: 500; margin-top: 3px; }
input, textarea, select { display: block; width: 100%; margin-top: 5px; font: inherit; font-weight: 500; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 11px; padding: 9px 12px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px var(--teal-100); }
textarea { resize: vertical; min-height: 84px; }
input[type=checkbox] { display: inline; width: auto; margin: 0 6px 0 0; }
.err { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 10px; align-items: end; }
.filters label { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); }

/* auth */
.auth { display: grid; grid-template-columns: 1fr 420px; gap: 40px; align-items: center; max-width: 960px; margin: 30px auto; }
.auth-side h1 { font-size: 34px; }
.ticks { list-style: none; padding: 0; margin: 16px 0 0; }
.ticks li { padding: 6px 0 6px 28px; position: relative; font-weight: 700; color: var(--ink2); }
.ticks li::before { content: ""; position: absolute; left: 0; top: 10px; width: 16px; height: 16px; border-radius: 5px; background: var(--gold); box-shadow: inset 0 0 0 4px #fff3cf; }

/* landing */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; padding: 30px 0 20px; }
.hero h1 { font-size: 44px; font-weight: 900; line-height: 1.12; }
.hero p.lead { font-size: 18px; color: var(--ink2); max-width: 52ch; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step-n { width: 30px; height: 30px; border-radius: 9px; background: var(--teal); color: var(--gold); font-weight: 900; display: grid; place-items: center; margin-bottom: 8px; }
.section-title { margin: 34px 0 14px; }

/* code */
pre.code { position: relative; background: var(--teal-950); color: #e6f0f2; border-radius: 12px; padding: 14px 16px; overflow-x: auto; line-height: 1.55; margin: 8px 0 12px; white-space: pre; }
pre.code .c { color: #8fb5c0; }
pre.code .s { color: #ffd07a; }
pre.code .k { color: #ff9a7a; }
pre.code.has-copy { padding-top: 36px; }
.copy-btn { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; font: inherit; font-size: 12px; font-weight: 700; padding: 2px 9px; cursor: pointer; z-index: 2; }
.copy-btn:hover { background: rgba(255,255,255,.2); }

/* avatars, people */
.av { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 800; flex: none; object-fit: cover; }
.av.sm { width: 34px; height: 34px; font-size: 13px; } .av.md { width: 46px; height: 46px; font-size: 16px; } .av.lg { width: 84px; height: 84px; font-size: 28px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.person { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.person .top-row { display: flex; gap: 12px; align-items: center; }
.person .name { font-weight: 800; color: var(--teal-950); }
.person .name-ar { font-size: 13px; color: var(--muted); }
.person .head { font-size: 13px; color: var(--ink2); min-height: 40px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; font-weight: 700; background: var(--cream2); color: var(--ink2); border-radius: 999px; padding: 2px 10px; }
.chip.t { background: var(--teal-50); color: var(--teal); }
.chip.o { background: #fff2ea; color: #b8471c; }
.pill { display: inline-block; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 1px 9px; line-height: 1.7; }
.pill.s2 { background: var(--green-bg); color: var(--green); } .pill.s3 { background: var(--teal-50); color: var(--teal); }
.pill.s4 { background: var(--amber-bg); color: var(--amber); } .pill.s5, .pill.bad { background: var(--red-bg); color: var(--red); }
.pill.n { background: var(--cream2); color: var(--muted); }

/* feed */
.feed-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.side-card { position: sticky; top: 76px; }
.me-card { text-align: center; }
.me-card .stats { display: flex; justify-content: center; gap: 18px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.me-card .stats b { display: block; font-size: 18px; color: var(--teal-950); }
.post { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px; }
.post-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.post-head .meta { line-height: 1.3; }
.post-head .meta b { color: var(--teal-950); }
.post-head .meta small { display: block; }
.post-text { white-space: pre-wrap; word-wrap: break-word; margin-bottom: 10px; unicode-bidi: plaintext; }
.post-foot { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--cream2); padding-top: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.post-foot form { margin: 0; }
.idtag { font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--cream2); border-radius: 6px; padding: 0 6px; margin-left: auto; }
details > summary { cursor: pointer; font-weight: 700; color: var(--teal-700); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.comments { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.comment { background: var(--cream); border-radius: 10px; padding: 8px 12px; font-size: 14px; unicode-bidi: plaintext; }
.comment b { color: var(--teal-950); }

/* lists, tables */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--cream2); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--cream2); vertical-align: top; }
.tbl th { background: var(--cream); color: var(--muted); font-weight: 800; font-size: 12px; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.empty { color: var(--muted); padding: 14px 0; text-align: center; }
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 14px 0; font-size: 14px; color: var(--muted); }

/* jobs */
.job { display: flex; gap: 14px; align-items: flex-start; }
.logo { width: 46px; height: 46px; border-radius: 12px; background: var(--teal-50); color: var(--teal); font-weight: 900; display: grid; place-items: center; flex: none; font-size: 16px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }

/* messages */
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; padding: 6px 2px; }
.bubble { max-width: 75%; padding: 8px 12px; border-radius: 14px; background: var(--cream2); align-self: flex-start; white-space: pre-wrap; unicode-bidi: plaintext; }
.bubble.me { background: var(--teal); color: #fff; align-self: flex-end; }
.bubble small { display: block; font-size: 11px; opacity: .7; }

/* dashboard */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.dash-grid .full { grid-column: 1 / -1; }
.key { display: block; background: var(--teal-950); color: var(--gold); padding: 12px 14px; border-radius: 12px; font-size: 14px; letter-spacing: .02em; word-break: break-all; margin: 8px 0 10px; transition: filter .2s; }
.blur { filter: blur(6px); }
pre .secret { cursor: pointer; border-radius: 4px; }
pre .secret.blur { filter: blur(4px); background: rgba(255,201,60,.25); }
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; margin: 6px 0 12px; }
.events-grid label { font-weight: 600; font-size: 13px; margin: 0; display: flex; align-items: center; }
.welcome { background: var(--teal); color: #fff; border-radius: var(--r); padding: 20px 22px; margin-bottom: 16px; }
.welcome h1 { color: #fff; }
.welcome ol { margin: 8px 0 0; padding-left: 20px; }
.welcome a { color: var(--gold); font-weight: 800; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.stat b { display: block; font-size: 30px; font-weight: 900; color: var(--or); line-height: 1.1; }

@media (max-width: 1000px) {
  .feed-grid { grid-template-columns: minmax(0, 1fr); }
  .feed-grid .left, .feed-grid .rightcol { display: none; }
  .two-col, .dash-grid, .hero, .auth { grid-template-columns: minmax(0, 1fr); }
  .three, .stat-row { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .menu-btn { display: block; margin-left: auto; }
  .top-in { flex-wrap: wrap; }
  .nav, .right { display: none; width: 100%; }
  .top.open .nav, .top.open .right { display: flex; }
  .nav { flex-direction: column; }
  .hero h1 { font-size: 32px; }
  .three, .stat-row, .filters { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
  .card { padding: 16px; }
  .idtag { margin-left: 0; }
}

/* docs */
.docs { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; align-items: start; }
.docs-nav { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; }
.docs-nav-in { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.docs-nav b { margin: 14px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.docs-nav a { color: var(--ink2); padding: 3px 10px; border-radius: 8px; font-weight: 600; }
.docs-nav a:hover { background: var(--cream2); text-decoration: none; }
.docs-body { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 28px 32px; min-width: 0; }
.docs-body section { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--cream2); scroll-margin-top: 80px; }
.docs-body h2 { font-size: 24px; margin-top: 6px; }
.docs-body h3 { margin-top: 18px; }
.lead { font-size: 17px; color: var(--ink2); }
.small { font-size: 13px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 14px 0; }
.kv > div { background: var(--cream); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.kv b { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ep { border: 1px solid var(--cream2); border-radius: 12px; padding: 14px 16px; margin: 12px 0; scroll-margin-top: 80px; }
.ep h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ep h3 code { font-size: 15px; background: none; padding: 0; }
.m { font-family: var(--mono); font-size: 12px; font-weight: 800; border-radius: 6px; padding: 2px 8px; color: #fff; }
.m-get { background: var(--teal-700); } .m-post { background: var(--green); } .m-patch { background: #9a5c06; } .m-delete { background: var(--red); } .m-any { background: #55606b; }
ol.steps { padding-left: 20px; } ol.steps li { margin-bottom: 10px; }
.docs-body .tbl-wrap { margin: 10px 0; }

/* right-to-left pages */
[dir=rtl] body { font-size: 16px; }
[dir=rtl] .ar { max-width: 880px; margin: 0 auto; }
[dir=rtl] pre, [dir=rtl] code { direction: ltr; unicode-bidi: isolate; }
[dir=rtl] pre.code { text-align: left; }
[dir=rtl] ol, [dir=rtl] ul { padding-left: 0; padding-right: 22px; }
[dir=rtl] .tbl th, [dir=rtl] .tbl td { text-align: right; }
[dir=rtl] .top-in, [dir=rtl] .foot { direction: ltr; }
@media (max-width: 1000px) {
  .docs { grid-template-columns: minmax(0, 1fr); }
  .docs-nav { position: static; max-height: none; }
  .docs-nav-in { flex-direction: row; flex-wrap: wrap; }
  .docs-nav b { width: 100%; }
  .docs-body { padding: 18px; }
}
