/* Fonts are self-hosted: no request ever leaves for a third-party font service. */
@font-face { font-family: "Noto Kufi Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/noto-kufi-arabic-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Kufi Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/noto-kufi-arabic-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Kufi Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/noto-kufi-arabic-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Kufi Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/noto-kufi-arabic-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Kufi Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/noto-kufi-arabic-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Kufi Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/noto-kufi-arabic-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/noto-sans-arabic-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/noto-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/noto-sans-arabic-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/noto-sans-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Sans Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/noto-sans-arabic-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/noto-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/noto-sans-arabic-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/noto-sans-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Naskh Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/noto-naskh-arabic-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Naskh Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/noto-naskh-arabic-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

/* Layout: one-screen app — rail (chats, tools) beside a reading column; Sadu band is the single bold element.
   The palette follows the viewer's local time: morning, noon, asr (afternoon), night. */
:root, :root[data-time="night"] {
  --bg:#0E1630; --bg-2:#16213F; --surface:#1B2749; --ink:#EDE6D6; --ink-2:#A9B0C4; --line:#2A365A;
  --accent:#C8A33C; --accent-ink:#0E1630; --weave-a:#C8A33C; --weave-b:#8E2A2A; --weave-c:#EDE6D6;
  --danger:#E07A6B; --code-bg:#0A0F20; --code-ink:#E6E9F2;
  --f-display:"Noto Kufi Arabic","Noto Sans Arabic","Noto Sans",system-ui,sans-serif;
  --f-body:"Noto Sans","Noto Sans Arabic",system-ui,-apple-system,"Segoe UI",sans-serif;
  --f-doc:"Noto Naskh Arabic","Times New Roman",serif;
  --f-mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color-scheme: dark;
}
:root[data-time="morning"] { --bg:#E9F0F1; --bg-2:#DCE7E9; --surface:#FFFFFF; --ink:#14303A; --ink-2:#4F6B73; --line:#C3D4D8;
  --accent:#2F8F83; --accent-ink:#FFFFFF; --weave-a:#2F8F83; --weave-b:#E0A53B; --weave-c:#14303A; --danger:#A8332A; color-scheme: light; }
:root[data-time="noon"] { --bg:#F7F7F2; --bg-2:#ECEDE4; --surface:#FFFFFF; --ink:#102119; --ink-2:#4C5D54; --line:#D6DACD;
  --accent:#0B6E4F; --accent-ink:#FFFFFF; --weave-a:#0B6E4F; --weave-b:#C8A33C; --weave-c:#102119; --danger:#A8332A; color-scheme: light; }
:root[data-time="asr"] { --bg:#F1DFC0; --bg-2:#E8D0A8; --surface:#FBF1DE; --ink:#3A2312; --ink-2:#6E5038; --line:#D9BC8C;
  --accent:#9E2B25; --accent-ink:#FFF6E8; --weave-a:#9E2B25; --weave-b:#3A2312; --weave-c:#C8A33C; --danger:#9E2B25; color-scheme: light; }

html, body { height: 100%; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
img { max-width: 100%; }
html { background: var(--bg); transition: background-color 1.2s ease; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.75; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }
h1, h2, h3 { text-wrap: balance; margin: 0; }
.kufi { font-family: var(--f-display); font-weight: 700; letter-spacing: 0; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }

.sadu { height: 22px; border-block: 3px solid var(--weave-b);
  background:
    linear-gradient(135deg, var(--weave-a) 25%, transparent 25%) -11px 0 / 22px 22px,
    linear-gradient(225deg, var(--weave-a) 25%, transparent 25%) -11px 0 / 22px 22px,
    linear-gradient(315deg, var(--weave-b) 25%, transparent 25%) 0 0 / 22px 22px,
    linear-gradient(45deg, var(--weave-b) 25%, transparent 25%) 0 0 / 22px 22px, var(--weave-c); }
.sadu-thin { height: 6px; background: repeating-linear-gradient(90deg, var(--weave-a) 0 10px, var(--weave-b) 10px 20px, var(--weave-c) 20px 24px); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .62rem 1.1rem; border-radius: 10px;
  font-weight: 600; background: var(--accent); color: var(--accent-ink); transition: filter .2s; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: .3rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn.danger { background: var(--danger); color: #fff; }
.field { width: 100%; padding: .7rem .85rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.field:focus { outline: 2px solid var(--accent); border-color: transparent; }
label.lbl { display: grid; gap: .3rem; font-size: .9rem; }

/* App shell */
.app { height: 100%; display: grid; grid-template-columns: 290px minmax(0, 1fr); }
.rail { background: var(--bg-2); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.rail-top { padding: 16px 16px 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.logo { display: flex; align-items: center; gap: .5rem; font-family: var(--f-display); font-weight: 700; font-size: 1.2rem; }
.brand { display: inline-flex; align-items: baseline; gap: .45rem; white-space: nowrap; }
.brand .sep { color: var(--accent); font-weight: 400; }
.brand .lat { letter-spacing: .01em; }
.tools { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px; }
.tools a { padding: .25rem .65rem; border-radius: 8px; font-size: .9rem; color: var(--ink); text-decoration: none; }
.tools a:hover { background: var(--bg); }
.tools a[aria-current="page"] { background: var(--bg); font-weight: 600; }
.hist-h { padding: 6px 18px 2px; font-size: .78rem; }
.hist { list-style: none; margin: 0; padding: 0 8px; overflow-y: auto; flex: 1; min-height: 0; }
.hist li { display: flex; align-items: center; border-radius: 8px; }
.hist li:hover, .hist li.on { background: var(--bg); }
.hist a { flex: 1; min-width: 0; padding: .45rem .6rem; color: var(--ink); text-decoration: none; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist .del { padding: 0 .55rem; opacity: .55; font-size: .95rem; }
.hist .del:hover { opacity: 1; color: var(--danger); }
.rail-foot { border-top: 1px solid var(--line); padding: 12px 16px; display: grid; gap: 8px; font-size: .88rem; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: none; }
.view { flex: 1; min-height: 0; overflow-y: auto; }
.wrap { max-width: 820px; margin: 0 auto; padding-block: 28px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wide { max-width: 1120px; }

/* Chat */
.hero { padding-top: 6vh; display: grid; gap: 18px; }
.hero h1 { font-family: var(--f-display); font-size: clamp(2.2rem, 6vw, 3.8rem); line-height: 1.15; }
.hero p { font-size: 1.1rem; max-width: 60ch; }
.sugg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.sugg button { text-align: start; padding: .8rem .95rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.sugg button:hover { border-color: var(--accent); }
.experts { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.experts button { width: 100%; text-align: start; display: flex; gap: 12px; align-items: baseline; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.experts .ic { width: 1.6rem; color: var(--accent); font-size: 1.2rem; flex: none; }
.experts b { display: block; font-weight: 600; }
.experts small { color: var(--ink-2); font-size: .85rem; }
.experts button:hover b { text-decoration: underline; }

.msg { margin-bottom: 22px; min-width: 0; }
.msg.u { display: flex; justify-content: flex-end; }
.msg.u .bub { max-width: 85%; white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: .6rem 1rem; overflow-wrap: anywhere; }
.msg.a .acts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: .8rem; color: var(--ink-2); }
.msg.a .acts button:hover { color: var(--accent); text-decoration: underline; }
.thinking::after { content: "▍"; animation: caret 1s steps(1) infinite; color: var(--accent); }
@keyframes caret { 50% { opacity: 0; } }

.md { overflow-wrap: anywhere; }
.md > *:first-child { margin-top: 0; }
.md h1, .md h2, .md h3 { font-weight: 700; margin: 1.1em 0 .4em; }
.md h1 { font-size: 1.35rem; } .md h2 { font-size: 1.2rem; } .md h3 { font-size: 1.05rem; }
.md p { margin: .55em 0; }
.md ul, .md ol { padding-inline-start: 1.4em; margin: .5em 0; }
.md .tbl { overflow-x: auto; margin: .8em 0; }
.md table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.md th, .md td { border: 1px solid var(--line); padding: .35em .7em; text-align: start; white-space: nowrap; }
.md th { background: var(--bg-2); }
.md code { font-family: var(--f-mono); font-size: .86em; background: var(--bg-2); padding: .1em .35em; border-radius: 5px; }
.md a, a { color: var(--accent); }
.md blockquote { margin: .6em 0; padding-inline-start: 1em; border-inline-start: 3px solid var(--accent); color: var(--ink-2); }
.code { margin: .8em 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.code-bar { display: flex; justify-content: space-between; gap: 8px; padding: .3rem .75rem; background: var(--bg-2); font-size: .78rem; }
.code-bar span { display: flex; gap: 14px; }
.code-bar button:hover { color: var(--accent); }
.code pre { margin: 0; direction: ltr; text-align: left; background: var(--code-bg); color: var(--code-ink); padding: .9rem 1rem; overflow-x: auto; }
.code pre code { background: none; padding: 0; color: inherit; font-size: .84rem; }
.code iframe { width: 100%; height: 480px; border: 0; background: #fff; display: block; }

.composer { border-top: 1px solid var(--line); background: var(--bg); }
.composer .wrap { padding-block: 10px 14px; }
.cbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; font-size: .85rem; }
.cbar select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .2rem .4rem; }
.cbar .mk { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cbar .mk button { padding: .15rem .55rem; border: 1px solid var(--line); border-radius: 7px; }
.cbar .mk button:hover:not(:disabled) { border-color: var(--accent); }
.cbar .mk button:disabled { opacity: .4; }
.crow { display: flex; gap: 8px; align-items: flex-end; }
.crow textarea { resize: none; max-height: 40vh; }
.attach-btn { flex: none; width: 46px; height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 1.2rem; display: grid; place-items: center; }
.attach-btn:hover { border-color: var(--accent); }
.att-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.att-row:empty { display: none; }
.att { display: inline-flex; align-items: center; gap: 6px; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--accent); font-size: .82rem; background: var(--surface); max-width: 100%; }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.att button { opacity: .7; }
.att.busy { border-style: dashed; opacity: .8; }
.msg.u .att { margin-top: 6px; }
.notice { padding: .7rem .9rem; border-radius: 10px; border: 1px solid var(--accent); margin-bottom: 16px; font-size: .92rem; }
.filecard { display: inline-flex; align-items: center; gap: 12px; padding: .6rem .9rem; border: 1px solid var(--accent); border-radius: 12px; margin-bottom: 18px; }
.filecard b { color: var(--accent); }

/* Pages */
.page-h { font-family: var(--f-display); font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 6px; }
.sec { padding-block: 22px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.sec:last-child { border-bottom: 0; }
.sec h2 { font-family: var(--f-display); font-size: 1.45rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); font-size: .9rem; }
.chip[aria-pressed="true"] { border-color: var(--accent); font-weight: 600; background: var(--surface); }
.tr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.tr-grid textarea { min-height: 22rem; }
.tr-out { min-height: 22rem; max-height: 60vh; overflow-y: auto; white-space: pre-wrap; }
.check { display: flex; gap: .55rem; align-items: flex-start; font-size: .9rem; }
.check input { margin-top: .45rem; }

/* Plans */
.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.plan { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.plan { background: var(--bg); }
.plan.gold h3, .plan.gold .price { color: #B8892A; }
@media (max-width: 1180px) { .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.plan.feat { background: var(--bg-2); }
.plan.feat::before { content: ""; display: block; height: 6px; margin: -24px -24px 6px; background: repeating-linear-gradient(90deg, var(--weave-a) 0 10px, var(--weave-b) 10px 20px, var(--weave-c) 20px 24px); }
.plan h3 { font-family: var(--f-display); font-size: 1.5rem; }
.price { font-size: 2.3rem; font-weight: 700; line-height: 1.1; }
.price small { font-size: .85rem; font-weight: 400; color: var(--ink-2); margin-inline-start: .4rem; }
.plan ul { margin: 0; padding-inline-start: 1.1em; font-size: .92rem; }
.plan .btn { margin-top: auto; }
.seg { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 12px; }
.seg button { padding: .35rem 1rem; border-radius: 9px; font-size: .9rem; }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }

.leads { width: 100%; border-collapse: collapse; font-size: .88rem; }
.leads th, .leads td { border-bottom: 1px solid var(--line); padding: .45rem .5rem; text-align: start; vertical-align: top; }
.scroll-x { overflow-x: auto; }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: .7rem .9rem; border: 1px solid var(--danger); border-radius: 10px; }

/* PDF render stage (off-screen) */
#pdfStage { position: fixed; top: 0; left: -10000px; width: 794px; background: #fff; color: #1b1d22; font-family: var(--f-doc); font-size: 15px; line-height: 1.85; padding: 56px 60px; }
#pdfStage h1 { font-size: 26px; color: #12151A; margin: 0 0 4px; }
#pdfStage .sub { color: #666; margin-bottom: 18px; }
#pdfStage .hd { border-bottom: 3px solid #C8A33C; padding-bottom: 10px; margin-bottom: 18px; }
#pdfStage h2 { font-size: 19px; color: #0B6E4F; border-inline-start: 4px solid #C8A33C; padding-inline-start: 10px; margin: 22px 0 8px; }
#pdfStage table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0; }
#pdfStage th { background: #12151A; color: #fff; padding: 6px 8px; }
#pdfStage td { border: 1px solid #ddd; padding: 6px 8px; }
#pdfStage tr:nth-child(even) td { background: #F6F1E7; }
#pdfStage .foot { margin-top: 30px; font-size: 11px; color: #888; text-align: center; }

body.auth .app { grid-template-columns: minmax(0, 1fr); }
body.auth .rail, body.auth .topbar, body.auth #composer { display: none !important; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0; z-index: 40; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .rail[data-open="false"] { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); }
  .sugg, .experts, .grid2, .tr-grid { grid-template-columns: minmax(0, 1fr); }
  .plans { grid-template-columns: minmax(0, 1fr); }
  .cbar .mk { margin-inline-start: 0; }
}
@media (prefers-reduced-motion: reduce) { html { transition: none; } .thinking::after { animation: none; } }

/* ---------- Shell details ---------- */
.tagline { margin: -6px 16px 8px; font-size: .8rem; }
.rail-new { padding: 4px 12px; }
.rail-new .btn { width: 100%; }
.rail-weave { margin: 8px 14px 10px; opacity: .75; }
.rail-foot select { padding: .35rem .5rem; }
.owner-line { margin: 0; font-size: .78rem; }
.topbar-logo { font-size: 1.1rem; }

/* ---------- Consent gate & modal ---------- */
.gate { position: fixed; inset: 0; z-index: 100; background: color-mix(in srgb, var(--bg) 82%, #000 18%); display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); overflow-y: auto; }
.gate-card { width: min(640px, 100%); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px -40px rgba(0,0,0,.6); }
.gate-card .sadu { height: 14px; border-block-width: 2px; background-size: 14px 14px; }
.gate-body { padding: 22px 24px 24px; display: grid; gap: 14px; }
.gate-body h2 { font-family: var(--f-display); font-size: 1.45rem; }
.gate-body ul { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 6px; font-size: .95rem; }
.gate-links { display: flex; flex-wrap: wrap; gap: 6px; }
.gate-links button { font-size: .85rem; padding: .25rem .65rem; border: 1px solid var(--line); border-radius: 999px; }
.gate-links button:hover { border-color: var(--accent); }
.gate-reader { max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: var(--bg); }
.gate-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }

/* ---------- Banners ---------- */
.banner { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; padding: .7rem .9rem; border-radius: 12px; border: 1px solid var(--accent); background: var(--surface); margin-bottom: 16px; font-size: .92rem; }
.banner.ok { border-color: #2F8F83; }
.linkish { text-decoration: underline; color: var(--accent); }

/* ---------- Policies ---------- */
.legal-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 18px; }
.legal-doc { max-width: 72ch; }
.legal-doc h1 { font-family: var(--f-display); font-size: 1.6rem; margin-bottom: .4em; }
.legal-doc h2 { font-family: var(--f-display); font-size: 1.2rem; margin-top: 1.4em; }
.legal-doc p, .legal-doc li { line-height: 1.95; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat small { color: var(--ink-2); }
