@font-face { font-family: 'Readex Pro'; font-style: normal; font-weight: 300; font-display: swap; src: url('./fonts/readex-pro-latin-300-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Readex Pro'; font-style: normal; font-weight: 300; font-display: swap; src: url('./fonts/readex-pro-arabic-300-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-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: 'Readex Pro'; font-style: normal; font-weight: 400; font-display: swap; src: url('./fonts/readex-pro-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+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Readex Pro'; font-style: normal; font-weight: 400; font-display: swap; src: url('./fonts/readex-pro-arabic-400-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-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: 'Readex Pro'; font-style: normal; font-weight: 500; font-display: swap; src: url('./fonts/readex-pro-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+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Readex Pro'; font-style: normal; font-weight: 500; font-display: swap; src: url('./fonts/readex-pro-arabic-500-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-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: 'Readex Pro'; font-style: normal; font-weight: 600; font-display: swap; src: url('./fonts/readex-pro-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+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Readex Pro'; font-style: normal; font-weight: 600; font-display: swap; src: url('./fonts/readex-pro-arabic-600-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-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: 'Readex Pro'; font-style: normal; font-weight: 700; font-display: swap; src: url('./fonts/readex-pro-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+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Readex Pro'; font-style: normal; font-weight: 700; font-display: swap; src: url('./fonts/readex-pro-arabic-700-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-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: 'Aref Ruqaa'; font-style: normal; font-weight: 700; font-display: swap; src: url('./fonts/aref-ruqaa-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+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Aref Ruqaa'; font-style: normal; font-weight: 700; font-display: swap; src: url('./fonts/aref-ruqaa-arabic-700-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-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: 'Caveat'; font-style: normal; font-weight: 700; font-display: swap; src: url('./fonts/caveat-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+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Dancing Script'; font-style: normal; font-weight: 700; font-display: swap; src: url('./fonts/dancing-script-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+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Great Vibes'; font-style: normal; font-weight: 400; font-display: swap; src: url('./fonts/great-vibes-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+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* Zaheb. One bold idea: the document's journey is a line of stations, and saffron always means "your turn". */
:root {
  color-scheme: light;
  --ground: #F2F3F6;
  --surface: #FFFFFF;
  --ink: #0E1B4D;        /* signature-ink blue, used for text and solid buttons */
  --ink-soft: #4B557A;
  --line: #D8DBE6;
  --sun: #FFC629;        /* your turn */
  --sun-soft: #FFF3CC;
  --ready: #0E8F60;      /* done */
  --ready-soft: #DDF3EA;
  --stop: #C62F23;       /* returned, overdue */
  --stop-soft: #FBE4E1;
  --font: "Readex Pro", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; font-weight: 400; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 6vw, 40px); font-weight: 600; line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.soft { color: var(--ink-soft); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 4px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.loading { padding: 48px 24px; color: var(--ink-soft); }

/* frame */
.ribbon { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 16px; background: var(--ink); color: #fff; font-size: 13px; }
.ribbon label { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.langbtn { min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1.5px solid rgba(255, 255, 255, 0.55); background: none; color: #fff; font-weight: 600; }
.ribbon select { min-height: 36px; padding: 0 10px; border: none; border-radius: 10px; background: #fff; color: var(--ink); max-width: 62vw; }
.frame { display: flex; min-height: calc(100vh - 52px); }
.rail { display: none; }
main { flex: 1 1 auto; min-width: 0; width: 100%; max-width: 780px; margin: 0 auto; padding: 22px 16px 120px; display: flex; flex-direction: column; gap: 18px; }
main.wide { max-width: 1180px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 22px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; background: none; border: none; padding: 0; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-around; gap: 4px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.tab { flex: 1 1 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: none; background: none; border-radius: 14px; font-size: 12px; font-weight: 500; color: var(--ink-soft); position: relative; }
.tab.on { color: var(--ink); font-weight: 600; }
.tab.on::after { content: ""; position: absolute; top: 2px; width: 22px; height: 3px; border-radius: 2px; background: var(--ink); }
.tab-new { flex: 0 0 60px; height: 60px; border-radius: 50%; border: none; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; margin-top: -26px; box-shadow: 0 0 0 6px var(--ground); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--sun); color: var(--ink); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tab .badge { position: absolute; top: 4px; inset-inline-start: 54%; }

@media (min-width: 900px) {
  .tabs { display: none; }
  .rail { display: flex; flex-direction: column; gap: 6px; flex: 0 0 236px; padding: 26px 18px; border-inline-end: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; height: 100vh; }
  .rail .brand { margin: 0 8px 22px; }
  .rail-link { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border: none; border-radius: 14px; background: none; font-weight: 500; color: var(--ink-soft); text-align: start; }
  .rail-link.on { background: var(--ground); color: var(--ink); font-weight: 600; }
  .rail-link .badge { margin-inline-start: auto; }
  .rail .btn { margin-top: 14px; }
  main { padding: 34px 32px 64px; }
  .topline .brand { display: none; }
}

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn.solid { background: var(--ink); color: #fff; }
.btn.sun { background: var(--sun); border-color: var(--sun); color: var(--ink); }
.btn.quiet { border-color: var(--line); font-weight: 500; }
.btn.danger { border-color: var(--stop); color: var(--stop); }
.btn.big { min-height: 56px; font-size: 17px; padding: 0 26px; }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.iconbtn { width: 44px; height: 44px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
.iconbtn.plain { border-color: transparent; background: none; color: var(--ink-soft); }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: 14px; font-weight: 500; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

input[type=text], input[type=search], select, textarea { width: 100%; min-height: 50px; padding: 0 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); }
textarea { padding: 12px 16px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: none; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink-soft); }
label.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
label.check input { width: 20px; height: 20px; accent-color: var(--ink); }

/* surfaces: big radius for a whole document, small for parts inside it */
.hero { padding: 24px 22px; border-radius: 28px; background: var(--sun); display: flex; flex-direction: column; gap: 6px; }
.hero.calm { background: var(--surface); }
.doc { padding: 20px; border-radius: 24px; background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.doc.mine { box-shadow: inset 0 0 0 2px var(--sun); }
.doc-title { font-size: 18px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; text-align: start; background: none; border: none; padding: 0; color: var(--ink); overflow-wrap: anywhere; }
.panel { padding: 20px; border-radius: 24px; background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.part { padding: 12px 14px; border-radius: 14px; background: var(--ground); }
.note { padding: 12px 14px; border-radius: 14px; font-size: 14px; }
.note.error { background: var(--stop-soft); color: var(--stop); }
.note.ok { background: var(--ready-soft); color: #075C3D; }
.note.info { background: var(--ground); color: var(--ink-soft); }
.note.sun { background: var(--sun-soft); color: #5B4300; }
.empty { padding: 34px 20px; border-radius: 24px; border: 1.5px dashed var(--line); text-align: center; color: var(--ink-soft); }

.tag { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--ground); color: var(--ink); }
.tag.sun { background: var(--sun); }
.tag.ready { background: var(--ready-soft); color: #075C3D; }
.tag.stop { background: var(--stop-soft); color: var(--stop); }

/* the route: levels are stations on a line. Filled green = done, saffron = acting now, hollow = later, red = returned. */
.route { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 4px 2px; scrollbar-width: none; }
.route::-webkit-scrollbar { display: none; }
.leg { flex: 1 1 16px; min-width: 14px; height: 3px; background: var(--line); border-radius: 2px; }
.leg.done { background: var(--ready); }
.stop-group { display: flex; flex: 0 0 auto; }
.station { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--surface); color: var(--ink-soft); border: 2px solid var(--line); margin-inline-start: -8px; position: relative; }
.stop-group .station:first-child { margin-inline-start: 0; }
.station.done { background: var(--ready); border-color: var(--ready); color: #fff; }
.station.now { background: var(--sun); border-color: var(--ink); color: var(--ink); z-index: 1; }
.station.back { background: var(--stop); border-color: var(--stop); color: #fff; }
.station.end { width: 34px; border-style: dashed; margin-inline-start: 0; }
.station.end.done { border-style: solid; }
@media (prefers-reduced-motion: no-preference) {
  .station.now::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--sun); animation: ring 1.8s ease-out infinite; }
  @keyframes ring { from { opacity: 0.9; transform: scale(0.85); } to { opacity: 0; transform: scale(1.25); } }
  .sheet { animation: rise 0.22s ease-out; }
  @keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* people in the composer */
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px; border-radius: 16px; background: var(--ground); }
.chain { display: flex; flex-direction: column; gap: 0; }
.chain .who { position: relative; }
.link { align-self: center; position: relative; z-index: 1; margin: -4px 0; min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; border: 1.5px dashed var(--ink-soft); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; }
.link.on { background: var(--sun); border: 1.5px solid var(--ink); }
.link-hint { font-size: 12px; font-weight: 400; color: var(--ink-soft); }
.link.on .link-hint { color: var(--ink); }
.choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice button { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; min-height: 72px; text-align: start; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
.choice button span { font-size: 13px; color: var(--ink-soft); }
.choice button.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.choice button.on span { color: #D5D9EA; }
.avatar { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--ink); color: #fff; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); }
.seg button { min-height: 38px; padding: 0 12px; border: none; border-radius: 999px; background: none; font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.seg button.on { background: var(--ink); color: #fff; font-weight: 600; }
.suggest { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; border: 1.5px solid var(--line); background: var(--surface); }
.suggest button { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 14px; border: none; border-bottom: 1px solid var(--line); background: none; text-align: start; }
.suggest button:last-child { border-bottom: none; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px 20px; border-radius: 24px; border: 2px dashed var(--ink); background: var(--surface); text-align: center; }

/* viewer */
.viewer { display: flex; flex-direction: column; gap: 10px; }
.desk { padding: 14px; border-radius: 24px; background: #DADDE7; display: flex; justify-content: center; overflow-x: auto; }
.sheet-page { direction: ltr; position: relative; background: #fff; line-height: 0; box-shadow: 0 1px 0 rgba(14, 27, 77, 0.25); }
.sheet-page canvas { display: block; }
.overlay { position: absolute; inset: 0; }
.overlay.moving { cursor: crosshair; }
.fld { position: absolute; border: 2px solid; border-radius: 6px; padding: 0 4px; font: 600 11px/1.15 var(--font); overflow: hidden; display: flex; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.fld.mine { border-style: dashed; }

/* sheets and toast */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(14, 27, 77, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: var(--surface); display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 900px) { .scrim { align-items: center; } .sheet { border-radius: 28px; } }
.sigpad { width: 100%; aspect-ratio: 10 / 3; border-radius: 16px; border: 1.5px dashed var(--ink-soft); background: #fff; touch-action: none; display: block; }
.sigpad.draw { cursor: crosshair; }
.styles { display: flex; gap: 8px; }
.styles button { flex: 1 1 0; min-height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: #1F3C88; font-size: 24px; line-height: 1; }
.styles button.on { border-color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 32px); padding: 14px 20px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 500; font-size: 15px; text-align: center; }
.actbar { position: sticky; bottom: 84px; z-index: 10; display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-radius: 24px; background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); }
@media (min-width: 900px) { .actbar { bottom: 18px; } .toast { bottom: 112px; } }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: none; padding-top: 0; }
.list li > .grow { overflow-wrap: anywhere; }
.bubble { padding: 12px 14px; border-radius: 16px 16px 16px 4px; background: var(--ground); display: flex; flex-direction: column; gap: 4px; }
.bubble.answer { border-radius: 16px 16px 4px 16px; background: var(--ready-soft); margin-inline-start: 28px; }
.cols { display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 900px) { .cols { flex-direction: row; align-items: flex-start; } .cols > .col-a { flex: 1 1 440px; min-width: 0; } .cols > .col-b { flex: 1 1 520px; min-width: 0; position: sticky; top: 18px; } }

/* the workflow diagram: steps top to bottom, people as cards that can be dragged */
.flow { display: flex; flex-direction: column; align-items: stretch; user-select: none; -webkit-user-select: none; }
.flow-end { align-self: center; display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; }
.flow-gap { position: relative; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.flow-gap::before { content: ""; position: absolute; top: 0; bottom: 6px; width: 2px; background: var(--ink-soft); }
.flow-gap::after { content: ""; position: absolute; bottom: 1px; border: 6px solid transparent; border-top: 8px solid var(--ink-soft); border-bottom: none; }
.flow-gap-hint { display: none; position: relative; z-index: 1; padding: 4px 12px; border-radius: 999px; border: 1.5px dashed var(--ink-soft); background: var(--surface); font-size: 12px; font-weight: 500; }
.flow.dragging .flow-gap { height: 54px; }
.flow.dragging .flow-gap-hint { display: block; }
.flow-gap.over .flow-gap-hint { background: var(--sun); border: 1.5px solid var(--ink); font-weight: 600; }
.flow-step { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 20px; border: 1.5px solid var(--line); background: var(--ground); }
.flow-step.over { border-color: var(--ink); background: var(--sun-soft); }
.flow-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.flow-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.pcard { flex: 1 1 150px; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 12px; border-radius: 14px; border: 2px solid transparent; background: var(--surface); text-align: start; cursor: grab; touch-action: none; }
.pcard.on { border-color: var(--ink); }
.pcard.dragging { opacity: 0.35; }
.pcard.ghost { position: fixed; z-index: 80; pointer-events: none; transform: translate(-50%, -50%) rotate(-2deg); border-color: var(--ink); box-shadow: 6px 6px 0 rgba(14, 27, 77, 0.18); cursor: grabbing; }

.flow-gap.joinable { height: 64px; }
.gap-btn { position: relative; z-index: 1; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; }
.flow.dragging .gap-btn { display: none; }
.flow-label { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }

/* Arabic: right to left. Arrows point the other way, and joined letters keep their natural spacing. */
[dir="rtl"] svg.flip { transform: scaleX(-1); }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] .brand, [dir="rtl"] .doc-title { letter-spacing: 0; }
[dir="rtl"] .bubble { border-radius: 16px 16px 4px 16px; }
[dir="rtl"] .bubble.answer { border-radius: 16px 16px 16px 4px; }
[dir="rtl"] .sigpad, [dir="rtl"] .styles { direction: ltr; }

.station.deleg { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }

.sheet.tall { max-width: 680px; min-height: 62vh; }
.pre { margin: 0; padding: 14px; border-radius: 14px; background: var(--ground); font: 14px/1.6 var(--font); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Assistant: a conversation whose replies carry the same cards and buttons as the screens. */
.chat { display: flex; flex-direction: column; gap: 12px; }
.say { max-width: min(94%, 600px); padding: 14px 16px; border-radius: 22px; display: flex; flex-direction: column; gap: 10px; overflow-wrap: anywhere; }
.say.bot { align-self: flex-start; background: var(--surface); border-end-start-radius: 6px; }
.say.bot.ok { background: var(--ready-soft); }
.say.me { align-self: flex-end; background: var(--ink); color: #fff; border-end-end-radius: 6px; }
.say.me .tag { background: rgba(255, 255, 255, 0.16); color: #fff; white-space: normal; }
.say .tag { max-width: 100%; align-self: flex-start; }
.card { padding: 14px; border-radius: 16px; background: var(--ground); display: flex; flex-direction: column; gap: 10px; }
.quote { padding-inline-start: 12px; border-inline-start: 3px solid var(--sun); display: flex; flex-direction: column; gap: 2px; }
ul.plain { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
ul.points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
ul.points li { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); }
ol.steps { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 8px; }
ol.steps li { padding-inline-start: 4px; }
ol.steps li > span { display: flex; margin-bottom: 4px; }
.composer { position: sticky; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 5; display: flex; align-items: flex-end; gap: 8px; padding: 8px; border-radius: 30px; background: var(--surface); box-shadow: 0 8px 28px rgba(14, 27, 77, 0.16); }
.composer textarea { flex: 1 1 auto; min-height: 44px; max-height: 120px; padding: 10px 4px; border: none; background: none; resize: none; }
.composer textarea:focus { outline: none; }
.composer:focus-within { box-shadow: 0 0 0 2px var(--ink), 0 8px 28px rgba(14, 27, 77, 0.16); }
.iconbtn.solid { background: var(--ink); border-color: var(--ink); color: #fff; }
@media (min-width: 900px) { .composer { bottom: 20px; } }

/* Classification: quiet for everyday levels, solid ink and red only where handling really changes. */
.tag.cls.c0, .tag.cls.c1 { background: none; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink-soft); }
.tag.cls.c2 { background: var(--ink); color: #fff; }
.tag.cls.c3 { background: var(--stop); color: #fff; }

/* Server version: sign-in, account and administration. */
.ribbon .me-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate .panel { width: min(100%, 440px); }
.gate .brand { font-size: 26px; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.people li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.people li:first-child { border-top: none; }
.people li.off { opacity: 0.55; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.formgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
input[type=email], input[type=password] { width: 100%; min-height: 50px; padding: 0 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); font: inherit; color: inherit; }

/* ---------- Laptop: a working application, not an enlarged phone ---------- */
@media (min-width: 1000px) {
  body { font-size: 14px; }
  h1 { font-size: 24px; letter-spacing: -0.01em; }
  h2 { font-size: 16px; }
  .ribbon { padding: 6px 20px; min-height: 44px; }
  .langbtn { min-height: 30px; border-radius: 6px; border-width: 1px; font-size: 13px; }
  .rail { flex-basis: 210px; padding: 18px 12px; gap: 2px; height: calc(100vh - 44px); }
  .rail .brand { margin: 0 8px 16px; font-size: 20px; }
  .rail-link { min-height: 38px; border-radius: 8px; font-size: 14px; padding: 0 12px; }
  .rail .btn.block { margin-top: 12px; }
  main, main.wide { max-width: none; margin: 0; padding: 22px 28px 48px; gap: 16px; }
  .btn { min-height: 36px; padding: 0 16px; border-radius: 8px; border-width: 1px; font-size: 14px; }
  .btn.big { min-height: 40px; font-size: 14px; padding: 0 20px; }
  .btn.small { min-height: 30px; padding: 0 12px; font-size: 13px; }
  .iconbtn { border-radius: 8px; }
  .chip { min-height: 30px; border-radius: 8px; border-width: 1px; font-size: 13px; padding: 0 12px; }
  .tag { min-height: 22px; border-radius: 6px; font-size: 12px; padding: 0 8px; }
  .panel, .doc { padding: 16px 18px; border-radius: 10px; gap: 12px; border: 1px solid var(--line); }
  .doc.mine { box-shadow: inset 3px 0 0 var(--sun); }
  [dir=rtl] .doc.mine { box-shadow: inset -3px 0 0 var(--sun); }
  .doc { max-width: 900px; }
  .doc-title { font-size: 14px; }
  .hero, .hero.calm { padding: 0; border-radius: 0; background: none; }
  .hero h1 { font-size: 24px; }
  .hero p { color: var(--ink-soft); }
  input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], select, textarea { min-height: 36px; border-radius: 8px; border-width: 1px; font-size: 14px; }
  .station { width: 28px; height: 28px; font-size: 11px; }
  .station.end { width: 28px; }
  .actbar { order: -1; position: sticky; top: 0; bottom: auto; padding: 8px 10px; border-radius: 10px; box-shadow: 0 0 0 1px var(--line), 0 4px 14px rgba(14, 27, 77, 0.08); }
  .actbar .btn { flex: 0 0 auto; min-width: 150px; }
  .flow-step { border-radius: 10px; border-width: 1px; padding: 10px; }
  .pcard { border-radius: 8px; min-height: 50px; }
  .sheet { border-radius: 12px; }
  .say { border-radius: 12px; max-width: min(80%, 760px); }
  .card { border-radius: 8px; }
  .composer { border-radius: 12px; max-width: 900px; width: 100%; align-self: center; }
  .chat { max-width: 900px; width: 100%; align-self: center; }
  .gate .panel { border-radius: 12px; }
  .toast { border-radius: 8px; bottom: 28px; }

  .gridwrap { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
  table.grid { width: 100%; border-collapse: collapse; }
  table.grid th { text-align: start; font-size: 12px; font-weight: 600; color: var(--ink-soft); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--ground); white-space: nowrap; }
  table.grid td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  table.grid tbody tr:last-child td { border-bottom: none; }
  table.grid tbody tr:hover { background: #F7F8FB; }
  table.grid tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--sun); }
  [dir=rtl] table.grid tr.mine td:first-child { box-shadow: inset -3px 0 0 var(--sun); }
  table.grid td.acts { white-space: nowrap; text-align: end; }
  table.grid td.acts .btn { margin-inline-start: 6px; }
  table.grid .route { max-width: 240px; padding: 2px; }
  table.grid .doc-title { font-size: 14px; }
}
@media (min-width: 1000px) {
  table.grid td:first-child { min-width: 200px; }
  table.grid .num { white-space: nowrap; }
}
