/* =====================================================================================================================================
   SAVANNAH AI - SHELL V2. Loaded after design-system.css. Chat-first start, the cleaner sidebar, the account menu, the chat loading state and the live tool-activity shimmer.
   Palette: Deep Sage var(--sv-accent) and Warm Ivory var(--sv-text) join the locked neutrals; nothing else is introduced. Type: Noto Serif only (inherited). No emoji, no gradients except the
   two light sweeps below (they are the point of those components), no cards where a plain row will do.
   ===================================================================================================================================== */
:root { --c-deep-sage: var(--sv-accent); --c-warm-ivory: var(--sv-text); }
#main { position: relative; }

/* ---- sidebar: brand, small New chat, search, history; ONE round avatar at the bottom --------------------------------------------------------- */
.sidebar-brand .sidebar-tagline { display: none; }
.sidebar .chat-pane-new {
  width: auto !important; align-self: flex-start; min-height: 36px !important; padding: 0 14px !important; gap: 8px !important; font-size: var(--sv-type-subtitle-size);
  background: var(--c-warm-ivory) !important; color: var(--sv-app-bg) !important; border-radius: 999px !important;
}
.sidebar .chat-pane-new .sv-icon { --icon-size: 16px; }
.sidebar .chat-pane-searchwrap { margin: 10px 0 6px; }
.sidebar .chat-pane-org, .sidebar .sidebar-settings, .sidebar .sidebar-legal, .sidebar .sidebar-logout { display: none !important; }
.sidebar-account { flex: none; padding: 10px 4px 6px; margin-top: 6px; border-top: 1px solid var(--ds-line, rgba(var(--sv-text-rgb), .085)); }
.account-menu-wrap { position: relative; display: inline-block; }
.account-avatar {
  width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; overflow: hidden; position: relative; cursor: pointer;
  background: var(--c-graphite, var(--sv-elevated)); border: 1px solid var(--c-border, var(--sv-border)); color: var(--c-warm-ivory); font-size: var(--sv-type-body-size);
}
.account-avatar:hover { border-color: var(--c-deep-sage); }
.account-avatar:focus-visible { outline: 2px solid var(--c-warm-ivory); outline-offset: 3px; }
.account-avatar-content { display: grid; place-items: center; width: 100%; height: 100%; }
.account-avatar .sh-avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account-menu {
  position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 80; width: min(300px, calc(100vw - 32px)); padding: 8px; display: flex; flex-direction: column; gap: 2px;
  background: var(--c-graphite, var(--sv-elevated)); border: 1px solid var(--c-border, var(--sv-border)); border-radius: 16px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.account-menu[hidden] { display: none; }
.account-menu-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--ds-line, rgba(var(--sv-text-rgb), .085)); min-width: 0; }
.account-menu-name { color: var(--c-warm-ivory); font-size: var(--sv-type-body-secondary-size); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-email { color: var(--c-silver, var(--sv-text-2)); font-size: var(--sv-type-tool-description-size); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-workspace { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; color: var(--c-silver, var(--sv-text-2)); font-size: var(--sv-type-tool-label-size); min-height: 44px; }
.account-menu-label { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.account-menu-label .sv-icon { --icon-size: 16px; }
.account-menu-ws-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-warm-ivory); }
.account-menu-select { min-width: 0; max-width: 60%; min-height: 36px; background: transparent; color: var(--c-warm-ivory); border: 1px solid var(--c-border, var(--sv-border)); border-radius: 10px; padding: 0 8px; }
.account-menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 10px; background: transparent; border: 0; border-radius: 10px; color: var(--c-warm-ivory);
  cursor: pointer; text-align: left; font-size: var(--sv-type-subtitle-size);
}
.account-menu-item:hover, .account-menu-item:focus-visible { background: rgba(var(--sv-text-rgb), .08); outline: none; }
.account-menu-item .sv-icon { --icon-size: 18px; }
.account-menu-legal { padding: 4px 10px 2px; font-size: var(--sv-type-metadata-size); color: var(--c-grey, var(--sv-text-3)); }
.account-menu-legal a { color: inherit; }

/* ---- chat header: a New chat control that is always one tap away ---------------------------------------------------------------------------- */
.chat-header-new { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; background: transparent; border: 1px solid var(--ds-line, rgba(var(--sv-text-rgb), .085)); color: var(--c-warm-ivory); cursor: pointer; flex: none; }
.chat-header-new:hover { border-color: var(--c-deep-sage); }
.chat-header-new:focus-visible { outline: 2px solid var(--c-warm-ivory); outline-offset: 2px; }
.chat-header-new .sv-icon { --icon-size: 18px; }

/* ---- empty chat: the brand stays still, the short supporting line rotates ------------------------------------------------------------------- */
.chat-empty-tagline { transition: opacity .28s ease; letter-spacing: .16em; text-transform: uppercase; min-height: 1.4em; }
.chat-empty-tagline.is-swapping { opacity: 0; }
.chat-start-failure { display: grid; justify-items: center; gap: 12px; padding: 64px 16px; text-align: center; }

/* ---- chat loading: the logo with a soft light sweeping from right to left -------------------------------------------------------------------- */
.chat-loader { position: absolute; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--ds-bg, var(--sv-sidebar-bg)); }
.chat-loader-mark { position: relative; display: inline-block; width: 56px; height: 56px; }
.chat-loader-logo { display: block; width: 56px; height: 56px; object-fit: contain; opacity: .8; }
.chat-loader-sweep {
  position: absolute; inset: 0; background: linear-gradient(100deg, transparent 38%, rgba(var(--sv-text-rgb), .6) 50%, transparent 62%); background-size: 320% 100%; background-position: 0% 0;
  -webkit-mask-image: var(--logo); mask-image: var(--logo); -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center;
  animation: chat-loader-sweep 1.8s ease-in-out infinite;
}
@keyframes chat-loader-sweep { from { background-position: 0% 0; } to { background-position: 100% 0; } }   /* the light travels right to left */
.chat-loader-error { color: var(--c-silver, var(--sv-text-2)); margin: 0; }

/* ---- live tool activity: while a step is genuinely running, a soft light passes over its words from left to right ------------------------------
   Driven only by the state the server reports (data-status / data-state on the existing timeline); a finished, failed or stopped step never shimmers.         */
.tool-activity[data-state="running"] .tool-activity-summary-text,
.tool-activity-item[data-status="running"] .tool-activity-row-label {
  color: transparent; -webkit-text-fill-color: transparent;
  background-image: linear-gradient(90deg, var(--sv-text-3) 0%, var(--sv-text-3) 34%, rgba(var(--sv-accent-rgb), .85) 43%, var(--sv-text) 50%, rgba(var(--sv-accent-rgb), .85) 57%, var(--sv-text-3) 66%, var(--sv-text-3) 100%);
  background-size: 260% 100%; background-position: 100% 0; background-repeat: no-repeat;
  -webkit-background-clip: text; background-clip: text;
  animation: tool-shimmer 2.4s linear infinite;
}
@keyframes tool-shimmer { from { background-position: 100% 0; } to { background-position: 0% 0; } }              /* the light travels left to right */
.tool-activity-item[data-status="failed"] .tool-activity-row-label { background: none; -webkit-text-fill-color: currentColor; animation: none; }

@media (prefers-reduced-motion: reduce) {
  .chat-loader-sweep { animation: none; background: none; }
  .tool-activity[data-state="running"] .tool-activity-summary-text, .tool-activity-item[data-status="running"] .tool-activity-row-label { animation: none; background-image: none; color: var(--sv-text); -webkit-text-fill-color: var(--sv-text); }
  .chat-empty-tagline { transition: none; }
}

/* ---- composer on a phone: the controls wrap onto a second line instead of squeezing the model name to nothing ------------------------------------ */
@media (max-width: 480px) { .composer-bar-left { flex-wrap: wrap; row-gap: 8px; } }

/* ---- Back button on a screen reached from deeper inside Settings ---------------------------------------------------------------------------- */
.nav-back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 10px; margin: 0 0 10px; background: transparent; border: 1px solid var(--ds-line, rgba(var(--sv-text-rgb), .085)); border-radius: 999px; color: var(--c-warm-ivory); cursor: pointer; }
.nav-back:hover, .nav-back:focus-visible { border-color: var(--c-deep-sage); outline: none; }
.nav-back .sv-icon { --icon-size: 18px; }

/* No chat could be opened (for example a member who may not create general chats and has none yet): the menu button still reaches the chat list and the account menu. */
.chat-start-menu { position: absolute; top: calc(var(--space-3) + env(safe-area-inset-top, 0px)); left: calc(var(--space-3) + env(safe-area-inset-left, 0px)); z-index: 5; }
@media (min-width: 861px) { .chat-start-menu { display: none; } }
