@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #0b0d14;
  --bg-sidebar: #0e1119;
  --surface: #141823;
  --surface-2: #1a1f2d;
  --surface-3: #232a3b;
  --hover: rgba(255, 255, 255, .05);
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .13);
  --text: #eceef6;
  --text-2: #c3c8d9;
  --muted: #8a91a8;
  --blue: #6796fd;
  --violet: #8a8bf8;
  --pink: #dc5bd0;
  --brand: linear-gradient(115deg, #6796fd 0%, #8a8bf8 48%, #dc5bd0 100%);
  --accent: #a9aaff;
  --success: #5fd3a6;
  --warning: #f2c46b;
  --danger: #ff98a2;
  --radius: 14px;
  --radius-lg: 20px;
  --sidebar-width: 292px;
  /* Old names some modules still read. */
  --mint: var(--success);
  --panel: var(--surface);
  --stroke: var(--line-strong);
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
.icon { width: 1.15em; height: 1.15em; flex: none; display: block; }
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent; }

/* Buttons */
.primary, .secondary, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.5rem;
  padding: .5rem 1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: .92rem;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.primary { background: #eef0f8; color: #0b0d14; }
.primary:hover:not(:disabled) { background: #ffffff; }
.primary:active:not(:disabled) { transform: translateY(1px); }
.secondary { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); }
.secondary:hover:not(:disabled) { background: var(--surface-3); }
.ghost { background: transparent; color: var(--text-2); }
.ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
}
.icon-button:hover { background: var(--hover); color: var(--text); }
.icon-button .icon { width: 1.3rem; height: 1.3rem; }

/* Employee avatar: the department's icon on the employee's color. */
.avatar, .employee-chat-avatar {
  --c: #a9aaff;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 11px;
  color: #0b0d14;
  background: linear-gradient(150deg, color-mix(in oklab, var(--c) 88%, white), color-mix(in oklab, var(--c) 72%, #2a2f45));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 8px 18px -10px var(--c);
  font-weight: 700;
  font-size: .85rem;
}
.avatar .icon, .employee-chat-avatar .icon { width: 56%; height: 56%; stroke-width: 2; }

/* App shell */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: 100vh; height: 100dvh; }

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: .35rem;
  padding: 1rem .75rem .75rem;
  background: var(--bg-sidebar);
  border-inline-end: 1px solid var(--line);
  z-index: 40;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: .1rem .45rem .7rem; }
.brand { display: inline-flex; align-items: center; }
.brand-logo { display: block; width: 8.6rem; height: auto; }
.sidebar-close { display: none; }
.new-chat {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .62rem .8rem;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-align: start;
  transition: background-color .15s ease;
}
.new-chat:hover { background: var(--surface-2); }
.new-chat .icon { color: var(--accent); }
.spaces { display: grid; gap: 1px; margin: .45rem 0 .2rem; }
.space-link {
  display: flex;
  align-items: center;
  gap: .62rem;
  width: 100%;
  padding: .5rem .7rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: .92rem;
  text-align: start;
}
.space-link:hover { background: var(--hover); color: var(--text); }
.space-link.current { background: var(--surface-2); color: var(--text); }
.space-link .icon { opacity: .9; }
.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -.35rem; padding: 0 .35rem .5rem; }
.sidebar-title { margin: 1rem .55rem .35rem; color: var(--muted); font-size: .74rem; font-weight: 600; }
.sidebar-title:has(.sidebar-toggle) { margin-inline: 0; }
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  padding: .3rem .55rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
}
.sidebar-toggle:hover { background: var(--hover); color: var(--text-2); }
.sidebar-toggle .icon { width: .95rem; height: .95rem; transition: transform .18s ease; }
.sidebar-toggle[aria-expanded="false"] .icon { transform: rotate(90deg); }
.team-nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: .1rem; }
.team-nav[hidden] { display: none; }
.dept { display: grid; grid-template-columns: minmax(0, 1fr); gap: .1rem; }
.dept-name { display: flex; align-items: center; gap: .45rem; margin: .55rem .55rem .15rem; color: var(--muted); font-size: .72rem; }
.dept-name .icon { width: .85rem; height: .85rem; opacity: .8; }
.person-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  padding: .42rem .5rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: start;
}
.person-link:hover { background: var(--hover); }
.person-link[aria-current="true"] { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.person-link .avatar { width: 1.9rem; height: 1.9rem; border-radius: 9px; }
.person-meta { display: grid; min-width: 0; }
.person-meta strong, .person-meta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-meta strong { font-size: .88rem; font-weight: 600; line-height: 1.45; }
.person-meta small { color: var(--muted); font-size: .74rem; line-height: 1.35; }
.person-badge { margin-inline-start: auto; width: .45rem; height: .45rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(169, 170, 255, .16); animation: pulse 1.4s ease-in-out infinite; }
.recent-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.recent-item { position: relative; }
.sync-status { display: flex; align-items: center; gap: .45rem; margin: 0 .6rem .55rem; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.sync-status .icon { width: .95rem; height: .95rem; }
.sync-status[data-state="synced"] .icon { color: var(--success); }
.sync-status[data-state="syncing"] .icon { animation: sync-spin 1s linear infinite; }
.sync-status[data-state="off"], .sync-status[data-state="retrying"], .sync-status[data-state="offline"] { color: var(--warning); }
@keyframes sync-spin { to { transform: rotate(360deg); } }
.recent-day { margin: .85rem .55rem .2rem; color: var(--muted); font-size: .7rem; font-weight: 600; }
.recent-day:first-child { margin-top: .2rem; }
.recent-link {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .45rem .55rem;
  padding-inline-end: 2.2rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: .86rem;
  text-align: start;
}
.recent-link:hover { background: var(--hover); color: var(--text); }
.recent-link[aria-current="true"] { background: var(--surface-2); color: var(--text); }
.recent-link .avatar { width: 1.35rem; height: 1.35rem; border-radius: 7px; box-shadow: none; }
.recent-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-delete { position: absolute; inset-block: 0; inset-inline-end: .2rem; margin: auto 0; width: 1.9rem; height: 1.9rem; opacity: 0; }
.recent-item:hover .recent-delete, .recent-delete:focus-visible { opacity: 1; }
.recent-delete .icon { width: 1rem; height: 1rem; }
.sidebar-foot { display: grid; gap: .5rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.install-app {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .55rem .7rem;
  border-radius: 12px;
  border: 1px solid rgba(138, 139, 248, .32);
  background: linear-gradient(115deg, rgba(103, 150, 253, .14), rgba(220, 91, 208, .12));
  color: var(--text);
  font-size: .86rem;
  font-weight: 600;
  text-align: start;
}
.install-app:hover { border-color: rgba(138, 139, 248, .55); }
.account { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .15rem .45rem; }
.connection { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; color: var(--muted); font-size: .78rem; }
.connection > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection i, .indicator { width: .45rem; height: .45rem; border-radius: 50%; flex: none; background: var(--warning); }
.connection.live i { background: var(--success); box-shadow: 0 0 0 3px rgba(95, 211, 166, .15); }
.owner-signin {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .6rem;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: .78rem;
  text-decoration: none;
  white-space: nowrap;
}
.owner-signin:hover { background: var(--hover); color: var(--text); }
.owner-signin .icon { width: .95rem; height: .95rem; }
.scrim { display: none; }

.main {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    radial-gradient(900px 420px at 50% -12%, rgba(138, 139, 248, .09), transparent 70%),
    var(--bg);
}
.mobile-bar { display: none; grid-column: 1 / -1; }
.view { grid-row: 2; grid-column: 1; min-width: 0; min-height: 0; }
.view-chat { display: flex; }
#chat-panel { flex: 1; min-width: 0; min-height: 0; display: flex; }
.view-page { overflow-y: auto; padding: 2.2rem clamp(1rem, 4vw, 3rem) 3rem; }
.main[data-page="chat"] .side, .main[data-page="deliverables"] .side, .main[data-page="learning"] .side { display: none; }

/* Pages */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.eyebrow { margin-bottom: .25rem; color: var(--accent); font-size: .78rem; font-weight: 600; }
.page-head h1 { font-size: clamp(1.45rem, 2.5vw, 2rem); line-height: 1.35; font-weight: 700; }
.page-head p:not(.eyebrow) { margin-top: .3rem; color: var(--muted); max-width: 40rem; line-height: 1.7; }
.card { padding: 1.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card h2 { font-size: 1.05rem; font-weight: 700; }
.empty { padding: 1.4rem; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); text-align: center; }

.scene { position: relative; height: clamp(24rem, 58vh, 40rem); isolation: isolate; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: radial-gradient(ellipse at 50% 45%, #1d2340, #0c0f18 78%); }
.scene-canvas { position: absolute; inset: 0; min-height: 0; overflow: hidden; direction: ltr; }
.scene-canvas canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.team-header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.4rem 0 .7rem; }
.team-header h2 { font-size: 1.05rem; }
.team-header p { color: var(--muted); font-size: .88rem; }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr)); gap: .6rem; }
.employee {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: start;
  transition: background-color .15s ease, border-color .15s ease;
}
.employee:hover, .employee[aria-pressed="true"] { background: var(--surface-2); border-color: var(--line-strong); }
.employee > span:last-child { display: grid; min-width: 0; }
.employee strong, .employee small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.employee strong { font-size: .92rem; }
.employee small { color: var(--muted); font-size: .78rem; }

.side {
  grid-row: 2;
  grid-column: 2;
  align-self: start;
  width: 19rem;
  max-height: calc(100% - 4.4rem);
  overflow-y: auto;
  margin: 2.2rem 0 2.2rem clamp(1rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.side-label { display: flex; align-items: center; gap: .5rem; margin-bottom: .9rem; color: var(--muted); font-size: .8rem; }
.indicator { background: var(--accent); }
.person { display: flex; align-items: center; gap: .8rem; }
.person .avatar { width: 3rem; height: 3rem; border-radius: 15px; }
.person h2 { font-size: 1.15rem; line-height: 1.35; }
.person p { color: var(--text-2); font-size: .86rem; }
.agent-description { margin: .9rem 0; color: var(--muted); line-height: 1.75; font-size: .9rem; }
.rule { height: 1px; margin-bottom: .8rem; background: var(--line); }
.side h3 { font-size: .92rem; }
.jobs { margin: .4rem 0 1rem; padding-inline-start: 1.1rem; color: var(--text-2); line-height: 1.8; font-size: .9rem; }
.jobs li::marker { color: var(--accent); }
.side-bottom { display: grid; gap: .5rem; margin-top: auto; }
.task-status { justify-self: start; color: var(--success); font-size: .84rem; }
.task-detail { min-height: 1.2rem; color: var(--muted); font-size: .84rem; line-height: 1.6; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.fields label { display: grid; gap: .4rem; align-content: start; color: var(--text-2); font-size: .88rem; font-weight: 600; }
.fields .full { grid-column: 1 / -1; }
.fields input, .fields textarea {
  width: 100%;
  min-width: 0;
  padding: .65rem .8rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-weight: 400;
  font-size: .95rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fields input:focus, .fields textarea:focus { outline: none; border-color: rgba(169, 170, 255, .55); box-shadow: 0 0 0 4px rgba(138, 139, 248, .12); }
.fields textarea { resize: vertical; min-height: 6rem; line-height: 1.7; }
.fields input::placeholder, .fields textarea::placeholder { color: #6f768d; }
.form-actions { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; }
.form-actions span { color: var(--success); font-size: .88rem; }
.campaign-flow { margin-top: 1rem; }
.campaign-flow > p { margin-top: .3rem; color: var(--muted); line-height: 1.7; font-size: .9rem; }
.team-checks { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.team-checks label {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .75rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: .86rem;
  cursor: pointer;
}
.team-checks label:has(input:checked) { border-color: rgba(169, 170, 255, .5); background: rgba(138, 139, 248, .12); }
.team-checks input { accent-color: var(--violet); }
#campaign-status { margin-top: .7rem; color: var(--text-2); font-size: .88rem; }

.deliverables { display: grid; gap: .8rem; }
.delivery-card { padding: 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.delivery-meta { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.delivery-meta h2 { font-size: 1rem; }
.delivery-meta span { color: var(--success); font-size: .8rem; }
.delivery-card p { margin: .8rem 0 1rem; color: var(--text-2); line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.delivery-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.delivery-summary { display: grid; gap: .8rem; margin-bottom: 1rem; }
.delivery-summary h2 { font-size: 1.1rem; }
.delivery-summary p { color: var(--muted); }
.delivery-index { display: flex; flex-wrap: wrap; gap: .4rem; }
.delivery-index a { display: inline-flex; align-items: center; min-height: 2rem; padding: .2rem .7rem; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .84rem; text-decoration: none; }
.delivery-index a:hover { background: var(--hover); }
.delivery-index a[data-ready="false"] { color: var(--muted); }
.design-assets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .7rem; margin: .8rem 0 1rem; }
.design-asset { display: flex; flex-direction: column; gap: .5rem; margin: 0; padding: .7rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.design-asset figcaption { font-weight: 600; font-size: .9rem; }
.design-asset canvas { display: block; width: 100%; height: clamp(10rem, 34vw, 18rem); object-fit: contain; border-radius: 10px; background: #080a10; }
.design-asset button { align-self: flex-start; margin-top: auto; }

/* Learning: what each employee learned */
.learning { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.learning-top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.learning-team { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1rem; align-items: start; }
.learning .card { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; }
.learning button { white-space: normal; text-align: center; }
.learning-muted { color: var(--muted); line-height: 1.8; }
.learning-when { color: var(--accent); font-size: .8rem; font-weight: 600; }
.learning-summary { color: var(--text-2); line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.learning-older { display: grid; gap: .5rem; }
.learning-older summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
.learning-older[open] summary { margin-bottom: .4rem; }
.learning-schedule > button { justify-self: start; }
.learning-schedule p[hidden] { display: none; }
.learning details.learning-key { display: block; }
.learning-key > * + * { margin-top: .75rem; }
.learning-key > summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
.learning-key > button { justify-self: start; }
.learning-key-output { display: grid; gap: .7rem; }
.learning-key-output:empty { display: none; }
.learning-key-row { display: flex; gap: .5rem; }
.learning-key-field { flex: 1; min-width: 0; padding: .55rem .7rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.learning-steps { display: grid; gap: .45rem; padding-inline-start: 1.2rem; color: var(--text-2); font-size: .88rem; line-height: 1.8; }
.learning-unlink { justify-self: start; min-height: 2rem; padding: .25rem .6rem; font-size: .82rem; color: var(--muted); }
.learning-error { color: var(--danger); font-size: .86rem; }
.learning-services { display: grid; gap: .6rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.learning-services h3 { font-size: .92rem; font-weight: 700; }
.learning-service-list { display: grid; gap: .45rem; list-style: none; padding: 0; margin: 0; }
.learning-service { display: grid; gap: .25rem; padding: .55rem .7rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.learning-service-head { display: flex; align-items: center; gap: .5rem; }
.learning-service-head i { width: .5rem; height: .5rem; border-radius: 50%; flex: none; background: var(--muted); }
.learning-service.ok .learning-service-head i { background: var(--success); }
.learning-service.down .learning-service-head i { background: var(--danger); }
.learning-service.missing .learning-service-head i { background: var(--warning); }
.learning-service-head span { margin-inline-start: auto; color: var(--muted); font-size: .8rem; }
.learning-service.down .learning-service-head span { color: var(--danger); font-weight: 600; }
.learning-service p { color: var(--text-2); font-size: .82rem; line-height: 1.7; overflow-wrap: anywhere; }
.learning-error[hidden] { display: none; }
.learning-employee-head { display: flex; align-items: center; gap: .7rem; }
.learning-employee-head .avatar { width: 2.4rem; height: 2.4rem; flex: none; }
.learning-employee-names { display: grid; flex: 1; min-width: 0; }
.learning-employee-names span { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.learning-count { flex: none; padding: .15rem .6rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); font-size: .76rem; }
.learning-lessons { display: grid; gap: .45rem; list-style: none; padding: 0; margin: 0; }
.learning-lesson { display: flex; align-items: flex-start; gap: .4rem; padding: .6rem .7rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.learning-lesson-body { flex: 1; min-width: 0; display: grid; gap: .2rem; }
.learning-lesson-text { line-height: 1.75; overflow-wrap: anywhere; }
.learning-lesson-meta { color: var(--muted); font-size: .75rem; }
.learning-lesson-why { color: var(--text-2); font-size: .82rem; line-height: 1.7; }
.learning-remove { flex: none; width: 2rem; height: 2rem; color: var(--muted); }
.learning-remove .icon { width: 1rem; height: 1rem; }
.learning-remove:hover { color: var(--danger); }
.learning-add { display: flex; gap: .5rem; }
.learning-add input { flex: 1; min-width: 0; padding: .55rem .75rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); font-size: .88rem; }
.learning-add input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Install help */
.install-help {
  position: fixed;
  z-index: 60;
  inset-block-end: 5.5rem;
  inset-inline-start: 1rem;
  display: grid;
  gap: .7rem;
  width: min(20rem, calc(100vw - 2rem));
  padding: 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .8);
}
.install-help h2 { font-size: 1rem; }
.install-help p { color: var(--text-2); line-height: 1.8; font-size: .9rem; }
.install-help button { justify-self: start; }

@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 1100px) {
  .side { width: 16.5rem; }
}

@media (max-width: 900px) {
  .learning-top { grid-template-columns: minmax(0, 1fr); }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: min(86vw, 20rem);
    transform: translateX(100%);
    transition: transform .22s ease;
    box-shadow: -24px 0 60px -30px rgba(0, 0, 0, .9);
  }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(4, 6, 10, .62); }
  .sidebar-close { display: inline-grid; }
  .mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem .6rem;
    padding-top: max(.5rem, env(safe-area-inset-top));
    border-bottom: 1px solid var(--line);
    background: rgba(11, 13, 20, .88);
    backdrop-filter: blur(14px);
  }
  .mobile-logo { width: 7.2rem; height: auto; }
  .main:not([data-page="chat"]) { display: block; overflow-y: auto; }
  .main:not([data-page="chat"]) .mobile-bar { position: sticky; top: 0; z-index: 5; }
  .view-page { overflow: visible; padding: 1.3rem 1rem 1.5rem; }
  .side { width: auto; max-height: none; margin: 0 1rem 1.5rem; }
  .page-head { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 520px) {
  .fields { grid-template-columns: minmax(0, 1fr); }
  .roster { grid-template-columns: minmax(0, 1fr); }
  .scene { height: min(56vh, 26rem); min-height: 18rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
