/* Jisr on the phone: the Minassa house look (cool grey grounds, hairlines, the app's own hue as accent). */
@font-face { font-family: "Plex"; src: url(/static/IBMPlexSans-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url(/static/IBMPlexSans-SemiBold.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: "PlexAr"; src: url(/static/IBMPlexSansArabic-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: "PlexAr"; src: url(/static/IBMPlexSansArabic-SemiBold.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: "Kufi"; src: url(/static/ReemKufi-Bold.ttf); font-weight: 700; font-display: swap; }

:root {
  --bg: #EEF1F5; --surface: #FFFFFF; --raised: #F5F7FA; --sunk: #E3E8EF;
  --line: #D3DAE4; --line-strong: #B9C3D1;
  --text: #141A26; --soft: #2F3A4C; --muted: #546072; --faint: #7A8597;
  --accent: #127367; --accent-hover: #075D53; --accent-ink: #FFFFFF; --accent-soft: #D2F8F0;
  --ok: #1F8A5B; --danger: #C9343F; --danger-soft: #FBE4E6;
  --radius: 12px; --radius-s: 9px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D1119; --surface: #151B27; --raised: #1A2130; --sunk: #111622;
    --line: #273042; --line-strong: #36425A;
    --text: #E6EAF2; --soft: #C3CBD8; --muted: #98A3B6; --faint: #6B768A;
    --accent: #31D2BE; --accent-hover: #6DE2D0; --accent-ink: #0D1119; --accent-soft: #052823;
    --ok: #4CC38A; --danger: #F2747E; --danger-soft: #3A1D24;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 "PlexAr", "Plex", system-ui, sans-serif; min-height: 100vh; }
html[lang=en] body { font-family: "Plex", "PlexAr", system-ui, sans-serif; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
h1 { font-size: 22px; margin: 4px 0 6px; font-weight: 600; }
h2.sec { font-size: 13px; font-weight: 600; color: var(--muted); margin: 22px 4px 8px; letter-spacing: .01em; }

#app { max-width: 640px; margin: 0 auto; padding: 0 14px calc(88px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
       padding: calc(10px + env(safe-area-inset-top)) 2px 10px; background: var(--bg); }
.top .mark { width: 34px; height: 34px; }
.top .who { flex: 1; min-width: 0; }
.top .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .name [data-t=Jisr] { font-family: "Kufi", "PlexAr"; color: var(--accent); }
html[lang=en] .top .name [data-t=Jisr] { font-family: "Plex"; }
.top .pc { color: var(--muted); font-weight: 400; }
.line { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; }
.line.on .dot { background: var(--ok); }

.chip, .btn { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: var(--radius-s); padding: 8px 12px; display: inline-flex; align-items: center; gap: 8px;
  justify-content: center; cursor: pointer; text-decoration: none; min-height: 40px; font-weight: 600; font-size: 14px; }
.chip { border-radius: 999px; min-height: 32px; padding: 4px 12px; font-size: 13px; }
.btn:active, .chip:active { background: var(--sunk); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:active { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.composer textarea { width: 100%; font: inherit; color: var(--text); background: var(--raised); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 10px 12px; resize: vertical; min-height: 76px; }
.composer textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 140px; }
.drop { margin-top: 12px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 16px; display: flex;
  flex-direction: column; align-items: center; gap: 2px; cursor: pointer; text-align: center; }
.drop svg { width: 26px; height: 26px; color: var(--accent); }
.drop span:first-of-type { font-weight: 600; }
.up { margin-top: 10px; font-size: 13px; }
.up .bar { height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; margin-top: 4px; }
.up .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up .meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.up .meta b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up.done .bar i { background: var(--ok); }
.up.fail .bar i { background: var(--danger); }

.row-h { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.row-h b { color: var(--text); }
.clip-text { margin: 8px 0 10px; background: var(--raised); border-radius: var(--radius-s); padding: 10px 12px; max-height: 120px;
  overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 14px; }

.timeline { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 86%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
  align-self: flex-start; }
.msg.out { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.msg .body a { color: var(--accent); word-break: break-all; }
.msg .meta { font-size: 11.5px; color: var(--faint); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.msg .tools { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.msg .tools .btn { min-height: 34px; padding: 4px 10px; font-size: 13px; }
.msg .file { display: flex; align-items: center; gap: 10px; }
.msg .file svg { width: 26px; height: 26px; color: var(--accent); }
.msg .file b { display: block; word-break: break-all; font-weight: 600; }
.msg img.thumb { display: block; max-width: 100%; max-height: 240px; border-radius: 10px; margin-top: 8px; }
.empty { text-align: center; margin: 18px 12px; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; gap: 4px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); z-index: 6; }
.tabs button { flex: 1; max-width: 200px; font: inherit; font-size: 12px; background: none; border: 0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; }
.tabs button.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.hero { text-align: center; padding: 48px 12px; }
.hero-mark { width: 88px; height: 88px; }

.app-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.app-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex;
  flex-direction: column; align-items: flex-start; gap: 8px; cursor: pointer; font: inherit; color: var(--text); text-align: start; }
.app-tile .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.app-tile .ic svg { width: 22px; height: 22px; }
.app-tile b { font-weight: 600; }
.app-tile span { font-size: 12.5px; color: var(--muted); }

.back { font: inherit; background: none; border: 0; color: var(--accent); display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 0; font-weight: 600; }
html[dir=ltr] .back svg { transform: scaleX(-1); }
.page-body { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.w-text.big { font-size: 20px; font-weight: 600; line-height: 1.35; }
.w-text.small { font-size: 13px; color: var(--muted); }
.w-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.w-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.w-stat .v { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; text-align: start; unicode-bidi: plaintext; }
.w-stat .l { font-size: 12.5px; color: var(--muted); }
.w-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.w-row .btn, .w-btn { min-height: 56px; flex-direction: column; gap: 4px; font-size: 13px; }
.w-row .btn svg, .w-btn svg { width: 24px; height: 24px; }
.w-btn.big { min-height: 64px; flex-direction: row; font-size: 15px; }
.w-toggle, .w-slider { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.w-slider { flex-direction: column; align-items: stretch; }
.w-slider input { width: 100%; accent-color: var(--accent); }
.switch { width: 46px; height: 28px; border-radius: 14px; background: var(--line-strong); position: relative; border: 0; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { inset-inline-start: 21px; }
.w-input { display: flex; gap: 8px; }
.w-input input { flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 8px 12px; min-height: 44px; }
.w-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.w-list button { display: block; width: 100%; text-align: start; font: inherit; color: var(--text); background: none; border: 0;
  border-top: 1px solid var(--line); padding: 12px 14px; }
.w-list button:first-child { border-top: 0; }
.w-list button.on { background: var(--accent-soft); }
.w-list small { display: block; color: var(--muted); font-size: 12.5px; }
.w-pad { height: 46vh; min-height: 240px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius);
  touch-action: none; position: relative; display: grid; place-items: center; color: var(--faint); font-size: 13px; user-select: none; -webkit-user-select: none; }
.w-pad-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.w-keys input { width: 100%; }
.w-image { max-width: 100%; border-radius: var(--radius); }

.set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.set:first-child { border-top: 0; padding-top: 0; }
.set:last-child { padding-bottom: 0; }
.seg { display: flex; background: var(--sunk); border-radius: 999px; padding: 3px; }
.seg button { font: inherit; font-size: 13px; border: 0; background: none; color: var(--muted); padding: 5px 12px; border-radius: 999px; }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

#toasts { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; z-index: 20; pointer-events: none; }
.toast { pointer-events: auto; max-width: 520px; width: 100%; background: var(--text); color: var(--bg); border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: drop .2s ease-out; }
.toast b { display: block; }
.line-why { font-size: 12px; color: var(--muted); margin-top: 2px; }
.msg img.thumb { cursor: zoom-in; }
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 16px; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.toast-img { display: block; width: 100%; max-height: 50vh; object-fit: contain; border-radius: 8px; margin-top: 8px; }
.toast.alert { border-inline-start: 5px solid var(--danger); }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }
