/* COS 1.0 — CantinaOS desktop shell */
:root {
  --cos-bg: #060a12;
  --cos-glass: rgba(12, 18, 32, 0.72);
  --cos-glass-strong: rgba(8, 12, 22, 0.88);
  --cos-border: rgba(255, 255, 255, 0.12);
  --cos-border-hot: rgba(255, 64, 80, 0.55);
  --cos-red: #ff3b4e;
  --cos-red-dim: #c41e2e;
  --cos-cyan: #6ec8ff;
  --cos-text: #e8eef8;
  --cos-muted: #8b9bb4;
  --cos-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --cos-radius: 14px;
  --cos-dock-h: 88px;
  --cos-menubar-h: 36px;
  --cos-font: "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html.cos-ready, html.cos-ready body {
  height: 100%;
  overflow: hidden;
}

body.cos-desktop {
  margin: 0;
  font-family: var(--cos-font);
  color: var(--cos-text);
  background: var(--cos-bg);
}

/* Hide legacy shell chrome — content lives in windows */
body.cos-desktop .app-shell,
body.cos-desktop .skip-link,
body.cos-desktop .nav-backdrop,
body.cos-desktop .context-backdrop {
  display: none !important;
}

/* Keep room layers as wallpaper */
body.cos-desktop .room {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(4, 8, 16, 0.35), rgba(4, 8, 16, 0.72)),
    url("../chat/assets/city-bg.png?v=20260914-full") center / cover no-repeat;
  pointer-events: none;
}
body.cos-desktop .architecture {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.35;
}

/* —— Boot splash —— */
#cos-boot {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  background: radial-gradient(ellipse at 50% 30%, #141e32 0%, #05080f 70%);
  transition: opacity 0.55s ease, visibility 0.55s ease;
}
#cos-boot.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#cos-boot .cos-boot-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(145deg, #2a1018, #0c121c);
  border: 1px solid var(--cos-border-hot);
  box-shadow: 0 0 40px rgba(255, 59, 78, 0.35);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--cos-red);
}
#cos-boot h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#cos-boot p {
  margin: 0;
  color: var(--cos-muted);
  font-size: 0.9rem;
}
#cos-boot .cos-boot-bar {
  width: min(240px, 60vw);
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
#cos-boot .cos-boot-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--cos-red-dim), var(--cos-red));
  animation: cos-boot-load 1.1s ease forwards;
}
@keyframes cos-boot-load {
  to { width: 100%; }
}

/* —— Menu bar —— */
#cos-menubar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--cos-menubar-h);
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 14px;
  background: rgba(6, 10, 18, 0.65);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--cos-border);
  font-size: 0.78rem;
  user-select: none;
}
#cos-menubar {
  gap: 0.65rem;
}
.cos-apple-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}
.cos-apple-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  margin-left: -4px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #ff3b4e;
  cursor: pointer;
  filter: drop-shadow(0 0 6px rgba(255, 59, 78, 0.35));
}
.cos-apple-btn:hover,
.cos-apple-btn[aria-expanded="true"] {
  background: rgba(255, 59, 78, 0.16);
  color: #ff5a6a;
}
.cos-cup-icon {
  display: block;
}
.cos-menubar-title {
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  opacity: 0.9;
  margin-left: 2px;
}
.cos-apple-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  margin: 0;
  padding: 6px;
  list-style: none;
  z-index: 9500;
  background: rgba(22, 26, 36, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}
.cos-apple-menu[hidden] {
  display: none !important;
}
.cos-apple-menu li[role="menuitem"] {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--cos-text);
  font-size: 0.82rem;
  cursor: pointer;
  box-sizing: border-box;
}
.cos-apple-menu li[role="menuitem"]:hover,
.cos-apple-menu li[role="menuitem"]:focus {
  outline: none;
  background: rgba(255, 59, 78, 0.22);
}
.cos-apple-menu li[role="menuitem"] strong {
  font-weight: 650;
}
.cos-apple-sep {
  height: 1px;
  margin: 5px 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 0 !important;
  pointer-events: none;
}
#cos-menubar .cos-clock {
  margin-left: auto;
  color: var(--cos-muted);
  font-variant-numeric: tabular-nums;
}

/* —— Desktop —— */
#cos-desktop {
  position: fixed;
  inset: var(--cos-menubar-h) 0 var(--cos-dock-h) 0;
  z-index: 10;
  padding: 0;
  overflow: hidden;
}
.cos-icon {
  position: absolute;
  left: 16px;
  top: 16px;
  cursor: grab;
  touch-action: none;
}
.cos-icon.is-dragging {
  cursor: grabbing;
  z-index: 50;
  opacity: 0.92;
}

.cos-icon {
  width: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--cos-text);
  cursor: default;
  font: inherit;
  text-align: center;
  user-select: none;
}
.cos-icon:hover, .cos-icon:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}
.cos-icon.is-selected {
  background: rgba(255, 59, 78, 0.22);
}
.cos-icon-glyph {
  width: 72px;
  height: 64px;
  border-radius: 0;
  display: grid;
  place-items: center;
  font-size: 3rem;
  line-height: 1;
  background: transparent;
  border: 0;
  box-shadow: none;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}
.cos-icon[data-app="chat"] .cos-icon-glyph {
  border: 0;
  box-shadow: none;
  filter: drop-shadow(0 0 12px rgba(255, 59, 78, 0.35)) drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
}
.cos-icon-glyph.cos-folder-glyph {
  font-size: 3.15rem;
}
.cos-icon-label {
  font-size: 0.8rem;
  line-height: 1.25;
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-shadow: 0 1px 4px rgba(0,0,0,.9), 0 0 8px rgba(0,0,0,.5);
}

/* —— Windows —— */
#cos-windows {
  position: fixed;
  inset: var(--cos-menubar-h) 0 var(--cos-dock-h) 0;
  z-index: 100;
  pointer-events: none;
}
.cos-window {
  position: absolute;
  min-width: 280px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  background: var(--cos-glass-strong);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid var(--cos-border);
  border-radius: var(--cos-radius);
  box-shadow: var(--cos-shadow);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.96) translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.cos-window.is-open {
  opacity: 1;
  transform: none;
}

/* Chat must not sit at opacity:0 waiting for a second tap/paint */
#win-chat.cos-window {
  opacity: 1;
  transform: none;
  transition: none;
}
#win-chat .cos-window-body,
#win-chat .cos-chat-mount,
#win-chat #view-chat.cos-in-window {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.cos-window.is-focused {
  border-color: rgba(255, 100, 110, 0.45);
  box-shadow: var(--cos-shadow), 0 0 0 1px rgba(255, 59, 78, 0.15);
}
.cos-titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--cos-border);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.cos-titlebar:active { cursor: grabbing; }
.cos-traffic {
  display: flex;
  gap: 7px;
}
.cos-traffic button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.cos-btn-close { background: #ff5f57; }
.cos-btn-min { background: #febc2e; }
.cos-btn-max { background: #28c840; }
.cos-traffic button:hover { filter: brightness(1.1); }
.cos-title {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cos-title-badge {
  font-size: 0.65rem;
  color: var(--cos-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cos-window-body {
  flex: 1;
  overflow: auto;
  position: relative;
  min-height: 0;
}
.cos-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.25) 50%);
  border-bottom-right-radius: var(--cos-radius);
}

/* Chat window: rehome legacy chat UI pieces */
#win-chat .cos-window-body {
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow: hidden;
  padding: 0;
}
#win-chat .cos-chat-mount {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
/* Minimal COS Chat — familiar, not ChatGPT-bloated */
body.cos-desktop #view-chat.cos-in-window {
  display: flex !important;
  flex-direction: column;
  /* flex:1 not height:100% — % height collapses on iOS when parent is flex-only */
  flex: 1 1 auto;
  align-self: stretch;
  width: 100%;
  min-height: 0;
  height: auto;
  overflow: hidden;
  background: rgba(6, 10, 18, 0.55);
}
/* Parked #view-chat must not paint (home host is clipped; never force flex when hidden) */
body.cos-desktop #view-chat.cos-in-window[hidden],
body.cos-desktop #cos-chat-home #view-chat[hidden] {
  display: none !important;
}

/* Hide cinematic chrome inside the chat window */
#win-chat .hero,
#win-chat .telemetry,
#win-chat .hero-manifesto,
#win-chat .levi-visual,
#win-chat .levi-caption,
#win-chat .workspace-signature,
#win-chat .prompt-shortcuts,
#win-chat .context-rail,
#win-chat .context-toggle,
#win-chat .chat-privacy,
#win-chat .architecture,
#win-chat .page-footer {
  display: none !important;
}

#win-chat .cos-chat-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}
#win-chat .cos-chat-status .connection {
  font-size: 11px;
  letter-spacing: 0.08em;
}
#win-chat .quota-panel {
  font-size: 11px;
  opacity: 0.85;
}

#win-chat .conversation-stack {
  flex: 1 1 auto;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: none;
}
#win-chat .welcome {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
}
#win-chat #chatOutput[hidden],
#win-chat .chat-output[hidden] {
  display: none !important;
  flex: 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}

#win-chat .welcome {
  margin: 24px auto 8px;
  max-width: 420px;
  min-height: 0;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  gap: 10px;
  flex-shrink: 0;
}
#win-chat .welcome .message-avatar {
  width: 36px;
  height: 36px;
}
#win-chat .welcome h2 {
  font-size: 15px;
  margin: 0 0 4px;
  font-weight: 560;
}
#win-chat .welcome p {
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  color: rgba(220, 230, 240, 0.75);
}

/* moved: chat-output display only when :not([hidden]) — see below */


/* WhatsApp-style: LEVI left, you right */
#win-chat .message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 78%;
  width: fit-content;
  align-self: flex-start;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  font-size: 14px;
  line-height: 1.45;
  position: relative;
}
#win-chat .message .message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-bottom: 2px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}
#win-chat .message-content {
  min-width: 0;
  padding: 8px 11px 9px;
  border-radius: 14px 14px 14px 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
#win-chat .message-heading {
  display: none; /* clean chat bubbles — no DU/LEVI chrome */
}
#win-chat .message-body {
  white-space: pre-wrap;
  line-height: 1.45;
  color: rgba(236, 242, 248, 0.95);
}
#win-chat .message .copy-message {
  opacity: 0;
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 0;
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}
#win-chat .message:hover .copy-message {
  opacity: 1;
}

#win-chat .message.is-user {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: 78%;
  background: transparent;
  border: 0;
}
#win-chat .message.is-user .message-content {
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(145deg, rgba(180, 36, 58, 0.72), rgba(110, 22, 40, 0.82));
  border: 1px solid rgba(255, 90, 110, 0.35);
  box-shadow: 0 4px 16px rgba(160, 20, 45, 0.25);
}
#win-chat .message.is-user .message-body {
  color: #fff;
}
#win-chat .message.is-error .message-content {
  background: rgba(80, 24, 28, 0.85);
  border-color: rgba(255, 120, 90, 0.4);
}
#win-chat .message.is-pending .message-content {
  opacity: 0.85;
}
#win-chat .conversation-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 4px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  background: transparent;
}
#win-chat .conversation-actions[hidden] {
  display: none !important;
}
#win-chat .conversation-actions button {
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(230, 236, 242, 0.85);
  cursor: pointer;
}
#win-chat .conversation-actions button:hover {
  background: rgba(255, 59, 78, 0.15);
  border-color: rgba(255, 59, 78, 0.35);
}

#win-chat #chatForm,
#win-chat .composer-wrap,
#win-chat form#chatForm {
  margin: 0;
  /* composer is a direct child of #view-chat — always visible at bottom */
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
  flex-shrink: 0;
}
#win-chat .composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
#win-chat .composer-plus,
#win-chat .composer-wave,
#win-chat .speech-toggle {
  display: none !important;
}
#win-chat .input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 4px;
}
#win-chat #prompt {
  width: 100%;
  border: 0;
  background: transparent;
  color: #eef3f8;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  outline: none;
  min-height: 22px;
  max-height: 120px;
}
#win-chat #prompt::placeholder {
  color: rgba(200, 210, 220, 0.45);
}
#win-chat #chatForm,
#win-chat form#chatForm {
  /* Keep send arrow clear of the 16×16 window resize grip (bottom-right). */
  padding: 10px 22px 18px 12px;
}
#win-chat #sendButton {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 74, 92, 0.45);
  background: rgba(180, 28, 48, 0.45);
  color: #fff;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  cursor: pointer;
}
#win-chat #sendButton .icon,
#win-chat #sendButton svg {
  pointer-events: none;
}
/* Chat: resize grip stays usable on the edge, but below the send control. */
#win-chat > .cos-resize {
  z-index: 1;
  width: 14px;
  height: 14px;
}

/* iOS Safari: backdrop-filter on the window often leaves the body unpainted until a tap */
#win-chat.cos-window {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(12, 16, 28, 0.94);
}
#win-chat .cos-window-body,
#win-chat .cos-chat-mount,
#win-chat #view-chat.cos-in-window,
#win-chat .conversation-stack,
#win-chat .welcome,
#win-chat #chatForm {
  opacity: 1 !important;
  visibility: visible !important;
  -webkit-transform: none;
  transform: none;
  content-visibility: visible !important;
}
#win-chat .welcome,
#win-chat .welcome.glass {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}
/* Author display:flex must not win over [hidden]; also kill levi.css min-height:260px void */
#win-chat .chat-output {
  display: none;
  flex: 0;
  min-height: 0 !important;
  max-height: none;
}
#win-chat .chat-output:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  min-height: 0 !important;
  overflow: auto;
  padding: 14px 12px 10px;
  gap: 8px;
  flex-direction: column;
  background:
    radial-gradient(ellipse at top, rgba(255, 59, 78, 0.04), transparent 55%),
    rgba(0, 0, 0, 0.12);
}


/* Content panels in windows */
.cos-panel {
  padding: 1.25rem 1.5rem 2rem;
}
.cos-panel .section-kicker {
  color: var(--cos-red);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  margin: 0 0 0.35rem;
}
.cos-panel h1 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}
.cos-panel .section-lead {
  color: var(--cos-muted);
  margin: 0 0 1.25rem;
}
.cos-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.cos-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--cos-border);
  border-radius: 12px;
  padding: 1rem;
}
.cos-card.accent {
  border-color: rgba(255, 59, 78, 0.4);
  background: rgba(255, 59, 78, 0.08);
}
.cos-card h2 { margin: 0 0 0.5rem; font-size: 1rem; }
.cos-card p, .cos-card ul { margin: 0; color: var(--cos-muted); font-size: 0.88rem; }
.cos-card a, .cos-cta {
  color: var(--cos-cyan);
  text-decoration: none;
}
.cos-cta-btn {
  margin-top: 0.75rem;
  background: rgba(255, 59, 78, 0.15);
  border: 1px solid rgba(255, 59, 78, 0.4);
  color: var(--cos-text);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font: inherit;
}
.cos-cta-btn:hover { background: rgba(255, 59, 78, 0.28); }
.cos-note { margin-top: 1rem; color: var(--cos-muted); font-size: 0.85rem; }

/* Toolbar for file apps */
.cos-window-body:has(.cos-finder) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.cos-finder {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  flex: 1;
}
.cos-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--cos-border);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  z-index: 2;
}
.cos-toolbar button {
  font: inherit;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--cos-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--cos-text);
  padding: 5px 10px;
  cursor: pointer;
}
.cos-toolbar button:hover:not(:disabled) {
  border-color: rgba(255, 59, 78, 0.5);
  background: rgba(255, 59, 78, 0.12);
}
.cos-toolbar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.cos-finder-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}
.cos-statusbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border-top: 1px solid var(--cos-border);
  background: rgba(0, 0, 0, 0.28);
  font-size: 0.72rem;
  color: var(--cos-muted);
  min-height: 28px;
}
.cos-statusbar .cos-path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
  font-variant-numeric: tabular-nums;
}
.cos-statusbar .cos-status-meta {
  flex-shrink: 0;
  opacity: 0.85;
}
.cos-readonly-badge {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cos-red);
  border: 1px solid rgba(255, 59, 78, 0.35);
  border-radius: 999px;
  padding: 3px 8px;
  align-self: center;
}

.cos-file-cols {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 78px 132px;
  gap: 8px;
  padding: 6px 12px 4px;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cos-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
}
.cos-file-cols span:nth-child(3),
.cos-file-cols span:nth-child(4) {
  text-align: right;
}
.cos-file-list {
  list-style: none;
  margin: 0;
  padding: 4px 6px 8px;
}
.cos-file-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 78px 132px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}
.cos-file-list li:hover, .cos-file-list li.is-selected {
  background: rgba(255, 255, 255, 0.07);
}
.cos-file-list li.is-selected {
  background: rgba(70, 130, 255, 0.22);
  outline: 1px solid rgba(140, 180, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(140, 180, 255, 0.25);
}
.cos-file-list .cos-file-icon {
  text-align: center;
  font-size: 1rem;
  line-height: 1;
}
.cos-file-list .cos-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cos-file-list .cos-file-size,
.cos-file-list .cos-file-date {
  color: var(--cos-muted);
  font-size: 0.75rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cos-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--cos-muted);
}
.cos-empty strong { display: block; color: var(--cos-text); margin-bottom: 0.35rem; }

.cos-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 240px;
}
.cos-editor textarea {
  flex: 1;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--cos-text);
  font: 0.9rem/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  padding: 12px 14px;
  outline: none;
  min-height: 200px;
}
.cos-viewer pre {
  margin: 0;
  padding: 14px 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.88rem/1.45 ui-monospace, Menlo, Consolas, monospace;
  color: var(--cos-text);
}

/* Calculator */
.cos-calc {
  max-width: 320px;
  margin: 0 auto;
  padding: 14px 16px 16px;
  box-sizing: border-box;
}
.cos-calc-display {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--cos-border);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: right;
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: 10px;
  min-height: 1.4em;
  overflow: hidden;
}
.cos-calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.cos-calc-grid button {
  border: 1px solid var(--cos-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--cos-text);
  border-radius: 10px;
  padding: 12px 0;
  font: inherit;
  font-size: 1.05rem;
  cursor: pointer;
}
.cos-calc-grid button:hover { background: rgba(255, 59, 78, 0.2); }
.cos-calc-grid button.op { color: var(--cos-red); }
.cos-calc-grid button.eq {
  background: rgba(255, 59, 78, 0.35);
  border-color: rgba(255, 59, 78, 0.5);
  grid-column: span 2;
}

/* Game */
.cos-game-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 320px;
}
.cos-game-hud {
  display: flex;
  gap: 1rem;
  padding: 8px 12px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--cos-border);
  background: rgba(0,0,0,0.25);
}
.cos-game-hud strong { color: var(--cos-red); }
#kantine-catch {
  flex: 1;
  width: 100%;
  display: block;
  background: linear-gradient(180deg, #0a1220 0%, #152238 60%, #1a2838 100%);
  cursor: none;
}
.cos-game-hint {
  padding: 6px 12px;
  font-size: 0.75rem;
  color: var(--cos-muted);
  border-top: 1px solid var(--cos-border);
}

/* Dock */
#cos-dock {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 4px 10px 6px;
  background: rgba(10, 14, 24, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--cos-border);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  max-width: calc(100vw - 16px);
  overflow: hidden;
}
#cos-dock {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#cos-dock::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.cos-dock-item {
  position: relative;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--cos-text);
  cursor: pointer;
  font-size: 2.55rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
  padding: 0;
}
.cos-dock-item:hover {
  transform: translateY(-8px) scale(1.14);
  background: transparent;
}
.cos-dock-item.is-open::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cos-red);
  transform: translateX(-50%);
}
.cos-dock-item.is-open.is-minimized::after {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--cos-red);
}
.cos-dock-item[title]:hover::before {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}
.cos-dock-sep {
  width: 1px;
  height: 48px;
  margin: 0 4px;
  align-self: center;
  background: rgba(255, 255, 255, 0.18);
}

/* Toast reuse */
body.cos-desktop #toast {
  z-index: 9500;
  bottom: 90px;
}

/* Templates host (offscreen) */
#cos-templates {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 720px) {
  :root {
    --cos-dock-h: 78px;
    --cos-menubar-h: 36px;
  }
  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  #cos-desktop {
    padding: 10px 6px;
    padding-left: max(6px, env(safe-area-inset-left));
    padding-right: max(6px, env(safe-area-inset-right));
  }
  /* Desktop-Icons: Größe wie bisher belassen (User: okay so) */
  .cos-window {
    border-radius: 12px;
    min-width: 0 !important;
    max-width: calc(100vw - 12px);
  }
  .cos-titlebar { height: 44px; }
  .cos-traffic button {
    width: 14px;
    height: 14px;
  }
  #cos-dock {
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .cos-file-list li {
    min-height: 44px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .cos-toolbar button {
    min-height: 36px;
    padding: 6px 10px;
  }
  #win-chat .hero { max-height: 100px; transform: scale(0.55); }
  .cos-login-panel { width: min(92vw, 360px); }
}

@media (hover: none) and (pointer: coarse) {
  .cos-icon, .cos-dock-item, .cos-file-list li, .cos-toolbar button {
    -webkit-tap-highlight-color: rgba(255, 59, 78, 0.2);
    touch-action: manipulation;
  }
  #cos-desktop, .cos-finder-body {
    touch-action: pan-y;
  }
}

/* —— COS Context Menu —— */
#cos-ctx {
  position: fixed;
  z-index: 12000;
  min-width: 200px;
  max-width: 280px;
  padding: 6px;
  margin: 0;
  list-style: none;
  background: rgba(14, 18, 28, 0.94);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 59, 78, 0.12);
  display: none;
  user-select: none;
}
#cos-ctx.is-open { display: block; }
#cos-ctx li {
  margin: 0;
  padding: 0;
}
#cos-ctx button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--cos-text);
  font: inherit;
  font-size: 0.82rem;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
#cos-ctx button:hover,
#cos-ctx button:focus-visible {
  background: rgba(255, 59, 78, 0.22);
  outline: none;
}
#cos-ctx button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
#cos-ctx button:disabled:hover { background: transparent; }
#cos-ctx .cos-ctx-sep {
  height: 1px;
  margin: 5px 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 0;
  pointer-events: none;
}
#cos-ctx .cos-ctx-kbd {
  margin-left: auto;
  color: var(--cos-muted);
  font-size: 0.7rem;
}
.cos-icon-server .cos-icon-glyph {
  border-style: dashed;
}

/* Chat status bar inside window */
.cos-chat-status .quota-panel { margin: 0; }
.cos-chat-status .connection { font-size: 0.72rem; }
#win-chat .prompt-shortcuts { flex-wrap: wrap; }
#win-chat .shortcut { font-size: 0.75rem; }
#win-chat .composer { margin-top: 8px; }
#win-chat .chat-privacy { font-size: 0.72rem; opacity: 0.85; }
body.cos-desktop #cos-chat-home:not(:has(#view-chat)) { display: none; }
body.cos-desktop #cos-chat-home { position: absolute; width: 0; height: 0; overflow: hidden; clip: rect(0,0,0,0); }


/* APPS folder window */
.cos-apps-folder {
  padding: 18px 14px !important;
  overflow: auto;
}
.cos-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px 8px;
  justify-items: center;
}
.cos-apps-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 108px;
  padding: 8px 4px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: #e8eef6;
  cursor: pointer;
  font: inherit;
  backdrop-filter: none;
}
.cos-apps-tile:hover,
.cos-apps-tile:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  box-shadow: none;
  border: 0;
}
.cos-apps-tile-glyph {
  font-size: 2.75rem;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}
.cos-apps-tile span:last-child {
  font-size: 0.78rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}


/* OS chrome already has close — hide legacy panel X */
.cos-window .section-close {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}


/* —— Login (macOS-style) —— */
body.cos-locked #cos-menubar,
body.cos-locked #cos-dock,
body.cos-locked #cos-windows {
  visibility: hidden !important;
  pointer-events: none !important;
}
body.cos-locked #cos-desktop {
  pointer-events: none;
  filter: blur(14px) saturate(1.05) brightness(0.72);
  transform: scale(1.02);
}
#cos-login {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}
#cos-login[hidden] {
  display: flex !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#cos-login.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.cos-login-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 8, 16, 0.45), rgba(4, 8, 16, 0.78)),
    url("../chat/assets/city-bg.png?v=20260914-full") center / cover no-repeat;
  filter: blur(2px);
  transform: scale(1.04);
}
.cos-login-panel {
  position: relative;
  z-index: 1;
  width: min(360px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 28px 26px 24px;
  border-radius: 22px;
  background: rgba(12, 16, 26, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(28px) saturate(1.2);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
}
.cos-login-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ff3b4e;
  background: radial-gradient(circle at 35% 30%, rgba(255, 80, 100, 0.25), rgba(10, 14, 22, 0.95));
  border: 1px solid rgba(255, 59, 78, 0.45);
  box-shadow: 0 0 40px rgba(255, 59, 78, 0.28);
  margin-bottom: 4px;
}
.cos-login-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.cos-login-sub {
  margin: 0 0 8px;
  color: var(--cos-muted);
  font-size: 0.82rem;
}
.cos-login-guest {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.cos-login-guest:hover {
  background: rgba(255, 59, 78, 0.16);
  border-color: rgba(255, 74, 92, 0.45);
  transform: translateY(-1px);
}
.cos-login-guest-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.35rem;
  flex-shrink: 0;
}
.cos-login-guest-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.cos-login-guest-text strong {
  font-size: 0.95rem;
}
.cos-login-guest-text small {
  color: var(--cos-muted);
  font-size: 0.75rem;
}
.cos-login-guest-go {
  color: var(--cos-muted);
  font-size: 1.1rem;
}
.cos-login-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 2px;
  color: var(--cos-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cos-login-divider::before,
.cos-login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}
.cos-login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}
.cos-login-form input {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.28);
  color: #eef3f8;
  font: inherit;
  font-size: 0.9rem;
  padding: 10px 12px;
  outline: none;
}
.cos-login-form input:focus {
  border-color: rgba(255, 74, 92, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 59, 78, 0.15);
}
.cos-login-submit {
  margin-top: 2px;
  border: 1px solid rgba(255, 74, 92, 0.45);
  border-radius: 10px;
  background: rgba(180, 28, 48, 0.45);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 10px 12px;
  cursor: pointer;
}
.cos-login-submit:hover {
  background: rgba(200, 36, 56, 0.6);
}
.cos-login-hint {
  margin: 2px 0 0;
  color: #ff8a96;
  font-size: 0.78rem;
}
.cos-login-form.is-shake {
  animation: cos-login-shake 0.45s ease;
}
@keyframes cos-login-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.cos-login-clock {
  position: absolute;
  top: 28px;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 1;
  font-size: 3rem;
  font-weight: 200;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}


.cos-icon.is-drop-target {
  background: rgba(255, 59, 78, 0.28) !important;
  outline: 2px solid rgba(255, 90, 110, 0.7);
  outline-offset: 2px;
}
.cos-file-list li.is-drop-target {
  background: rgba(255, 59, 78, 0.22) !important;
  outline: 1px solid rgba(255, 90, 110, 0.55);
}


/* —— COS Dialog (replaces browser prompt) —— */
.cos-dialog {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cos-dialog[hidden] { display: none !important; }
.cos-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cos-dialog-card {
  position: relative;
  z-index: 1;
  width: min(400px, calc(100vw - 32px));
  padding: 20px 20px 16px;
  border-radius: 18px;
  background: rgba(16, 20, 32, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  color: var(--cos-text);
}
.cos-dialog-title { margin: 0 0 10px; font-size: 1.05rem; font-weight: 650; }
.cos-dialog-message {
  margin: 0 0 14px;
  color: var(--cos-muted);
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.cos-dialog-label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.75rem;
  color: var(--cos-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cos-dialog-input {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.32);
  color: #eef3f8;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
}
.cos-dialog-input:focus {
  border-color: rgba(255, 74, 92, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 59, 78, 0.15);
}
.cos-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.cos-dialog-btn {
  font: inherit;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--cos-text);
  cursor: pointer;
}
.cos-dialog-btn:hover { background: rgba(255, 255, 255, 0.1); }
.cos-dialog-btn-primary {
  border-color: rgba(255, 74, 92, 0.5);
  background: rgba(180, 28, 48, 0.5);
  color: #fff;
  font-weight: 600;
}
.cos-dialog-btn-primary:hover { background: rgba(200, 36, 56, 0.65); }


.cos-window.is-drop-target,
.cos-finder-body.is-drop-target {
  outline: 2px solid rgba(255, 90, 110, 0.75);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 9999px rgba(255, 59, 78, 0.08);
}
.cos-icon.is-dragging {
  z-index: 5000 !important;
  opacity: 0.95;
}


.cos-file-list li.is-dragging-row {
  opacity: 0.55;
}
#cos-desktop.is-drop-target {
  outline: 2px dashed rgba(255, 90, 110, 0.55);
  outline-offset: -6px;
}


/* FS drop layer: visual only — never steal hits from desktop icons */
#cos-fs-drop-layer {
  position: fixed;
  inset: var(--cos-menubar-h) 0 var(--cos-dock-h) 0;
  z-index: 50;
  display: none;
  pointer-events: none !important;
}
#cos-fs-drop-layer.is-active {
  display: block;
}
#cos-fs-drop-layer.is-drop-target {
  outline: 2px dashed rgba(255, 90, 110, 0.55);
  outline-offset: -6px;
  background: rgba(255, 59, 78, 0.06);
}


.cos-drag-ghost {
  position: fixed;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(20, 24, 36, 0.92);
  border: 1px solid rgba(255, 90, 110, 0.45);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  max-width: 240px;
  color: #fff;
  font-size: 0.85rem;
}
.cos-drag-ghost-icon { font-size: 1.25rem; }
.cos-drag-ghost-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cos-file-list li.is-dragging-row { opacity: 0.45; }


/* While moving files: no browser text selection (Safari marks everything red otherwise) */
body.cos-fs-dragging,
body.cos-fs-dragging * {
  user-select: none !important;
  -webkit-user-select: none !important;
  cursor: grabbing !important;
}
#cos-desktop,
.cos-file-list,
.cos-icon,
.cos-finder {
  -webkit-user-select: none;
  user-select: none;
}


/* APPS launcher — same glyph size as other desktop icons (3rem), unique mark */
.cos-icon-apps .cos-icon-glyph {
  filter: drop-shadow(0 0 12px rgba(255, 70, 90, 0.5));
}


.cos-dock-item
.cos-dock-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35em;
  height: 1.35em;
  line-height: 1;
  font-size: 1.35em;
  pointer-events: none;
}
.cos-dock-glyph svg {
  width: 1em;
  height: 1em;
  display: block;
}
.cos-dock-window.is-minimized {
  opacity: 0.85;
}

#win-chat #view-chat.cos-in-window > #chatForm,
body.cos-desktop #view-chat.cos-in-window > #chatForm {
  flex: 0 0 auto;
  width: 100%;
  margin-top: 0;
}


/* mockup.css hides stack/form on data-site-view=home — COS chat window must win */
body.cos-desktop #win-chat .conversation-stack {
  display: flex !important;
}
body.cos-desktop #win-chat #chatForm {
  display: block !important;
}
body.cos-desktop #win-chat .welcome {
  display: flex !important;
}


/* Compact composer after session restore — ignore leftover huge inline heights */
#win-chat #prompt {
  max-height: 96px !important;
  line-height: 1.4;
  overflow-y: auto;
}
/* Empty composer: beat leftover inline height from pre-restore autoSize */
#win-chat #prompt:placeholder-shown {
  height: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;
}
#win-chat .composer {
  align-items: center;
  min-height: 0;
}
#win-chat .input-wrapper {
  align-items: center;
  min-height: 36px;
}
#win-chat #sendButton {
  align-self: center;
}


/* No sticky welcome card in COS chat — intro is a normal message bubble */
#win-chat #welcomeMessage,
#win-chat .welcome {
  display: none !important;
}
#win-chat #chatOutput:not([hidden]),
#win-chat #chatOutput {
  /* keep transcript visible for intro blob even before first user message */
}




#win-chat .message.is-system {
  align-self: center !important;
  max-width: 94%;
  width: fit-content;
  margin: 8px auto !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#win-chat .message.is-system .message-body {
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
  color: #8ec8f0;
  background: rgba(40, 110, 170, 0.2);
  border: 1px solid rgba(100, 180, 240, 0.38);
  border-radius: 999px;
  padding: 6px 14px;
}
#win-chat .message.is-system .message-avatar,
#win-chat .message.is-system .message-content,
#win-chat .message.is-system .message-heading {
  display: none !important;
}


/* Alias / shortcut badge (macOS-like arrow on Desktop icons) */
.cos-icon-link .cos-icon-glyph {
  position: relative;
}
.cos-link-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 0.55em;
  line-height: 1;
  background: rgba(20, 40, 80, 0.85);
  color: #9ec5ff;
  border-radius: 4px;
  padding: 1px 3px;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.cos-file-list li[data-type="link"] .cos-file-name {
  color: #9ec5ff;
}


/* —— Volumes / Computer —— */
.cos-volume-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}
.cos-volume-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(140, 170, 255, 0.28);
  background: linear-gradient(160deg, rgba(30, 40, 70, 0.75), rgba(12, 16, 28, 0.9));
  color: inherit;
  cursor: pointer;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.cos-volume-card:hover {
  border-color: rgba(120, 180, 255, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 40, 120, 0.35);
}
.cos-volume-glyph {
  font-size: 42px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
}
.cos-volume-glyph-hdd .cos-hdd-glyph,
.cos-volume-glyph .cos-hdd-glyph {
  width: 48px;
  height: 48px;
}
.cos-volume-name {
  font-weight: 700;
  font-size: 15px;
}
.cos-volume-meta {
  font-size: 12px;
  opacity: 0.75;
  line-height: 1.35;
}

/* HDD glyph in desktop / dock icons */
.cos-icon-glyph .cos-hdd-glyph,
.cos-dock-icon .cos-hdd-glyph {
  width: 1.15em;
  height: 1.15em;
  display: block;
}

/* Shortcut / alias badge — clear blue arrow bottom-right */
.cos-icon-link {
  position: relative;
}
.cos-icon-link .cos-icon-glyph {
  position: relative;
  display: inline-block;
}
.cos-link-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  color: #fff;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  border: 1.5px solid rgba(255,255,255,0.85);
  box-shadow: 0 2px 6px rgba(0, 40, 120, 0.55);
  pointer-events: none;
  z-index: 2;
}
.cos-file-list li[data-type="link"] .cos-file-name,
.cos-file-row[data-type="link"] .cos-file-name {
  color: #9ec5ff;
}




/* —— Computer: compact icon window —— */
.cos-computer-body {
  padding: 8px 10px 12px !important;
}
.cos-computer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
}
.cos-computer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: rgba(8, 12, 24, 0.4);
  border: 1px solid rgba(120, 150, 220, 0.18);
  flex-shrink: 0;
}
.cos-computer-tab {
  flex: 1 1 auto;
  min-width: 64px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(220, 230, 255, 0.7);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.cos-computer-tab:hover {
  color: #fff;
  background: rgba(80, 120, 220, 0.16);
}
.cos-computer-tab.is-active {
  color: #fff;
  background: rgba(70, 120, 255, 0.4);
}
.cos-computer-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.cos-computer-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  align-content: flex-start;
  padding: 4px 2px;
}
.cos-computer-icon {
  width: 88px;
  padding: 8px 4px 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font: inherit;
}
.cos-computer-icon:hover,
.cos-computer-icon:focus-visible {
  background: rgba(90, 140, 255, 0.22);
  outline: none;
}
.cos-computer-icon-glyph {
  font-size: 36px;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cos-computer-icon-glyph .cos-hdd-glyph {
  width: 40px;
  height: 40px;
}
.cos-computer-icon-label {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
  word-break: break-word;
}
.cos-computer-facts {
  list-style: none;
  margin: 8px 4px 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.55;
  opacity: 0.85;
}
.cos-computer-facts li {
  padding: 2px 0;
}


/* Desktop marquee multi-select */
.cos-marquee {
  position: absolute;
  z-index: 40;
  pointer-events: none;
  border: 1px solid rgba(120, 180, 255, 0.95);
  background: rgba(80, 140, 255, 0.18);
  border-radius: 2px;
  box-sizing: border-box;
}
.cos-icon.is-selected {
  background: rgba(70, 130, 255, 0.28) !important;
  box-shadow: inset 0 0 0 1px rgba(140, 180, 255, 0.45);
}
.cos-icon.is-drag-primary::after {
  content: attr(data-drag-count);
}
/* keep position:fixed + inset from main rule — only add selection lock */
#cos-desktop {
  user-select: none;
  -webkit-user-select: none;
}
