/* Atlas shell — the frame around every screen, as in v7.1 (ui/atlas/src/shell.css): a 52px top bar across
   the width, a 68px icon rail, and the screen as a rounded panel inside the frame with its own aura. Then the
   chat: welcome, turns, steps, the glass composer, the document side panel. Layout and behaviour only;
   every colour, radius and shadow is a token (tokens.css), every component a class of components.css.

   Sections: frame · top bar · bell · rail · panel · bare · chat (welcome, turns, steps, composer) · phone. */

body { overflow: hidden; }
#root { height: 100%; }
.boot { height: 100%; display: grid; place-items: center; background: var(--frame); }
.boot .spinner { width: 22px; height: 22px; }

/* The orb never changes colour or shape; its only effect is this shadow (brand/atlas_icon.md). */
.logo { display: block; flex: none; filter: drop-shadow(0 3px 8px oklch(60% .14 230 / .35)); user-select: none; }

/* --- frame: top bar across, rail down the left, the screen panel in the corner ------------------------------- */

.o-shell {
  position: relative; height: 100%; background: var(--frame);
  display: grid; grid-template-columns: 68px minmax(0, 1fr); grid-template-rows: 52px minmax(0, 1fr);
}

.o-topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 4px; min-width: 0; position: relative; z-index: 2; }
.o-topbar-brand { width: 68px; flex: 0 0 68px; display: grid; place-items: center; }
.o-orb { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; padding: 0; border: 0; background: none; }
.o-orb:active { transform: scale(.92); }
.o-orb .logo { width: 34px; height: 34px; }
.o-topbar-title { font-size: 18px; font-weight: 680; color: var(--text); letter-spacing: -.02em; line-height: 1.2;
  min-width: 0; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-topbar-extra { display: flex; align-items: center; gap: 6px; min-width: 0; margin-left: 10px; }
.o-topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; padding-right: 10px; flex: none; }
.o-topbar-button {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--r-1);
  background: none; color: var(--text-3); transition: background .15s, color .15s;
}
.o-topbar-button svg { width: 17px; height: 17px; }
.o-topbar-button:hover, .o-topbar-button[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }

/* --- bell: in-app notifications (app.js `bell`); the count on the bell, red when one is critical -------------- */

.o-bell { position: relative; }
.o-bell-badge {
  position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill);
  display: grid; place-items: center; background: var(--accent); color: var(--accent-fg);
  font-size: 10px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; pointer-events: none;
  box-shadow: 0 0 0 2px var(--frame);
}
.o-bell-badge[hidden] { display: none; }
.o-bell-badge.is-critical { background: var(--critical); color: oklch(99% 0 0); }
.o-item-nav.o-bell .o-bell-badge { top: 4px; right: 4px; }
/* the rail's bell is for phones, where the top bar is gone */
.o-item-nav.o-bell--rail { display: none; }   /* phones only (below); beats .o-item-nav { display: grid } */

.bell-list { display: flex; flex-direction: column; gap: 6px; }
.bell-row {
  display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 10px 12px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--r-2); background: var(--surface); color: var(--text-2);
  font-size: 13px; line-height: 1.45; transition: background .15s, border-color .15s;
}
.bell-row:hover { background: var(--surface-2); border-color: var(--border-2); }
.bell-row-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bell-row-title { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--text); font-weight: 500; }
.bell-row.is-unread .bell-row-title { font-weight: 680; }
.bell-row.is-unread { border-color: var(--border-2); box-shadow: var(--sh-1); }
.bell-row-body { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bell-row-meta { font-size: 12px; color: var(--text-3); }
.bell-row-closed { flex: none; font-size: 11.5px; color: var(--text-3); }
.bell-row.is-closed { background: var(--surface-2); }
.bell-row.is-closed .bell-row-title, .bell-row.is-closed .bell-row-body { color: var(--text-3); }
[data-touch] .bell-row { min-height: var(--touch-target); }

/* a board pin that refreshes itself (tool refresh_s): when it last did */
.card.block > .card-refreshed { display: flex; align-items: center; gap: 5px; padding: 6px 12px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.card-refreshed svg { width: 12px; height: 12px; }

/* Ayarlar › Modüller › İşler (scheduled module jobs) */
.mod-extra .mod-jobs summary { color: var(--text-2); }
.mod-jobs li { margin-bottom: 4px; }
.mod-jobs li > .pill { margin-left: 2px; }
.mod-jobs p { margin: 6px 0 0; }

/* --- rail: 42px icon items, names in a glass bubble (kit.nameTip) ---------------------------------------------- */

.o-rail { min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 2px 0 14px;
  position: relative; z-index: 5; overflow-y: auto; scrollbar-width: none; }
.o-rail::-webkit-scrollbar { display: none; }
.o-rail-orb { display: none; }
.o-nav { display: grid; gap: 4px; flex-shrink: 0; justify-items: center; }
.o-nav-sep { width: 22px; height: 1px; background: var(--border-2); margin: 4px 0; }
/* the modules a person keeps on the rail (Modüller › star): part of the nav's own layout, both orientations */
.o-nav-mods { display: contents; }
.o-item-nav {
  position: relative; display: grid; place-items: center; flex: none;
  width: 42px; height: 42px; padding: 0; border: 0; border-radius: var(--r-2);
  background: transparent; color: var(--text-2); transition: background .15s, color .15s;
}
.o-item-nav svg { width: 20px; height: 20px; }
:where(html:not([data-touch]):not([data-lite])) .o-item-nav:hover { background: var(--surface-2); color: var(--text); }
.o-item-nav[aria-current="page"] { background: var(--surface-2); color: var(--text); }
/* a module's icon in its own colour; the current one sits on a tint of it */
.o-item-nav.tinted { color: var(--mc); }
.o-item-nav.tinted[aria-current="page"] { background: color-mix(in oklab, var(--mc) 15%, var(--surface)); color: var(--mc); }
.o-item-nav[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent-text); }
.o-fill { flex: 1; }
.o-rail-bottom { display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; flex-shrink: 0; }
.o-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; border: 0; padding: 0;
  display: grid; place-items: center; background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: var(--accent-fg); font-size: 14px; font-weight: 660; transition: transform .18s var(--spring);
}
.o-avatar:active { transform: scale(.92); }
.o-avatar[aria-current="page"] { box-shadow: 0 0 0 2px var(--frame), 0 0 0 4px var(--ring); }
.o-rail-bottom .iconbtn[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }

/* --- the screen panel: rounded, on the frame, its aura lined up with the page as if through a window --------- */

.o-main {
  position: relative; z-index: 1; isolation: isolate; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; overflow: hidden;
  margin: 0 8px 8px 0; border-radius: var(--r-3); border: 1px solid var(--border); background: var(--bg);
}
.o-main > .aura { position: absolute; inset: auto; left: -69px; top: -53px; width: 100vw; height: 100vh; z-index: -1; opacity: .8; }
.view { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; position: relative; }

/* a bare page (Module(bare=…), /m/veri/d/…): no top bar, no rail, the screen alone across the whole window */
.o-bare { height: 100%; display: flex; flex-direction: column; overflow: auto; background: var(--bg); }
.o-bare-page { padding: 12px 16px; }

/* a screen's own header strip (module page): icon, name, what it does, its controls */
.o-top { display: flex; align-items: center; gap: 12px; flex-shrink: 0; flex-wrap: wrap;
  padding: 13px 24px; min-height: 56px; border-bottom: 1px solid var(--border); }
.o-top h1 { font-size: 15.5px; font-weight: 620; margin: 0; letter-spacing: -.01em; }

/* --- chat ---------------------------------------------------------------------------------------------------------- */

.view.chat { display: flex; flex-direction: column; overflow: hidden; }
.view.chat > .split { flex: 1; }
.o-chat-stream { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.o-chat-stream-inner { max-width: 760px; margin: 0 auto; padding: 0 24px 24px; }
.o-chat-bottom { width: 100%; max-width: 760px; margin: 0 auto; padding: 10px 24px 14px; flex-shrink: 0; }
.mode-note { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--text-3); padding: 0 6px; }
.mode-note svg { width: 13px; height: 13px; flex: none; }
.mode-note span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* welcome: one box in the middle — greeting, the large composer, a few suggestions */
.view.chat.is-empty .o-chat-bottom { display: none; }
.view.chat.is-empty .o-chat-stream-inner { min-height: 100%; display: flex; flex-direction: column; }
.o-greeting { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px 0; }
.o-greeting-box { width: 100%; max-width: 620px; margin: 0 auto; animation: fade-up .5s var(--ease-out) both; }
.o-greeting-title { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.o-greeting-title .logo { width: 26px; height: 26px; }
.o-greeting-title h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.o-greeting-sub { margin: 0 0 18px 38px; font-size: 13.5px; color: var(--text-3); }
.o-greeting-box > .o-composer { animation: fade-up .5s var(--ease-out) .12s both; }
.o-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; animation: fade-up .5s var(--ease-out) .2s both; }
.o-suggest .chip { max-width: 100%; }
.o-suggest .chip > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* turns: the question on the right in a bubble, the answer on the left with no bubble */
.o-turns { display: flex; flex-direction: column; gap: 18px; padding: 24px 0 8px; }
.o-kind-row { display: flex; gap: 12px; min-width: 0; animation: fade-up .32s var(--ease-out) both; }
.o-kind-row--me { justify-content: flex-end; }
.o-bubble {
  max-width: 76%; padding: 10px 15px; border-radius: var(--r-3); border-bottom-right-radius: 7px;
  background: var(--bubble-me); color: var(--bubble-me-text); font-size: 15px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.o-kind-orb { flex-shrink: 0; display: block; line-height: 0; width: 26px; height: 26px; border-radius: 50%; }
.o-kind-orb .logo { width: 26px; height: 26px; }
.o-reply { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px;
  font-size: 15px; line-height: 1.68; color: var(--text-2); padding-top: 1px; }
.o-reply .md { line-height: 1.68; }
.o-reply .md strong, .o-reply .md b { color: var(--text); }
.o-reply .md p { margin: 0 0 12px; }
.o-reply .md p:last-child { margin-bottom: 0; }
.o-reply > .card.block { color: var(--text); }
.o-reply > .error-box { font-size: 14px; }
.o-thinking { display: flex; align-items: center; gap: 5px; height: 26px; color: var(--text-3); }

/* steps: what Atlas is doing (a pulsing dot), then done (check) or failed (alert) */
.steps { display: flex; flex-direction: column; gap: 3px; }
.step { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.step-ic { width: 16px; height: 16px; display: grid; place-items: center; flex: none; }
.step-ic svg { width: 14px; height: 14px; }
.o-doing { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.step.s-ok .step-ic { color: var(--good); }
.step.s-error .step-ic { color: var(--bad); }
.step-mod { font-weight: 620; color: var(--mc, var(--text-2)); font-size: 12.5px; flex: none; }
.step-title { color: var(--text-2); white-space: nowrap; flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.step-text { min-width: 0; flex: 1; }
.step.s-running .step-title { color: var(--text-2); }

/* --- composer: glass on a layer behind the box (a menu spilling out of it must not be clipped) ----------------- */

.o-composer {
  position: relative; display: flex; flex-direction: column; border-radius: 26px; isolation: isolate;
  --composer-edge: var(--border-2);
}
.o-composer::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: var(--glass-3);
  backdrop-filter: blur(var(--glass-blur-3)) saturate(1.5); -webkit-backdrop-filter: blur(var(--glass-blur-3)) saturate(1.5);
  border: 1.5px solid var(--composer-edge); transition: border-color .15s;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .o-composer::before { background: var(--surface); } }
[data-lite] .o-composer::before { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
.o-composer:focus-within { --composer-edge: var(--border-strong); }
.o-composer--large { padding: 9.5px 11.5px; box-shadow: var(--sh-3); }
.o-composer--small { padding: 7.5px 9.5px; box-shadow: var(--sh-2); }
.o-composer textarea {
  display: block; width: 100%; border: 0; background: transparent; resize: none; outline: none; box-shadow: none;
  font: inherit; color: var(--text); max-height: 200px; padding: 7px 8px; line-height: 24px; overflow-wrap: break-word;
  min-height: 0; border-radius: 0;
}
.o-composer textarea:focus { box-shadow: none; border: 0; }
.o-composer--large textarea { font-size: 16.5px; }
.o-composer--small textarea { font-size: 15.5px; }
.o-composer textarea::placeholder { color: var(--text-faint); }
.o-composer-foot { display: flex; align-items: center; gap: 8px; min-width: 0; padding-top: 2px; }
.o-composer-foot .mode-note { flex: 1; }
.o-send {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; border: 0; display: grid; place-items: center;
  color: var(--accent-fg); background: linear-gradient(160deg, var(--accent-2), var(--accent));
  box-shadow: 0 4px 14px var(--ring); transition: transform .18s var(--spring), opacity .14s;
}
.o-send svg { width: 19px; height: 19px; }
.o-send:active { transform: scale(.92); }
.o-send:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.o-send[disabled] { background: none; box-shadow: none; color: var(--text-2); opacity: .5; cursor: default; }
.o-send[disabled]:active { transform: none; }
.o-send.is-stop { background: var(--text); color: var(--bg); box-shadow: var(--sh-2); }
/* the module page's "ask about this module": a single row, no foot */
.o-composer--inline { flex-direction: row; align-items: center; padding: 4px 4px 4px 6px; box-shadow: none; border-radius: var(--r-pill); }
.o-composer--inline textarea { font-size: 14px; padding: 5px 8px; line-height: 22px; max-height: 120px; }
.o-composer--inline .o-send { width: 32px; height: 32px; }
.o-composer--inline .o-send svg { width: 16px; height: 16px; }

/* --- phone: the top bar goes, the rail is a strip across the top, the panel goes full-bleed ----------------- */

@media (max-width: 760px) {
  .o-shell { display: flex; flex-direction: column; }
  .o-topbar { display: none; }
  .o-main { order: 1; flex: 1; margin: 0; border: 0; border-radius: 0; }
  .o-main > .aura { left: 0; top: 0; }
  .o-rail {
    order: 0; flex: 0 0 auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; gap: 4px; padding: 6px 8px;
    border-bottom: 1px solid var(--border);
  }
  .o-rail .o-fill { display: none; }
  .o-rail .o-rail-orb { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; }
  .o-rail .o-rail-orb .logo { width: 30px; height: 30px; }
  .o-rail .o-nav { display: flex; gap: 4px; }
  .o-nav-sep { width: 1px; height: 22px; margin: 0 2px; align-self: center; }
  .o-rail-bottom { flex-direction: row; gap: 4px; margin: 0 0 0 auto; }
  .o-item-nav.o-bell--rail { display: grid; }
  .o-bell--rail .o-bell-badge { box-shadow: 0 0 0 2px var(--bg); }
  .o-chat-stream-inner { padding: 0 16px 16px; }
  .o-chat-bottom { padding: 8px 12px 12px; }
  .o-greeting { padding: 24px 0; }
  .o-greeting-sub { margin-left: 0; }
  .o-suggest .chip:nth-child(n+5) { display: none; }
  .o-top { padding: 12px 16px; }
  .o-bubble { max-width: 86%; }
  .o-kind-row:not(.o-kind-row--me) { gap: 10px; }
}
/* narrow phones: nine targets at 38px fit 390px; settings is in the avatar's menu there */
@media (max-width: 430px) {
  .o-rail { gap: 2px; padding-inline: 6px; }
  .o-rail .o-nav, .o-rail-bottom { gap: 2px; }
  .o-rail .o-item-nav, .o-rail .o-rail-orb, .o-rail .o-avatar, .o-rail .iconbtn { width: 38px; height: 38px; }
  .o-rail .o-nav-sep, .o-rail-bottom .o-rail-settings { display: none; }
  .o-kind-orb, .o-kind-orb .logo { width: 22px; height: 22px; }
}
/* touch mode: the rail's own targets grow with the rest */
[data-touch] .o-item-nav, [data-touch] .o-topbar-button { min-width: var(--touch-target); min-height: var(--touch-target); }
[data-touch] .o-send { width: var(--touch-target); height: var(--touch-target); }
