/* Riz Inbox: Rizkalla navy + yellow, blue for status, no green. Desktop only. */
@font-face { font-family: Poppins; src: url(/assets/Poppins-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: Poppins; src: url(/assets/Poppins-Bold.ttf); font-weight: 600 700; font-display: swap; }
@font-face { font-family: Cairo; src: url(/assets/Cairo-Regular.ttf); font-display: swap; }
:root {
  --bg: #f3f5f9; --surface: #fff; --surface2: #eef3f9; --line: #e3e8ef; --line2: #d3dbe6;
  --fg: #14223b; --muted: #5b6b85; --navy: #043a6d; --navy2: #022a50;
  --yellow: #fed700; --yellow-soft: #fff7cc; --blue: #175cd3; --blue-soft: #e6eefc;
  --amber: #b54708; --amber-soft: #fff4e5; --red: #b42318; --red-soft: #fdecea;
  --chat: #eef1f6; --out: #dbe7fb; --note: #fff7cc;
  --font: Poppins, Cairo, system-ui, sans-serif; --ar: Cairo, Poppins, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); min-width: 1024px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.boot { padding: 40px; color: var(--muted); }
.ar, [dir='auto'] { unicode-bidi: plaintext; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* buttons, chips */
.btn { border: 1px solid var(--line2); background: var(--surface); border-radius: 8px; padding: 6px 12px; font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--navy); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.pri { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.btn.pri:hover { background: var(--navy2); }
.btn.y { background: var(--yellow); border-color: var(--yellow); color: var(--fg); font-weight: 600; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface2); color: var(--fg); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip b { margin-left: 4px; }
.chip.label { padding: 1px 4px 1px 9px; display: inline-flex; gap: 2px; align-items: center; }
.chip.label button { border: 0; background: none; color: var(--muted); padding: 0 4px; }
.pill { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 8px; background: var(--blue-soft); color: var(--blue); }
.pill.y { background: var(--yellow); color: var(--fg); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.av { width: 30px; height: 30px; border-radius: 50%; background: var(--surface2); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.av.ai { background: var(--navy); color: var(--yellow); }
.ch { display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 4px; border-radius: 5px; font-size: 10px; font-weight: 700; background: var(--surface2); color: var(--navy); flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--line2); }
.dot.on { background: var(--blue); }
.unread { width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); border: 1px solid #c9a800; }
input[type='text'], input[type='email'], input[type='password'], input[type='search'], input[type='time'], textarea, select {
  border: 1px solid var(--line2); border-radius: 8px; padding: 7px 10px; background: var(--surface); width: 100%;
}
textarea { resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
label.field small { font-weight: 400; color: var(--muted); }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--fg); font-size: 15px; margin-bottom: 4px; }

/* shell */
.shell { height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); flex: none; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--navy); }
.logo img { height: 26px; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.tabs a.on { background: var(--surface2); color: var(--navy); font-weight: 600; }
.tabs a .ar { font-size: 12px; }
.tabs em { font-style: normal; font-size: 11px; background: var(--yellow); color: var(--fg); border-radius: 999px; padding: 0 6px; font-weight: 700; }
.grow { flex: 1; }
.availability { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 10px; background: var(--surface); }
.me-menu { position: relative; }
.menu { position: absolute; right: 0; top: 38px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(4, 58, 109, 0.14); padding: 6px; min-width: 200px; z-index: 30; display: flex; flex-direction: column; }
.menu button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; }
.menu button:hover { background: var(--surface2); }
.main { flex: 1; min-height: 0; display: flex; }
.banner { background: var(--yellow-soft); padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--line); }

/* inbox */
.list { width: 330px; flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.rows { overflow-y: auto; flex: 1; }
.row { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; padding: 10px 12px; align-items: start; }
.row:hover { background: #f7f9fc; }
.row.sel { background: var(--surface2); }
.row .nm { font-weight: 600; display: flex; gap: 6px; align-items: center; min-width: 0; }
.row .nm span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sn { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.row .meta { font-size: 11px; color: var(--muted); text-align: right; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; white-space: nowrap; }
.row .who { font-size: 11px; color: var(--muted); }

.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--chat); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.chat-head .who { display: flex; flex-direction: column; min-width: 0; }
.chat-head .who small { color: var(--muted); }
.chat-head select { width: auto; }
.handover { margin: 10px 14px 0; background: var(--yellow-soft); border-radius: 10px; padding: 8px 12px; display: flex; gap: 10px; align-items: center; }
.msgs { flex: 1; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 6px; }
.b { max-width: 68%; padding: 7px 10px 5px; border-radius: 10px; background: var(--surface); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05); word-wrap: break-word; font-family: var(--ar); }
.b .tx { white-space: pre-wrap; display: block; }
.b.out { align-self: flex-end; background: var(--out); }
.b.note { align-self: flex-end; background: var(--note); border: 1px dashed #e0c200; }
.b .by { display: block; font-family: var(--font); font-size: 11px; color: var(--navy); font-weight: 600; margin-bottom: 2px; }
.b .tm { display: flex; justify-content: flex-end; gap: 6px; font-family: var(--font); font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.b.failed { border: 1px solid var(--red); }
.b .err { font-family: var(--font); color: var(--red); font-size: 12px; margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.b img.media { max-width: 280px; max-height: 300px; border-radius: 6px; display: block; margin-bottom: 4px; cursor: zoom-in; }
.b video { max-width: 300px; border-radius: 6px; display: block; }
.b audio { width: 260px; display: block; }
.b .file { display: inline-flex; gap: 6px; align-items: center; background: rgba(255, 255, 255, 0.6); border-radius: 6px; padding: 6px 8px; margin-bottom: 4px; font-family: var(--font); }
.sys { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--surface); border-radius: 999px; padding: 2px 12px; margin: 4px 0; text-align: center; max-width: 80%; }
.day { align-self: center; font-size: 11px; color: var(--muted); margin: 8px 0 2px; }
.suggest { margin: 0 14px; background: var(--surface); border: 1px solid var(--blue); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.suggest .t { white-space: pre-wrap; font-family: var(--ar); }
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.composer.note-mode { background: var(--note); }
.composer textarea { min-height: 64px; max-height: 240px; font-family: var(--ar); border-radius: 10px; }
.composer .bar { display: flex; gap: 8px; align-items: center; }
.composer .files { display: flex; gap: 6px; flex-wrap: wrap; }
.timer { font-size: 12px; color: var(--muted); }
.timer.warn { color: var(--amber); font-weight: 600; }
.picker { position: absolute; bottom: 100%; left: 14px; right: 14px; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(4, 58, 109, 0.14); z-index: 20; }
.picker button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 8px 12px; }
.picker button:hover, .picker button.act { background: var(--surface2); }
.picker button small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--ar); }
.closed { padding: 12px 14px; background: var(--amber-soft); color: var(--amber); display: flex; gap: 10px; align-items: center; }

.card { width: 270px; flex: none; background: var(--surface); border-left: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.kv { display: flex; flex-direction: column; gap: 4px; }
.kv > small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.labels { display: flex; gap: 6px; flex-wrap: wrap; }

/* comments */
.posts { width: 340px; flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.post { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; display: grid; grid-template-columns: 56px 1fr; gap: 10px; padding: 10px 12px; }
.post:hover { background: #f7f9fc; }
.post.sel { background: var(--surface2); }
.thumb { width: 56px; height: 56px; border-radius: 8px; background: var(--surface2) center / cover no-repeat; display: grid; place-items: end start; font-size: 9px; font-weight: 700; color: var(--navy); padding: 3px; }
.post .tx { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-family: var(--ar); }
.thread { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--chat); }
.post-head { display: flex; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); align-items: flex-start; }
.post-head .thumb { width: 64px; height: 64px; }
.post-head .tx { font-family: var(--ar); white-space: pre-wrap; max-height: 64px; overflow: hidden; }
.cms { flex: 1; overflow-y: auto; }
.cm { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.cm.reply { padding-left: 56px; background: #fafbfd; }
.cm.handled .txt { color: var(--muted); }
.cm .txt { font-family: var(--ar); white-space: pre-wrap; }
.cm .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.cm .state { font-size: 12px; margin-top: 6px; color: var(--blue); }
.cm .state.hidden { color: var(--muted); }
.cm .draft { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface2); border-radius: 10px; padding: 10px; }

/* settings */
.side { width: 230px; flex: none; background: var(--surface); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.side a { padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--fg); display: flex; flex-direction: column; }
.side a small { color: var(--muted); font-family: var(--ar); }
.side a.on { background: var(--yellow-soft); color: var(--navy); font-weight: 600; }
.pane { flex: 1; overflow-y: auto; padding: 24px 32px; }
.pane-inner { max-width: 820px; display: flex; flex-direction: column; gap: 18px; }
.pane h2 { margin: 0; color: var(--navy); font-size: 20px; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.box h3 { margin: 0; font-size: 15px; }
.prow { display: grid; grid-template-columns: 30px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.prow small { color: var(--muted); display: block; }
.seg { display: flex; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; border: 0; border-right: 1px solid var(--line2); background: var(--surface); padding: 10px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--navy); color: #fff; font-weight: 600; }
.seg button small { display: block; font-weight: 400; font-size: 11.5px; opacity: 0.85; }
.conn { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.conn small { color: var(--muted); display: block; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line2); pointer-events: none; transition: background 0.15s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { left: 19px; }
.switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.copy { display: flex; gap: 8px; align-items: center; }
.copy code { flex: 1; background: var(--surface2); border-radius: 6px; padding: 6px 10px; font-size: 12.5px; overflow-x: auto; white-space: nowrap; }
pre.log { background: var(--surface2); border-radius: 8px; padding: 10px; font-size: 11.5px; max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

/* sign in */
.auth { min-height: 100vh; display: grid; place-items: center; }
.auth form { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: 380px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 8px 30px rgba(4, 58, 109, 0.08); }
.auth img { height: 34px; align-self: flex-start; }
.auth h1 { margin: 0; font-size: 20px; color: var(--navy); }
.error { color: var(--red); font-size: 13px; }

/* dialogs, toast */
.overlay { position: fixed; inset: 0; background: rgba(20, 34, 59, 0.45); display: grid; place-items: center; z-index: 50; }
.dialog { background: var(--surface); border-radius: 14px; padding: 20px; width: 520px; max-height: 85vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.dialog h3 { margin: 0; color: var(--navy); }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); display: grid; place-items: center; z-index: 60; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--fg); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 70; max-width: 560px; font-size: 13.5px; }
#toast.bad { background: var(--red); }
.drop { outline: 3px dashed var(--blue); outline-offset: -8px; }

.cm > div { max-width: 780px; min-width: 0; }
.post-head > div { max-width: 780px; }
