/* =====================================================================
   The hosted studio's look, on top of studio.css (whose colour tokens,
   buttons, fields and the editor it keeps).

   One idea throughout: a quiet, warm workbench. The parchment and the green
   of the local studio stay; what is added is depth (soft layered shadows, a
   faint light from the top of the page), one icon language, colour that
   always means a state (calm = done/fine, info = new, warn = needs you,
   danger = late/broken), and generous, even rhythm - the people here spend
   hours on this page.

   This device's settings (js/hosted/prefs.js) arrive as attributes on
   <html>: data-theme (studio.css's), data-text (sm | lg), data-density
   (compact), data-motion (reduce).
   ===================================================================== */

/* ----- tokens ----- */

:root {
  --tone-calm: #0e6b57;
  --tone-info: #3456a8;
  --tone-warn: #855a14;
  --tone-danger: #a52f2f;
  --tone-muted: #535f54;
  --tone-accent: #0a4f40;
  --avatar-bg-l: 89%;
  --avatar-ink-l: 27%;
  --avatar-sat: 42%;
  --glass: color-mix(in srgb, var(--surface) 78%, transparent);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  --lift: 0 1px 2px rgb(23 35 29 / 0.05), 0 12px 32px rgb(23 35 29 / 0.11);
  --h-radius: 16px;
  --h-gap: 18px;
  --h-pad: 16px;
  --h-cell: 11px 14px;
  --art-from: #0f6e59;
  --art-to: #073a2f;
  --art-ink: #f6ecd4;
  --art-gold: #e3bf7c;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tone-calm: #4fd3a7;
    --tone-info: #8eabf3;
    --tone-warn: #e2b66d;
    --tone-danger: #f08c7d;
    --tone-muted: #a7b0a3;
    --tone-accent: #64e3ba;
    --avatar-bg-l: 24%;
    --avatar-ink-l: 82%;
    --avatar-sat: 30%;
    --lift: 0 1px 2px rgb(0 0 0 / 0.35), 0 14px 34px rgb(0 0 0 / 0.45);
    --art-from: #0d4a3c;
    --art-to: #04201a;
  }
}
:root[data-theme="dark"] {
  --tone-calm: #4fd3a7;
  --tone-info: #8eabf3;
  --tone-warn: #e2b66d;
  --tone-danger: #f08c7d;
  --tone-muted: #a7b0a3;
  --tone-accent: #64e3ba;
  --avatar-bg-l: 24%;
  --avatar-ink-l: 82%;
  --avatar-sat: 30%;
  --lift: 0 1px 2px rgb(0 0 0 / 0.35), 0 14px 34px rgb(0 0 0 / 0.45);
  --art-from: #0d4a3c;
  --art-to: #04201a;
}

/* text size: everything here is in rem, so the root carries it */
:root[data-text="sm"] { font-size: 93.75%; }
:root[data-text="lg"] { font-size: 112.5%; }
body { font-size: 0.9375rem; }

:root[data-density="compact"] {
  --h-gap: 11px;
  --h-pad: 11px;
  --h-cell: 7px 10px;
  --h-radius: 12px;
}

:root[data-motion="reduce"] *,
:root[data-motion="reduce"] *::before,
:root[data-motion="reduce"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ----- the shell ----- */

.hosted .hosted-main { grid-column: 1 / -1; }
.hosted a { text-decoration: none; }
.hosted p a, .hosted .hosted-terms a { text-decoration: underline; text-underline-offset: 3px; }
.hosted .vstack { display: flex; flex-direction: column; }
.hosted .hstack { display: flex; align-items: center; }
.hosted .grow { flex: 1; min-width: 0; }
/* an address or a key written left to right sits at the start of its column */
.hosted .vstack > [dir="ltr"] { align-self: flex-start; }
.hosted .wrap { flex-wrap: wrap; }
.hosted code { font-family: var(--mono); font-size: 0.85em; }

/* Affordances the hosted studio does not have. The server has no routes for
   them either; this only keeps the screen honest. */
.hosted .hosted-absent { display: none !important; }

.hosted .view {
  overflow: auto;
  padding: 26px clamp(16px, 3vw, 34px) 40px;
  background:
    radial-gradient(1100px 420px at 88% -12%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%),
    radial-gradient(700px 300px at 0% 0%, color-mix(in srgb, var(--gold) 7%, transparent), transparent 70%);
  scroll-behavior: smooth;
}
.hosted[data-screen="assignment"] .view, .hosted[data-screen="preview"] .view { padding: 0; background: none; }

/* a screen arrives: a short rise, its cards one after another */
@keyframes hosted-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hosted .view[data-screen]:not([data-screen="assignment"]):not([data-screen="preview"]) > * { animation: hosted-rise 0.32s var(--ease) both; }
.hosted .hosted-cards > *, .hosted .hosted-stat-row > * { animation: hosted-rise 0.36s var(--ease) both; }
.hosted .hosted-cards > :nth-child(2), .hosted .hosted-stat-row > :nth-child(2) { animation-delay: 40ms; }
.hosted .hosted-cards > :nth-child(3), .hosted .hosted-stat-row > :nth-child(3) { animation-delay: 80ms; }
.hosted .hosted-cards > :nth-child(4), .hosted .hosted-stat-row > :nth-child(4) { animation-delay: 120ms; }
.hosted .hosted-cards > :nth-child(n + 5), .hosted .hosted-stat-row > :nth-child(n + 5) { animation-delay: 160ms; }

.hosted-topbar.topbar {
  position: relative;
  z-index: 20;
  gap: 14px;
  min-height: 62px;
  padding: 10px clamp(12px, 2.4vw, 26px);
  background: var(--glass);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}
.hosted-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); flex: none; }
.hosted-brand .brand-mark { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); transition: transform 0.2s var(--ease); }
.hosted-brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); }
.hosted-brand-name { font-weight: 800; font-size: 0.98rem; white-space: nowrap; }
/* the screens have their own headings; the bar's title is for the editor */
.hosted:not([data-screen="assignment"]):not([data-screen="preview"]) .hosted-titles { display: none; }
.hosted-titles { display: flex; align-items: baseline; gap: 10px; min-width: 0; padding-inline-start: 14px; border-inline-start: 1px solid var(--border); }
.hosted-titles h1 { font-size: 0.98rem; font-weight: 700; color: var(--text); }
.hosted-titles h1:empty, .hosted-titles .topbar-sub:empty { display: none; }
.hosted-titles .topbar-sub { overflow: hidden; text-overflow: ellipsis; }
.hosted-slot:empty { flex: 1; }

.hosted-account { gap: 6px; margin-inline-start: auto; flex: none; }
.hosted-nav { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: color-mix(in srgb, var(--surface-2) 75%, transparent); border: 1px solid var(--border); margin-inline-end: 6px; }
.hosted-nav-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  color: var(--text-muted); font-weight: 650; font-size: 0.86rem; white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.hosted-nav-link .ic { width: 17px; height: 17px; }
.hosted-nav-link:hover { color: var(--text); background: var(--surface); }
.hosted-nav-link[aria-current="page"] { background: var(--surface); color: var(--tone-accent); box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 3px 10px rgb(0 0 0 / 0.06); }

.hosted-me {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 4px 12px 4px 4px; padding-inline: 4px 12px;
  border-radius: 999px; color: var(--text); border: 1px solid transparent;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.hosted-me:hover, .hosted-me[aria-current="page"] { background: var(--surface); border-color: var(--border); }
.hosted-me-text { display: flex; flex-direction: column; line-height: 1.2; }
.hosted-me-text b { font-size: 0.84rem; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hosted-me-text small { font-size: 0.7rem; color: var(--text-muted); }
.hosted-settings[aria-current="page"] { background: var(--accent-soft); color: var(--tone-accent); }
.hosted-theme { flex: none; }

/* acting in a lower role: the switch in the bar, and the band under it */
.hosted-role-switch {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 4px 3px 10px; padding-inline: 10px 4px;
  border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted);
  background: color-mix(in srgb, var(--surface-2) 75%, transparent);
}
.hosted-role-switch .ic { width: 16px; height: 16px; flex: none; }
.hosted-role-switch select { border: none; background: none; color: var(--text); font: inherit; font-size: 0.8rem; font-weight: 650; padding: 3px 2px; cursor: pointer; max-width: 16ch; }
.hosted-role-switch select:focus-visible { outline: none; }
.hosted-role-switch:focus-within { box-shadow: var(--ring); }
.is-acting .hosted-role-switch { border-color: var(--tone-warn); color: var(--tone-warn); background: color-mix(in srgb, var(--tone-warn) 10%, var(--surface)); }
.hosted-acting {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px clamp(12px, 2.4vw, 26px);
  background: color-mix(in srgb, var(--tone-warn) 13%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--tone-warn) 40%, var(--border));
  color: var(--text); font-size: 0.86rem;
}
.hosted-acting[hidden] { display: none; }
.hosted-offline {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px clamp(12px, 2.4vw, 26px);
  background: color-mix(in srgb, var(--tone-danger) 13%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--tone-danger) 40%, var(--border));
  color: var(--text); font-size: 0.86rem;
}
.hosted-offline[hidden] { display: none; }
.hosted-offline > .ic { color: var(--tone-danger); flex: none; }
.hosted-ended {
  margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius, 8px); line-height: 1.9;
  background: color-mix(in srgb, var(--tone-warn) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tone-warn) 40%, var(--border));
}
.hosted-acting > .ic { color: var(--tone-warn); flex: none; }
.hosted-acting p { flex: 1; min-width: 16ch; margin: 0; }
.hosted.is-auth .hosted-acting { display: none; }
.hosted-theme .ic { transition: transform 0.4s var(--ease); }
.hosted-theme:hover .ic { transform: rotate(-24deg); }

/* ----- people ----- */

.hosted-avatar {
  --hue: 160;
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: hsl(var(--hue) var(--avatar-sat) var(--avatar-bg-l));
  color: hsl(var(--hue) 45% var(--avatar-ink-l));
  font-weight: 800; font-size: 0.82rem; letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px hsl(var(--hue) 30% 50% / 0.18);
  user-select: none;
}
.hosted-avatar.is-xs { width: 22px; height: 22px; font-size: 0.6rem; }
.hosted-avatar.is-sm { width: 30px; height: 30px; font-size: 0.72rem; }
.hosted-avatar.is-lg { width: 68px; height: 68px; font-size: 1.35rem; }
.hosted-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hosted-person .vstack { min-width: 0; gap: 1px; }
.hosted-person .muted { font-size: 0.8rem; }
.hosted-person code { font-size: 0.72rem; color: var(--text-muted); }

/* ----- pills, counts, due dates ----- */

.hosted-pill, .hosted-due {
  --tone: var(--tone-muted);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px 2px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; white-space: nowrap; line-height: 1.6;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 22%, transparent);
  vertical-align: middle;
}
.hosted-pill .ic, .hosted-due .ic { width: 14px; height: 14px; }
.hosted-pill-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
[data-tone="calm"] { --tone: var(--tone-calm); }
[data-tone="info"] { --tone: var(--tone-info); }
[data-tone="warn"] { --tone: var(--tone-warn); }
[data-tone="danger"] { --tone: var(--tone-danger); }
[data-tone="accent"] { --tone: var(--tone-accent); }
.hosted-pill[data-tone="accent"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.hosted-pill[data-tone="accent"] .hosted-pill-dot { display: none; }
.hosted-due .hosted-pill-dot { display: none; }
.hosted-due[data-tone="danger"] { animation: hosted-pulse 2.4s ease-in-out infinite; }
@keyframes hosted-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 14%, transparent); } }

.hosted-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px;
  border-radius: 999px; font-size: 0.72rem; font-weight: 800; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--text-muted) 13%, transparent); color: var(--text-muted);
}
.hosted-breath-ref {
  display: inline-block; margin-inline-end: 6px; padding: 0 7px; border-radius: 6px;
  font-size: 0.75rem; font-weight: 700; color: var(--tone-info);
  background: color-mix(in srgb, var(--tone-info) 12%, transparent);
}
.hosted-late { color: var(--tone-danger); }
/* there for copying and screen readers, not for the eye */
/* inline, not absolute: an absolute box is a block, and copied text would break around it */
.hosted-sep { font-size: 0; }

/* ----- page structure ----- */

.hosted-page { width: 100%; max-width: 1200px; margin-inline: auto; gap: calc(var(--h-gap) + 6px); }
.hosted-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hosted-page-titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hosted-eyebrow { font-size: 0.8rem; font-weight: 700; color: var(--tone-accent); }
.hosted-page-title { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); font-weight: 800; letter-spacing: -0.01em; line-height: 1.35; }
.hosted-page-sub { color: var(--text-muted); font-size: 0.92rem; max-width: 70ch; }
.hosted-page-actions { gap: 8px; flex-wrap: wrap; }
.hosted .hosted-page-actions .btn { padding: 10px 16px; }

.hosted-hero {
  position: relative; overflow: hidden;
  padding: clamp(18px, 3vw, 28px);
  border-radius: calc(var(--h-radius) + 4px);
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent-soft) 85%, var(--surface)) 0%, var(--surface) 62%);
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border));
  box-shadow: var(--shadow);
}
.hosted-hero::after {
  content: ""; position: absolute; inset-block: 0; inset-inline-end: 0; width: min(46%, 420px);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%230e6b57' stroke-width='1'%3E%3Cpath d='M28 6l6 16 16 6-16 6-6 16-6-16-16-6 16-6z'/%3E%3Ccircle cx='28' cy='28' r='6'/%3E%3C/g%3E%3C/svg%3E") repeat;
  opacity: 0.09;
  mask-image: linear-gradient(to left, #000 10%, transparent);
  -webkit-mask-image: linear-gradient(to left, #000 10%, transparent);
  pointer-events: none;
}
.hosted-hero > * { position: relative; z-index: 1; }

.hosted-section { display: flex; flex-direction: column; gap: 12px; }
.hosted-section-head { display: flex; align-items: center; gap: 10px; }
.hosted-section-head h3 { font-size: 1.02rem; font-weight: 800; margin: 0; }
.hosted-section-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--tone-accent); flex: none; }
.hosted-section-icon .ic { width: 17px; height: 17px; }
.hosted-section.is-returned .hosted-section-icon { background: var(--gold-soft); color: var(--tone-warn); }
.hosted-section.hosted-panel {
  padding: calc(var(--h-pad) + 4px); border-radius: var(--h-radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}

/* panels and cards: one radius, softer heads */
.hosted .panel { border-radius: var(--h-radius); border-color: color-mix(in srgb, var(--border) 85%, transparent); }
.hosted .panel-head { background: transparent; padding: 14px var(--h-pad) 10px; border-bottom: none; gap: 9px; }
.hosted .panel-head > .ic { width: 18px; height: 18px; color: var(--tone-accent); }
.hosted .panel-title { font-size: 0.98rem; }
.hosted .panel-body { padding: 4px var(--h-pad) var(--h-pad); overflow: visible; scrollbar-gutter: auto; }

.hosted-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 12px;
  background: var(--gold-soft); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  transition: transform 0.16s var(--ease), box-shadow 0.16s ease;
}
.hosted-banner > span { flex: 1; }
.hosted-banner .ic { color: var(--tone-warn); }
a.hosted-banner:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.hosted-banner.is-quiet { background: var(--surface-2); border-color: var(--border); color: var(--text-muted); }
.hosted-banner.is-quiet .ic { color: var(--text-muted); }

/* ----- stats ----- */

.hosted .hosted-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; flex: 1; }
.hosted .hosted-stat {
  --tone: var(--tone-accent);
  position: relative;
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "value icon" "label label" "hint hint";
  align-items: start; gap: 2px 8px;
  padding: 14px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.03);
  transition: transform 0.18s var(--ease), box-shadow 0.18s ease, border-color 0.18s ease;
}
.hosted .hosted-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.hosted .hosted-stat-icon { grid-area: icon; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--tone); background: color-mix(in srgb, var(--tone) 11%, transparent); }
.hosted .hosted-stat-icon .ic { width: 17px; height: 17px; }
.hosted .hosted-stat-value { grid-area: value; font-size: 1.6rem; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
/* a word, not a number («به‌روز (۷)», «development»): smaller, whole */
.hosted .hosted-stat-value.is-text { font-size: 1.12rem; padding-top: 4px; overflow-wrap: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hosted .hosted-stat-label { grid-area: label; font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.hosted .hosted-stat .hosted-hint { grid-area: hint; }
.hosted .hosted-stat[data-tone="danger"], .hosted .hosted-stat[data-tone="warn"] { border-color: color-mix(in srgb, var(--tone) 30%, var(--border)); }
.hosted .hosted-stat[data-tone="danger"] .hosted-stat-value { color: var(--tone); }

.hosted-stats .panel-body.hosted-stats-body { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-top: 6px; }
.hosted-feedback { border-top: 1px solid var(--border); padding: 12px var(--h-pad); }
.hosted-feedback summary, .hosted-history summary, .hosted-more summary, .hosted-secret-box summary {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 700; font-size: 0.88rem; color: var(--text-muted); list-style: none;
}
.hosted-feedback summary::-webkit-details-marker, .hosted-history summary::-webkit-details-marker, .hosted-more summary::-webkit-details-marker, .hosted-secret-box summary::-webkit-details-marker { display: none; }
.hosted-feedback summary::after, .hosted-history summary::after, .hosted-more summary::after, .hosted-secret-box summary::after {
  content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); transition: transform 0.2s var(--ease); margin-inline-start: 4px;
}
details[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.hosted-feedback summary:hover, .hosted-history summary:hover, .hosted-more summary:hover, .hosted-secret-box summary:hover { color: var(--text); }
.hosted-feedback ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hosted-feedback li { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.hosted-feedback li .hstack { gap: 8px; flex-wrap: wrap; }
.hosted-feedback li p { margin-top: 4px; font-size: 0.88rem; }

.hosted-ring { position: relative; display: grid; justify-items: center; gap: 4px; width: 112px; flex: none; }
.hosted-ring-art { display: block; width: 92px; height: 92px; }
.hosted-ring-art svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hosted-ring-track { fill: none; stroke: var(--surface-3); stroke-width: 7; }
.hosted-ring-fill { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 0.9s var(--ease); }
.hosted-ring[data-value=""] .hosted-ring-fill { stroke: transparent; }
.hosted-ring-value { position: absolute; top: 46px; transform: translateY(-50%); font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.hosted-ring-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }

.hosted-progress { position: relative; height: 7px; min-width: 80px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.hosted-progress-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--gold))); transition: width 0.6s var(--ease); }
.hosted-progress-cell { gap: 6px; min-width: 110px; }

/* ----- the home screen ----- */

.hosted-inbox { padding: 0; }
.hosted-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.hosted-task {
  --tone: var(--tone-info);
  position: relative; display: flex; flex-direction: column;
  transition: transform 0.2s var(--ease), box-shadow 0.2s ease, border-color 0.2s ease;
}
.hosted-task::before { content: ""; position: absolute; inset-block: 14px; inset-inline-start: 0; width: 3px; border-radius: 0 3px 3px 0; background: var(--tone); }
.hosted-task[data-status="in_progress"] { --tone: var(--tone-calm); }
.hosted-task[data-status="returned"] { --tone: var(--tone-warn); border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); }
.hosted-task[data-status="submitted"], .hosted-task[data-status="rejected"] { --tone: var(--tone-muted); }
.hosted-task[data-status="approved"] { --tone: var(--tone-calm); }
.hosted-task:hover { transform: translateY(-3px); box-shadow: var(--lift); }
.hosted-task-head { display: flex; align-items: flex-start; gap: 11px; padding: 16px var(--h-pad) 8px; }
.hosted-task-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; color: var(--tone); background: color-mix(in srgb, var(--tone) 11%, transparent); }
.hosted-task-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hosted-task-titles .panel-title { font-size: 0.97rem; line-height: 1.5; }
.hosted-task-project { font-size: 0.8rem; color: var(--text-muted); }
.hosted-task .panel-body { flex: 1; gap: 10px; }
.hosted-task-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.82rem; color: var(--text-muted); }
.hosted-task-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.hosted-task-meta > span .ic { width: 15px; height: 15px; }
.hosted-task-foot { display: flex; justify-content: flex-end; padding: 0 var(--h-pad) var(--h-pad); }
.hosted-task-foot .btn-primary { padding-inline: 18px; }
.hosted-task-foot .btn .ic { transition: transform 0.2s var(--ease); }
.hosted-task:hover .hosted-task-foot .btn .ic { transform: translateX(-3px); }
.hosted-comments p { margin: 2px 0; }
.hosted-history { padding: 4px 0; }
.hosted-history[open] summary { margin-bottom: 12px; }
.hosted-history .hosted-task { opacity: 0.88; }

/* ----- empty, loading, busy ----- */

.hosted-empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: clamp(26px, 5vw, 46px) 20px; border-radius: var(--h-radius);
  border: 1.5px dashed var(--border-strong); background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.hosted-empty-state b { font-size: 1.05rem; }
.hosted-empty-state p { color: var(--text-muted); max-width: 46ch; }
.hosted-empty-state > .btn, .hosted-empty-state > a { margin-top: 8px; }
.hosted-empty-art {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; margin-bottom: 4px;
  color: var(--tone-accent); background: radial-gradient(circle at 30% 30%, var(--surface), var(--accent-soft));
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent-soft) 45%, transparent);
}
.hosted-empty-art .ic { width: 28px; height: 28px; }
.hosted-notfound { max-width: 560px; margin: 8vh auto 0; }
p.hosted-empty { display: flex; align-items: center; gap: 9px; padding: 14px 16px; border-radius: 12px; border: 1px dashed var(--border-strong); color: var(--text-muted); }
p.hosted-empty .ic { width: 18px; height: 18px; }

.hosted-skeleton { max-width: 1200px; margin-inline: auto; display: flex; flex-direction: column; gap: 16px; }
.hosted-sk { display: block; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 300% 100%; animation: hosted-shimmer 1.3s ease-in-out infinite; }
.hosted-sk.is-line { height: 14px; width: 40%; }
.hosted-sk.is-short { width: 22%; }
.hosted-sk.is-title { height: 26px; width: 48%; }
.hosted-sk.is-tile { height: 92px; }
.hosted-sk.is-card { height: 170px; }
.hosted-sk-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
@keyframes hosted-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.hosted-spinner { display: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: hosted-spin 0.7s linear infinite; }
.btn[aria-busy="true"] .hosted-spinner { display: inline-block; }
@keyframes hosted-spin { to { transform: rotate(360deg); } }

/* ----- tables: cards on a phone ----- */

.hosted .hosted-table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--border); border-radius: var(--h-radius); background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / 0.03); }
.hosted .hosted-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.9rem; }
.hosted .hosted-table th {
  position: sticky; top: 0; z-index: 1;
  padding: var(--h-cell); text-align: start; white-space: nowrap;
  font-size: 0.76rem; font-weight: 800; color: var(--text-muted);
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); border-bottom: 1px solid var(--border);
}
.hosted .hosted-table td { padding: var(--h-cell); border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); text-align: start; vertical-align: middle; }
.hosted .hosted-table tbody tr:last-child td { border-bottom: none; }
.hosted .hosted-table tbody tr { transition: background 0.12s ease; }
.hosted .hosted-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.hosted .hosted-table tr.is-on { background: var(--accent-soft); }
.hosted .hosted-table .is-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hosted .hosted-table td .hstack { gap: 6px; }
.hosted .hosted-table td:last-child { white-space: nowrap; }

/* ----- tabs ----- */

.hosted .hosted-tabs {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border); margin-bottom: 2px;
}
.hosted .hosted-tabs::-webkit-scrollbar { display: none; }
.hosted-tab {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 14px 12px; color: var(--text-muted); font-weight: 650; font-size: 0.9rem; white-space: nowrap;
  border-radius: 10px 10px 0 0; transition: color 0.15s ease, background 0.15s ease;
}
.hosted-tab .ic { width: 17px; height: 17px; }
.hosted-tab:hover { color: var(--text); background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.hosted-tab::after { content: ""; position: absolute; inset-inline: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); transform: scaleX(0); transition: transform 0.22s var(--ease); }
.hosted-tab.is-on { color: var(--tone-accent); }
.hosted-tab.is-on::after { transform: scaleX(1); }

/* ----- the admin's panel ----- */

.hosted-admin-body { gap: calc(var(--h-gap) + 4px); }
.hosted-inline-field { gap: 8px; font-size: 0.88rem; color: var(--text-muted); font-weight: 600; }
.hosted-inline-field .field { width: auto; min-width: 0; }
.hosted-project-pick { align-self: flex-start; padding: 6px 6px 6px 12px; padding-inline: 12px 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.hosted-project-pick .field { border: none; min-height: 34px; background: var(--surface-2); font-weight: 700; color: var(--text); }
.hosted-filter .field { width: min(320px, 60vw); }
.hosted-settings-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.hosted-settings-row .field-sm { min-height: 32px; }

.hosted .hosted-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; align-items: start; }
.hosted .hosted-column {
  --tone: var(--tone-muted);
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px; border-radius: var(--h-radius);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent); border: 1px solid var(--border);
  min-height: 120px;
}
.hosted-column-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px; margin: 0; font-size: 0.9rem; font-weight: 800; }
.hosted-column-head .hosted-pill-dot { color: var(--tone); width: 9px; height: 9px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 18%, transparent); }
.hosted-column-head .hosted-count { margin-inline-start: auto; }
.hosted-column-empty { text-align: center; color: var(--text-muted); padding: 18px 0; opacity: 0.6; }
.hosted-task-card { box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); transition: transform 0.18s var(--ease), box-shadow 0.18s ease; }
.hosted-task-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.hosted-task-card .panel-body { padding: 12px; gap: 8px; }
.hosted-task-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; font-size: 0.9rem; line-height: 1.5; }
.hosted-task-card-meta { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78rem; flex-wrap: wrap; }
.hosted-task-card-meta .ic { width: 14px; height: 14px; }
.hosted-task-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.hosted-task-people li { display: flex; align-items: center; gap: 7px; font-size: 0.8rem; }
.hosted-task-people li > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hosted-task-card .field-sm { min-height: 32px; font-size: 0.82rem; }
.hosted-task-card [data-action="cancel"] { align-self: flex-start; color: var(--tone-danger); }

.hosted .hosted-report { white-space: pre-wrap; font-size: 0.82rem; line-height: 1.7; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--h-radius); background: var(--surface-2); max-height: 60vh; overflow: auto; margin: 0; }
.hosted .hosted-details { font-size: 0.74rem; word-break: break-all; color: var(--text-muted); display: block; max-width: 48ch; }
.hosted .hosted-conflicts { margin: 0; padding-inline-start: 1.2rem; }

/* ----- forms ----- */

.hosted-form { gap: 14px; }
.hosted-field { display: flex; flex-direction: column; gap: 6px; }
.hosted-label { font-size: 0.84rem; font-weight: 700; }
.hosted-hint { font-size: 0.76rem; color: var(--text-muted); }
.hosted .field { min-height: 42px; border-radius: 11px; background: var(--surface); transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease; }
.hosted .field:hover:not(:focus):not([readonly]) { border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
.hosted .field:focus { box-shadow: var(--ring); }
.hosted .field[readonly] { background: var(--surface-2); color: var(--text-muted); }
.hosted .field[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent); }
.hosted .field-sm { min-height: 34px; border-radius: 9px; }
.hosted textarea.field { min-height: 70px; line-height: 1.7; }
.hosted select.field { cursor: pointer; }
.hosted-actions { gap: 8px; flex-wrap: wrap; }
.hosted .btn { border-radius: 11px; }
.hosted .btn-primary { box-shadow: 0 1px 0 rgb(255 255 255 / 0.15) inset, 0 4px 14px color-mix(in srgb, var(--accent) 26%, transparent); }
.hosted .btn-primary:hover { box-shadow: 0 1px 0 rgb(255 255 255 / 0.15) inset, 0 6px 18px color-mix(in srgb, var(--accent) 34%, transparent); }
.hosted .btn:disabled { box-shadow: none; }
.hosted-check { gap: 10px; align-items: center; cursor: pointer; font-size: 0.9rem; }
.hosted-check input[type="checkbox"]:not(.hosted-switch) { width: 18px; height: 18px; accent-color: var(--accent); }

.hosted-password { position: relative; display: block; }
.hosted-password .field { padding-right: 46px; }
.hosted-eye {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--text-muted);
}
.hosted-eye:hover { background: var(--surface-2); color: var(--text); }
.hosted-eye .ic { width: 18px; height: 18px; }
.hosted-meter { display: flex; align-items: center; gap: 10px; }
.hosted-meter[hidden] { display: none; }
.hosted-meter-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; flex: 1; }
.hosted-meter-track span { height: 5px; border-radius: 4px; background: var(--surface-3); transition: background 0.25s ease; }
.hosted-meter[data-score="0"] .hosted-meter-track span:nth-child(-n + 1) { background: var(--tone-danger); }
.hosted-meter[data-score="1"] .hosted-meter-track span:nth-child(-n + 1) { background: var(--tone-danger); }
.hosted-meter[data-score="2"] .hosted-meter-track span:nth-child(-n + 2) { background: var(--tone-warn); }
.hosted-meter[data-score="3"] .hosted-meter-track span:nth-child(-n + 3) { background: var(--tone-calm); }
.hosted-meter[data-score="4"] .hosted-meter-track span { background: var(--accent); }
.hosted-meter-label { font-size: 0.76rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; min-width: 9ch; }
.hosted-match { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 700; }
.hosted-match[hidden] { display: none; }
.hosted-match .ic { width: 14px; height: 14px; }
.hosted-match[data-ok="true"] { color: var(--tone-calm); }
.hosted-match[data-ok="false"] { color: var(--tone-warn); }

.hosted-code-field .field { font-family: var(--mono); font-size: 1.35rem; letter-spacing: 0.32em; text-align: center; min-height: 54px; font-variant-numeric: tabular-nums; }
.hosted-code-field .field::placeholder { color: color-mix(in srgb, var(--text-muted) 40%, transparent); }

.hosted-switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; cursor: pointer; margin: 0;
  width: 40px; height: 23px; border-radius: 999px;
  background: var(--border-strong); transition: background 0.2s ease;
}
.hosted-switch::before {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: inset-inline-start 0.22s var(--ease);
}
.hosted-switch:checked { background: var(--accent); }
.hosted-switch:checked::before { inset-inline-start: 20px; }
.hosted-switch:focus-visible { outline: none; box-shadow: var(--ring); }
.hosted-switch:disabled { opacity: 0.5; cursor: not-allowed; }

.callout-ok { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.callout-ok .ic { color: var(--accent); }
.hosted .callout { border-radius: 12px; }
.hosted-message[hidden] { display: none; }

/* ----- signing in ----- */

.hosted.is-auth .hosted-topbar { position: absolute; inset-inline: 0; top: 0; background: none; backdrop-filter: none; border: none; pointer-events: none; }
.hosted.is-auth .hosted-topbar > * { pointer-events: auto; }
.hosted.is-auth .hosted-brand, .hosted.is-auth .hosted-titles { visibility: hidden; }
.hosted.is-auth .hosted-theme { margin-inline-start: auto; color: var(--art-ink); background: rgb(255 255 255 / 0.12); border: 1px solid rgb(255 255 255 / 0.18); backdrop-filter: blur(6px); }
.hosted.is-auth .hosted-theme:hover { background: rgb(255 255 255 / 0.22); }
.hosted.is-auth .view { padding: 0; background: none; }

.hosted-auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 44%); grid-template-areas: "main art"; min-height: 100%; }
.hosted-auth-main { grid-area: main; display: flex; align-items: center; justify-content: center; padding: clamp(24px, 6vw, 64px) 16px; }
.hosted-auth-card { width: min(450px, 100%); border-radius: 22px; box-shadow: var(--lift); }
.hosted-auth-card > .panel-body { padding: 6px clamp(18px, 4vw, 30px) clamp(20px, 4vw, 30px); gap: 16px; }
.hosted-auth-head { display: flex; flex-direction: column; gap: 6px; padding: clamp(22px, 4vw, 32px) clamp(18px, 4vw, 30px) 10px; }
.hosted-auth-head .panel-title { font-size: 1.35rem; font-weight: 800; }
.hosted-auth-head p { font-size: 0.9rem; }
.hosted-auth-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; margin-bottom: 6px; color: var(--tone-accent); background: var(--accent-soft); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.hosted-auth-icon .ic { width: 23px; height: 23px; }
.hosted-auth .hosted-actions { flex-direction: column; align-items: stretch; }
.hosted-auth .hosted-actions .btn { justify-content: center; padding: 11px 16px; }
.hosted-auth .hosted-codes-box .hosted-actions { flex-direction: row; }
.hosted-auth-note { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; padding-top: 12px; border-top: 1px solid var(--border); }
.hosted-auth-note .ic { width: 16px; height: 16px; }

.hosted-auth-art {
  grid-area: art; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  padding: clamp(28px, 5vw, 56px);
  color: var(--art-ink);
  background: radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--art-gold) 20%, transparent), transparent 55%), linear-gradient(160deg, var(--art-from), var(--art-to));
}
.hosted-auth-pattern {
  position: absolute; inset: 0; opacity: 0.13; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23e3bf7c' stroke-width='1.1'%3E%3Cpath d='M40 8l9.4 22.6L72 40l-22.6 9.4L40 72l-9.4-22.6L8 40l22.6-9.4z'/%3E%3Cpath d='M17.4 17.4L40 26.8l22.6-9.4-9.4 22.6 9.4 22.6L40 53.2l-22.6 9.4 9.4-22.6z'/%3E%3Ccircle cx='40' cy='40' r='7'/%3E%3C/g%3E%3C/svg%3E") repeat;
  mask-image: radial-gradient(90% 70% at 30% 40%, #000, transparent);
  -webkit-mask-image: radial-gradient(90% 70% at 30% 40%, #000, transparent);
}
.hosted-auth-art > * { position: relative; }
.hosted-auth-brand { display: flex; align-items: center; gap: 12px; font-size: 1.1rem; }
.hosted-auth-brand .brand-mark { background: rgb(255 255 255 / 0.12); color: var(--art-gold); border: 1px solid rgb(255 255 255 / 0.2); width: 42px; height: 42px; border-radius: 13px; }
.hosted-auth-wave { display: flex; align-items: center; gap: 6px; height: 64px; }
.hosted-auth-wave span { width: 5px; border-radius: 4px; background: linear-gradient(var(--art-gold), color-mix(in srgb, var(--art-gold) 40%, transparent)); transform-origin: center; animation: hosted-wave 1.8s ease-in-out infinite; animation-delay: calc(var(--i) * -0.12s); }
@keyframes hosted-wave { 50% { transform: scaleY(0.45); } }
.hosted-auth-copy h2 { font-size: clamp(1.35rem, 1rem + 1.4vw, 1.9rem); font-weight: 800; line-height: 1.6; max-width: 18em; }
.hosted-auth-copy ul { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.hosted-auth-copy li { display: flex; align-items: center; gap: 12px; font-size: 0.95rem; opacity: 0.92; }
.hosted-auth-copy li .ic { width: 20px; height: 20px; color: var(--art-gold); padding: 7px; box-sizing: content-box; border-radius: 10px; background: rgb(255 255 255 / 0.08); }

.hosted-invite-role { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hosted-terms { font-size: 0.85rem; line-height: 1.9; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; max-height: 220px; overflow: auto; }
.hosted-terms ol { margin: 6px 0 0; padding-inline-start: 1.2em; }
.hosted-qr { width: 200px; height: 200px; background: #fff; padding: 10px; border-radius: 16px; align-self: center; border: 1px solid var(--border); box-shadow: var(--shadow); margin: 6px 0; }
.hosted-secret { font-size: 0.95rem; letter-spacing: 0.06em; background: var(--surface-2); padding: 7px 12px; border-radius: 9px; word-break: break-all; }
.hosted-secret-box { gap: 6px; padding-top: 4px; font-size: 0.85rem; }


.hosted-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.hosted-steps > li { counter-increment: step; position: relative; display: flex; flex-direction: column; gap: 6px; padding-inline-start: 44px; padding-bottom: 20px; }
.hosted-steps > li::before {
  content: counter(step, persian); position: absolute; inset-inline-start: 0; top: -2px;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  font-weight: 800; font-size: 0.9rem; color: var(--on-accent); background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.hosted-steps > li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 14px; top: 34px; bottom: 4px; width: 2px; border-radius: 2px; background: var(--border); }
.hosted-steps > li:last-child { padding-bottom: 0; }
.hosted-steps > li > span { font-size: 0.88rem; color: var(--text-muted); }

.hosted-codes-box { gap: 10px; }
.hosted-codes { list-style: none; counter-reset: code; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; padding: 0; }
.hosted-codes li { counter-increment: code; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.hosted-codes li::before { content: counter(code); font-size: 0.7rem; color: var(--text-muted); min-width: 1.4em; }
.hosted-codes code { font-size: 0.98rem; letter-spacing: 0.05em; }
.hosted-copy.is-done { color: var(--tone-calm); border-color: color-mix(in srgb, var(--tone-calm) 40%, transparent); }

/* ----- profile ----- */

.hosted-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: var(--h-gap); align-items: start; }
.hosted-grid .hosted-card { width: auto; }
.hosted-card { width: min(520px, 100%); }
.hosted-identity {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 22px 24px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent-soft) 80%, var(--surface)), var(--surface) 60%);
}
.hosted-identity-text { flex: 1; min-width: 200px; gap: 4px; }
.hosted-identity-text h2 { font-size: 1.35rem; font-weight: 800; }
.hosted-identity-text .hstack { gap: 10px; margin-top: 4px; }
.hosted-sessions { gap: 0; }
.hosted-session { padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.hosted-session:last-child { border-bottom: none; }
.hosted-session b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hosted-session .muted { font-size: 0.8rem; }
.hosted-session-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; color: var(--text-muted); background: var(--surface-2); }
.hosted-mfa-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hosted-more { border-top: 1px solid var(--border); padding-top: 12px; }
.hosted-more[open] summary { margin-bottom: 12px; }
.hosted-danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)) !important; }
.hosted-danger-zone .panel-head { background: color-mix(in srgb, var(--danger-soft) 60%, transparent); margin-bottom: 10px; }
.hosted-danger-zone .panel-head, .hosted-danger-zone .panel-head > .ic { color: var(--tone-danger); }

/* ----- settings ----- */

.hosted-settings-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--h-gap); align-items: start; }
.hosted-settings-side { gap: var(--h-gap); }
.hosted-settings-group { gap: 22px; }
.hosted-setting { display: flex; flex-direction: column; gap: 10px; }
.hosted-setting-head { display: flex; flex-direction: column; gap: 2px; }
.hosted-setting-head small { color: var(--text-muted); font-size: 0.8rem; }
.hosted-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 84px), 1fr)); gap: 10px; }
.hosted-choice {
  position: relative; display: flex; flex-direction: column; gap: 8px; cursor: pointer;
  padding: 10px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s var(--ease);
}
.hosted-choice:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.hosted-choice input { position: absolute; opacity: 0; pointer-events: none; }
.hosted-choice:has(input:checked) { border-color: var(--accent); box-shadow: var(--ring); }
.hosted-choice:has(input:checked)::after {
  content: ""; position: absolute; top: 8px; inset-inline-end: 8px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.hosted-choice:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.hosted-choice-text { display: flex; flex-direction: column; gap: 1px; }
.hosted-choice-text b { font-size: 0.88rem; }
.hosted-choice-text small { font-size: 0.74rem; color: var(--text-muted); line-height: 1.5; }
.hosted-swatch { display: grid; grid-template-rows: 9px 1fr; grid-template-columns: 1fr 1.6fr; gap: 4px; height: 62px; padding: 6px; border-radius: 9px; border: 1px solid var(--border); }
.hosted-swatch span:first-child { grid-column: 1 / -1; border-radius: 3px; }
.hosted-swatch span { border-radius: 5px; }
.hosted-swatch.is-light { background: #fbf7ec; }
.hosted-swatch.is-light span:nth-child(1) { background: #0e6b57; }
.hosted-swatch.is-light span:nth-child(2) { background: #f3eee0; }
.hosted-swatch.is-light span:nth-child(3) { background: #ffffff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.1); }
.hosted-swatch.is-dark { background: #10160f; border-color: #2b332a; }
.hosted-swatch.is-dark span:nth-child(1) { background: #35c79b; }
.hosted-swatch.is-dark span:nth-child(2) { background: #1e2620; }
.hosted-swatch.is-dark span:nth-child(3) { background: #171d18; }
/* half and half: the light page on the right, the dark one on the left */
.hosted-swatch.is-auto { grid-template-columns: 1fr 1fr; background: linear-gradient(to left, #fbf7ec 50%, #10160f 50%); }
.hosted-swatch.is-auto span:nth-child(1) { background: linear-gradient(to left, #0e6b57 50%, #35c79b 50%); }
.hosted-swatch.is-auto span:nth-child(2) { background: #f3eee0; }
.hosted-swatch.is-auto span:nth-child(3) { background: #1e2620; }
.hosted-text-swatch { display: grid; place-items: center; height: 46px; border-radius: 9px; background: var(--surface-2); font-weight: 800; line-height: 1; }
.hosted-text-swatch.is-sm { font-size: 1rem; }
.hosted-text-swatch.is-md { font-size: 1.3rem; }
.hosted-text-swatch.is-lg { font-size: 1.65rem; }
.hosted-section-head .hosted-pill { font-weight: 600; }

/* ----- one assignment ----- */

.hosted-assignment { height: 100%; min-height: 0; gap: 8px; padding: 10px 14px 0; }
.hosted-assignment-head { gap: 8px; }
.hosted-assignment-bar { gap: 8px 10px; padding: 8px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
.hosted-assignment-titles { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; margin-inline-end: 6px; }
.hosted-assignment-titles b { font-size: 0.95rem; }
.hosted-assignment-titles .muted { font-size: 0.76rem; }
.hosted-back .ic { transform: scaleX(-1); }
.hosted-autosave { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; color: var(--text-muted); }
.hosted-autosave .ic { width: 14px; height: 14px; }
.hosted-instructions { margin-inline-start: auto; position: relative; }
.hosted-instructions summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.84rem; font-weight: 700; color: var(--tone-accent); padding: 5px 10px; border-radius: 9px; list-style: none; }
.hosted-instructions summary::-webkit-details-marker { display: none; }
.hosted-instructions summary:hover { background: var(--accent-soft); }
.hosted-instructions-body { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30; width: min(480px, 86vw); max-height: 50vh; overflow: auto; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.hosted-instructions p { margin: 4px 0; max-width: 70ch; line-height: 1.8; }
.hosted-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.hosted-review-panel .panel-head { flex-wrap: wrap; }
.hosted-review-hint { font-size: 0.78rem; flex-basis: 100%; }
.hosted-review-panel textarea { resize: vertical; }
.hosted-comment-add { gap: 8px; }
.hosted-comment-add .field[name="comment-breath"] { width: 6em; flex: none; }
.hosted-comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hosted-comment-list:empty { display: none; }
.hosted-comment-list li { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; padding-inline: 12px 6px; border-radius: 10px; background: var(--surface-2); font-size: 0.88rem; }
.hosted-remove { width: 28px; height: 28px; }
.hosted-decisions { gap: 8px; }
.hosted-consensus { gap: 6px; }

/* ----- narrow screens ----- */

/* ----- projects: the goal, the scope, the KPIs, what to do next (docs/studio-workflows.md §5) ----- */

.hosted-recipes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.hosted-recipe {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: start;
  padding: 16px; border-radius: var(--radius-lg, 14px); border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; cursor: pointer; transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s var(--ease);
}
.hosted-recipe b { font-size: 1.02rem; }
.hosted-recipe:hover { transform: translateY(-2px); box-shadow: var(--lift); }
.hosted-recipe[aria-checked="true"] { border-color: var(--accent); box-shadow: var(--ring); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
.hosted-recipe-goal { color: var(--text-muted); font-size: 0.86rem; }
.hosted-recipe-crowd { gap: 6px; }
.hosted-scope { gap: 12px; }
.hosted-scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.hosted-chips { gap: 8px 16px; }
.hosted-scope-line { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; color: var(--tone-accent); }
.hosted-scope-more summary { cursor: pointer; color: var(--text-muted); font-size: 0.86rem; }
.hosted-create-row { gap: 10px; }
.hosted-create-row .field { flex: 1; min-width: min(100%, 240px); }

.hosted-recs { display: flex; flex-direction: column; gap: 10px; }
.hosted-rec {
  --tone: var(--tone-info);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px;
  border-radius: 12px; border: 1px solid color-mix(in srgb, var(--tone) 30%, var(--border));
  background: color-mix(in srgb, var(--tone) 7%, var(--surface));
}
.hosted-rec .vstack { gap: 2px; min-width: min(100%, 220px); }
.hosted-rec .muted { font-size: 0.86rem; }
.hosted-recs-none { display: flex; align-items: center; gap: 8px; margin: 0; }
.hosted-kpi[data-met="true"] .hosted-stat-icon { color: var(--tone-calm); }
.hosted-spark { width: 120px; height: 28px; overflow: visible; }
.hosted-spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.hosted-trend { gap: 8px 14px; font-size: 0.82rem; }

.hosted-project-cards { margin-top: 4px; }
.hosted-project-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; color: var(--text); text-decoration: none; transition: transform 0.2s var(--ease), box-shadow 0.2s ease; }
.hosted-project-card:hover { transform: translateY(-3px); box-shadow: var(--lift); }
.hosted-project-kpis { gap: 6px; }
.hosted-project-recs { margin: 0; padding-inline-start: 18px; font-size: 0.86rem; display: flex; flex-direction: column; gap: 4px; }
.hosted-project-recs li[data-tone] { color: var(--tone); }

/* ----- the annotator's guide and practice feedback (docs/studio-workflows.md §3) ----- */

.hosted-guide { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 8px 14px; }
.hosted-guide summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9rem; }
.hosted-guide-steps { margin: 8px 0 4px; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.hosted-guide-keys { display: inline-flex; gap: 4px; }
.hosted-guide-keys kbd, .hosted-feedback kbd {
  display: inline-block; padding: 0 6px; border-radius: 5px; border: 1px solid var(--border); border-bottom-width: 2px;
  background: var(--surface-2); font: 600 0.78rem/1.5 ui-monospace, monospace; color: var(--text);
}
.hosted-practice { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.hosted-feedback { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow: auto; }

@media (max-width: 1020px) {
  .hosted-titles { display: none; }
  .hosted-settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .hosted-brand-name, .hosted-me-text { display: none; }
  .hosted-role-switch { padding-inline: 6px 2px; }
  .hosted-role-switch select { max-width: 9ch; }
  .hosted-me { padding: 2px; }
  /* no backdrop-filter here: it would make the bar the containing block of
     the fixed tab bar below, which then sat at the top of the page */
  .hosted-topbar.topbar { min-height: 56px; gap: 6px; backdrop-filter: none; background: color-mix(in srgb, var(--surface) 94%, transparent); }
  /* the nav becomes a tab bar at the bottom of the screen */
  .hosted-nav {
    position: fixed; z-index: 40; inset-inline: 0; bottom: 0; margin: 0;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-radius: 0;
    background: var(--glass); backdrop-filter: saturate(1.4) blur(16px);
    border: none; border-top: 1px solid var(--border);
    box-shadow: 0 -6px 24px rgb(0 0 0 / 0.06);
  }
  .hosted-nav-link { flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 0.7rem; border-radius: 12px; }
  .hosted-nav-link .ic { width: 22px; height: 22px; }
  .hosted-nav-link[aria-current="page"] { box-shadow: none; background: var(--accent-soft); }
  .hosted:not(.is-auth) .view { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .hosted[data-screen="assignment"] .hosted-nav, .hosted[data-screen="preview"] .hosted-nav { display: none; }
  .hosted[data-screen="assignment"] .view { padding-bottom: 0; }

  .hosted-auth { grid-template-columns: 1fr; grid-template-areas: "art" "main"; }
  .hosted-auth-art { padding: 22px 20px 26px; gap: 14px; }
  .hosted-auth-copy ul, .hosted-auth-wave { display: none; }
  .hosted-auth-copy h2 { font-size: 1.05rem; line-height: 1.8; }
  .hosted-auth-main { align-items: flex-start; padding: 0 12px 32px; margin-top: -14px; }
  .hosted-auth-card { border-radius: 20px; }

  .hosted .view { padding-top: 18px; }
  .hosted .hosted-stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hosted .hosted-stat { padding: 12px; }
  .hosted .hosted-stat-value { font-size: 1.3rem; }
  .hosted-stats .panel-body.hosted-stats-body { flex-direction: column; align-items: stretch; }
  .hosted-ring { align-self: center; }
  .hosted-page-head { align-items: stretch; flex-direction: column; }
  .hosted-page-actions .btn { flex: 1; justify-content: center; }
  .hosted-codes { grid-template-columns: 1fr; }
  .hosted-identity { padding: 18px; }
  .hosted-identity-settings { width: 100%; justify-content: center; }

  /* a table becomes a list of cards, each cell labelled by its column */
  .hosted .hosted-table-wrap { border: none; background: none; box-shadow: none; overflow: visible; }
  .hosted .hosted-table, .hosted .hosted-table tbody, .hosted .hosted-table tr, .hosted .hosted-table td { display: block; width: 100%; }
  .hosted .hosted-table thead { display: none; }
  .hosted .hosted-table tbody { display: flex; flex-direction: column; gap: 10px; }
  .hosted .hosted-table tbody tr { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 6px 0; box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
  .hosted .hosted-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: none; padding: 7px 14px; white-space: normal; text-align: end; }
  .hosted .hosted-table td:last-child { white-space: normal; }
  .hosted .hosted-table td[data-label]::before { content: attr(data-label); font-size: 0.76rem; font-weight: 700; color: var(--text-muted); text-align: start; flex: none; max-width: 45%; }
  .hosted .hosted-table td:not([data-label]) { justify-content: flex-start; flex-wrap: wrap; }
  .hosted .hosted-table td:first-child { font-size: 0.95rem; }
  .hosted .hosted-table td .hstack.wrap, .hosted .hosted-settings-row { justify-content: flex-start; }
  .hosted .hosted-details { max-width: 60vw; }
}

@media (max-width: 420px) {
  .hosted-topbar .hosted-settings { display: none; }
}

@media print {
  .hosted-topbar, .hosted-nav { display: none; }
}

/* ----- the board (screens/board.js): scores, columns, cards ----- */
.hosted-scores { display: grid; gap: 4px; min-width: 12rem; }
.hosted-score { display: grid; grid-template-columns: 6.5rem 1fr 2.2rem; align-items: center; gap: 6px; font-size: 0.82rem; }
.hosted-score-label { color: var(--text-2, var(--muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hosted-score-track { position: relative; height: 7px; border-radius: 999px; background: var(--surface-2); overflow: visible; }
.hosted-score-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 999px; background: var(--tone-warn); }
.hosted-score[data-met="true"] .hosted-score-fill { background: var(--tone-calm); }
.hosted-score-bar { position: absolute; inset-block: -3px; width: 2px; margin-inline-start: -1px; background: var(--text); opacity: 0.45; border-radius: 1px; }
.hosted-score-value { text-align: end; font-variant-numeric: tabular-nums; }
.hosted-columns { display: grid; grid-template-columns: repeat(6, minmax(15rem, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.hosted-column { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 8px; border-radius: 14px; background: color-mix(in srgb, var(--surface-2) 70%, transparent); border: 1px solid var(--border); }
.hosted-column-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.hosted-column-body { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.hosted-board .hosted-card { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.hosted-card-meta { font-size: 0.8rem; }
.hosted-card-note { margin: 0; font-size: 0.85rem; color: var(--tone-warn); display: flex; gap: 4px; align-items: flex-start; }
.hosted-card-history { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: 8px; }
.hosted-card-history p { margin: 2px 0 0; }
.hosted-sample { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hosted-sample li { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; }
.hosted-board-link { display: flex; flex-direction: column; gap: 6px; padding: 12px; text-decoration: none; color: inherit; }
.hosted-board-link:hover { border-color: var(--accent); }
.hosted-moderator-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.hosted-my-scores { display: grid; gap: 6px; }
@media (max-width: 720px) {
  .hosted-columns { grid-template-columns: 1fr; overflow-x: visible; }
  .hosted-column-body { max-height: none; }
  .hosted-score { grid-template-columns: 5.5rem 1fr 2rem; }
}

/* ----- help, tours, the cheatsheet, the sandbox (help.js, tour.js) ----- */
.help-q { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-inline: 4px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--tone-accent); font: 700 11px/1 var(--font, inherit); cursor: help; vertical-align: middle; }
.help-q:hover, .help-q:focus-visible { border-color: var(--accent); }
.help-pop { position: absolute; z-index: 60; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 30px rgb(0 0 0 / 0.18); font-size: 0.9rem; }
.help-pop p { margin: 6px 0 0; }
.help-pop-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.help-pop-k { color: var(--tone-accent); font-weight: 600; }
.tour-dim { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / 0.38); pointer-events: none; }
.tour-lit { position: relative; z-index: 51; box-shadow: 0 0 0 4px var(--accent), 0 0 0 9999px rgb(0 0 0 / 0) !important; border-radius: 10px; }
.tour-bubble { position: absolute; z-index: 52; width: 320px; max-width: calc(100vw - 16px); padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--accent); box-shadow: 0 10px 30px rgb(0 0 0 / 0.25); }
.tour-actions { justify-content: space-between; margin-top: 8px; }
.cheatsheet-keys td { padding: 3px 8px; vertical-align: top; }
.cheatsheet-guide { margin-block: 8px; }
.hosted-sandbox-band { align-items: flex-start; }
.hosted-legend { gap: 4px; align-items: center; font-size: 0.85rem; }
.hosted-guidelines summary { cursor: pointer; }

/* The page never started (a module that did not load: the network, or a
   dev certificate the browser stopped accepting): say so instead of a blank
   page. #app is filled as soon as boot.js runs. */
#app.hosted:empty::before {
  content: "کارگاه بار نشد. صفحه را دوباره بارگیری کنید؛ اگر مرورگر هشدار گواهی نشان داد، آن را بپذیرید.";
  display: block;
  max-width: 32rem;
  margin: 20vh auto 0;
  padding: 0 16px;
  text-align: center;
  line-height: 2;
  opacity: 0;
  animation: hosted-rise 0.3s ease 6s forwards;
}
