/* SYC main panel. Same visual language as the Claude panel: dark, brand mark
   behind everything, one accent. */

/* The very same face the Claude console loads, from the very same URL, so a
   reply reads identically in both places. */
@font-face {
  font-family: "Vazirmatn";
  src: url("/assets/vazirmatn-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("/assets/vazirmatn-semibold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
}

/* Users panel themes only: each theme gets a face of its own, not just a
   different weight, so girly/skeleton/super-dark read as different rooms
   rather than the same page recoloured. --theme-font (set by theme.js) picks
   between these and Vazirmatn, which stays the "light" theme's face. */
@font-face {
  font-family: "Lalezar";
  src: url("/assets/lalezar-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Reem Kufi";
  src: url("/assets/reemkufi-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Reem Kufi";
  src: url("/assets/reemkufi-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
}
@font-face {
  font-family: "Aref Ruqaa";
  src: url("/assets/arefruqaa-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Aref Ruqaa";
  src: url("/assets/arefruqaa-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
}

:root {
  --bg: #080c16;
  --panel: rgba(24, 31, 50, 0.9);
  --border: rgba(255, 255, 255, 0.09);
  --text: #eef1f8;
  --muted: #9ba5b9;
  --accent: #8b7cf8;
  --accent-2: #5ad7c5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--theme-font, "Vazirmatn"), system-ui, sans-serif;
  /* The photographs live in .theme-backdrop; the body only holds the base
     colour, so the pages that never load a theme still look right. */
  background: var(--bg);
  transition: background 1.2s ease, color .3s ease;
  -webkit-font-smoothing: antialiased;
}

.ambient {
  position: fixed;
  inset: -30% -10% auto -10%;
  height: 70vh;
  z-index: 0;
  background: radial-gradient(closest-side, rgba(139, 124, 248, 0.16), transparent 70%);
  pointer-events: none;
}

.watermark {
  position: fixed;
  inset: 12% 20%;
  z-index: 0;
  background: url("/syc-logo.jpg") center / min(46vw, 520px) no-repeat;
  opacity: 0.16;
  -webkit-mask-image: radial-gradient(circle at center, #000 42%, transparent 76%);
  mask-image: radial-gradient(circle at center, #000 42%, transparent 76%);
  pointer-events: none;
}

/* --- Login ---------------------------------------------------------------- */

.login-body {
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(380px, 100%);
  padding: 34px 30px;
  text-align: center;
  background: linear-gradient(145deg, rgba(24, 31, 50, 0.96), rgba(15, 21, 36, 0.96));
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

.brand-orb {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin: 0 auto 14px;
  color: #c6bdff;
  background: linear-gradient(145deg, rgba(139, 124, 248, 0.22), rgba(90, 215, 197, 0.1));
  border: 1px solid rgba(165, 151, 255, 0.28);
  border-radius: 50%;
  position: relative;
}

/* One bright point runs the rim when the page appears. */
.brand-orb::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 2;
  border-radius: inherit;
  background: conic-gradient(from 0deg, transparent 300deg,
    rgba(139, 124, 248, 0.55) 342deg, #fff 355deg, rgba(139, 124, 248, 0.5) 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  animation: sweep 2.4s cubic-bezier(0.33, 0, 0.2, 1) 1 both;
}

@keyframes sweep { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.brand-orb.small { width: 40px; height: 40px; margin: 0; }

.brand-orb svg {
  position: relative;
  z-index: 3;
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.brand-orb.small svg { width: 20px; height: 20px; }

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 3px;
}

.login-card h1 { margin: 6px 0 20px; font-size: 19px; }

label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

input, select, textarea {
  width: 100%;
  margin-top: 5px;
  padding: 11px 12px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  background: rgba(8, 12, 22, 0.72);
  border: 1px solid var(--border);
  border-radius: 11px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(139, 124, 248, 0.55);
}

button {
  padding: 11px 16px;
  color: #140f2e;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  transition: transform 90ms ease, opacity 140ms ease;
}

button:active { transform: scale(0.97); }
button:disabled { opacity: 0.6; cursor: default; }

.login-card button { width: 100%; margin-top: 6px; }

.login-card small {
  display: block;
  margin-top: 12px;
  min-height: 16px;
  color: #e0645f;
  font-size: 11.5px;
}

button.ghost {
  color: var(--muted);
  font-weight: 400;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

/* --- Shell ---------------------------------------------------------------- */

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px clamp(16px, 5vw, 54px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand strong { display: block; font-size: 14px; }
.brand span { color: var(--muted); font-size: 11.5px; }

.back {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.back svg {
  width: 17px; height: 17px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 12px; }

.dash {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 54px) clamp(16px, 5vw, 54px) 60px;
}

.dash h1 { margin: 0 0 6px; font-size: clamp(20px, 3vw, 27px); }
.lede { margin: 0 0 28px; color: var(--muted); font-size: 13px; line-height: 1.9; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px;
  color: inherit;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.card:hover {
  background: rgba(139, 124, 248, 0.1);
  border-color: rgba(139, 124, 248, 0.34);
  transform: translateY(-2px);
}

.card.disabled { opacity: 0.5; pointer-events: none; }
.card b { font-size: 14px; }
.card small { color: var(--muted); font-size: 11.5px; line-height: 1.7; }

.card em {
  margin-top: 4px;
  color: #f0c07a;
  font-size: 10.5px;
  font-style: normal;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 6px;
  color: #bdb4ff;
  background: rgba(139, 124, 248, 0.13);
  border-radius: 11px;
}

.card-icon svg {
  width: 19px; height: 19px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

.card.admin { border-color: rgba(224, 162, 72, 0.28); }
.card.admin .card-icon { color: #f0c07a; background: rgba(224, 162, 72, 0.12); }

.empty {
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

.empty p { margin: 0 0 6px; font-size: 14px; }
.empty small { font-size: 12px; opacity: 0.75; }

.hidden { display: none !important; }

/* --- Free console --------------------------------------------------------- */

.free-console {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: min(66vh, 620px);
}

.free-head {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.free-head label { margin: 0; flex: 1 1 160px; }
.free-head button { flex: 0 0 auto; }

.free-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.msg { display: flex; margin-bottom: 9px; }
.msg.me { justify-content: flex-start; }
.msg.them { justify-content: flex-end; }

.msg span {
  max-width: 78%;
  padding: 9px 13px;
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-wrap;
  border-radius: 14px;
}

.msg.me span { background: rgba(139, 124, 248, 0.16); }
.msg.them span { background: rgba(255, 255, 255, 0.06); }

.muted { color: var(--muted); font-size: 12.5px; text-align: center; }

.free-composer { display: flex; gap: 9px; align-items: flex-end; }
.free-composer textarea { flex: 1; resize: vertical; }
.free-composer button { flex: 0 0 auto; }

/* A section a user may see the name of but not enter. Rendered without a link,
   so there is nothing to click; the server refuses the route regardless. */
.card.locked {
  cursor: not-allowed;
  opacity: 0.55;
  border-style: dashed;
  border-color: rgba(224, 162, 72, 0.3);
}

.card.locked:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(224, 162, 72, 0.3);
}

.card.locked .card-icon {
  color: #f0c07a;
  background: rgba(224, 162, 72, 0.1);
}

.card.locked em { color: #e0a248; }

/* --- Live free console ----------------------------------------------------- */

.live-console {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: min(70vh, 660px);
}

.live-servers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.live-server {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 13px;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 400;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
}

.live-server:hover { background: rgba(255, 255, 255, 0.08); }

.live-server:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.live-server.picked {
  background: rgba(139, 124, 248, 0.16);
  border-color: rgba(139, 124, 248, 0.4);
}

/* Green once the runtime is up and the session is attached — that is the
   moment sending becomes possible. */
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.live-dot.running {
  background: #55c98a;
  box-shadow: 0 0 0 3px rgba(85, 201, 138, 0.18);
}

.live-dot.starting {
  background: #e0a248;
  animation: pulse 1.2s ease-in-out infinite;
}

.live-dot.sleeping { background: rgba(255, 255, 255, 0.22); }
.live-dot.error { background: #e0645f; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.live-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.live-composer { display: flex; gap: 9px; align-items: flex-end; }
.live-composer textarea { flex: 1; resize: vertical; }
.live-composer button { flex: 0 0 auto; }

.live-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

/* --- Chat transcript ------------------------------------------------------ */
/* Ported line for line from the Claude console's stylesheet: the free sessions
   have to read exactly like it — same bubble, same headings, same code block,
   same line height — because it is the same conversation, only a different
   door. */

.message-row {
  display: flex;
  width: 100%;
  margin: 0 0 22px;
  animation: message-in 240ms ease both;
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-row.user { justify-content: flex-start; }

.message-row.assistant {
  align-items: flex-start;
  gap: 12px;
}

.message-bubble {
  max-width: min(78%, 760px);
  line-height: 1.95;
  /* 15px is the Claude console's body size; the transcript keeps it even
     though the rest of this panel is smaller. */
  font-size: 15px;
  overflow-wrap: anywhere;
}

.message-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user .message-bubble {
  padding: 12px 16px;
  color: #f7f6ff;
  background: linear-gradient(135deg, rgba(119, 101, 235, 0.92), rgba(99, 93, 205, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px 18px 5px 18px;
  box-shadow: 0 10px 32px rgba(75, 59, 180, 0.16);
}

.assistant .message-bubble {
  flex: 1;
  max-width: calc(100% - 46px);
  padding: 5px 2px 0;
  color: #e5e8f0;
}

.message-content {
  text-align: start;
  unicode-bidi: plaintext;
}

.message-content > :first-child { margin-top: 0; }
.message-content > :last-child { margin-bottom: 0; }

.message-content p { margin: 0 0 13px; }

.message-content h1,
.message-content h2,
.message-content h3 {
  margin: 22px 0 10px;
  color: #fafbff;
  line-height: 1.55;
}

.message-content h1 { font-size: 19px; }
.message-content h2 { font-size: 17px; }
.message-content h3 { font-size: 15px; }

.message-content ul,
.message-content ol {
  margin: 9px 0 15px;
  padding-right: 23px;
}

.message-content li { margin: 5px 0; }

.message-content blockquote {
  margin: 15px 0;
  padding: 8px 14px;
  color: #b9c0d0;
  background: rgba(255, 255, 255, 0.025);
  border-right: 3px solid var(--accent);
  border-radius: 8px 0 0 8px;
}

.message-content a {
  color: #a99cff;
  text-decoration: none;
  border-bottom: 1px solid rgba(169, 156, 255, 0.35);
}

.message-content code {
  padding: 2px 6px;
  color: #c6bdff;
  background: rgba(139, 124, 248, 0.1);
  border: 1px solid rgba(139, 124, 248, 0.12);
  border-radius: 6px;
  direction: ltr;
  font-family: "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 0.86em;
  unicode-bidi: isolate;
}

.code-block {
  margin: 16px 0;
  overflow: hidden;
  background: #080c14;
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.02);
  direction: ltr;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
}

.copy-code {
  padding: 3px 8px;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: 10px;
}

.copy-code:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
}

.code-block pre {
  margin: 0;
  padding: 15px;
  overflow-x: auto;
  color: #cdd4e3;
  text-align: left;
  white-space: pre;
}

.code-block pre code {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font-size: 12px;
  line-height: 1.7;
}

/* The blinking caret the Claude console shows while an answer is still
   arriving. */
.message-bubble.streaming .message-content > :last-child::after {
  display: inline-block;
  width: 7px;
  height: 14px;
  margin-right: 3px;
  content: "";
  vertical-align: -2px;
  background: var(--accent);
  border-radius: 2px;
  animation: caret 1s steps(2) infinite;
}

@keyframes caret { 0%,100% { opacity: 1 } 50% { opacity: 0 } }

/* --- Users panel ---------------------------------------------------------- */
/* The session chips carry the colour the session is known by elsewhere, so a
   user recognises the blue and the red one at a glance. */
.user-console { display: grid; gap: 14px; }

.user-sessions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.user-session {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 8px;
  padding: 10px 14px;
  min-width: 190px;
  text-align: right;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.user-session small { grid-column: 1 / -1; color: #9ba5b9; font-size: 12px; }
.user-session:hover { background: rgba(255, 255, 255, 0.08); }
.user-session.picked { border-color: rgba(139, 124, 248, 0.6); background: rgba(139, 124, 248, 0.12); }

.user-dot { width: 10px; height: 10px; border-radius: 50%; background: #6b7488; }
.accent-blue .user-dot { background: #4d8dff; }
.accent-red .user-dot { background: #ff5f6d; }
.accent-green .user-dot { background: #3ecf8e; }

/* --- Settings ------------------------------------------------------------- */
.settings { display: grid; gap: 14px; }
.settings h3 { margin: 0; }

.settings-user {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.settings-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.settings-row > span { color: #9ba5b9; font-size: 13px; min-width: 54px; }

.tick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: 13px;
}

.tick.accent-blue { border-color: rgba(77, 141, 255, 0.45); }
.tick.accent-red { border-color: rgba(255, 95, 109, 0.45); }
.tick.accent-green { border-color: rgba(62, 207, 142, 0.45); }

.settings-actions { display: flex; align-items: center; gap: 10px; }
.settings-note { color: #9ba5b9; font-size: 12px; }

/* Detailed users/session mirror ------------------------------------------- */
.dash:has(#userConsole:not(.hidden)) {
  max-width: 1680px;
  padding: clamp(16px, 2.5vw, 34px) clamp(12px, 2.5vw, 36px) 36px;
}

.user-console { display: block; }

.user-app-shell {
  position: relative;
  display: grid;
  /* Same corner as /profage/codex: the session list sits in the first (left,
     under this forced ltr) column and the transcript fills the rest — not
     the mirror image of it. */
  grid-template-areas: "sessions chat";
  grid-template-columns: 312px minmax(0, 1fr);
  direction: ltr;
  height: clamp(680px, calc(100dvh - 135px), 920px);
  min-height: 680px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  backdrop-filter: blur(24px);
}

.user-chat-pane {
  grid-area: chat;
  direction: rtl;
  display: grid;
  /* toolbar, policy bar, transcript, error strip, composer. The live console
     has no error strip and simply leaves the fourth row at zero height. */
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at 50% -20%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, .018), transparent 22%);
}

.user-panel-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 76px;
  padding: 12px 18px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  backdrop-filter: blur(18px);
}

.user-conversation-heading {
  display: grid;
  gap: 4px;
  min-width: 150px;
  margin-left: auto;
}

.user-conversation-heading strong { font-size: 15px; }
.user-conversation-heading > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.user-presence {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ecf8e;
  box-shadow: 0 0 0 4px rgba(62, 207, 142, .1);
}

.user-picker-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; }
.user-panel-toolbar label.compact { margin: 0; min-width: 108px; color: var(--muted); font-size: 10px; }
.user-panel-toolbar select {
  width: 128px;
  height: 36px;
  margin-top: 4px;
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 11px;
}
.user-panel-toolbar #userViewer { width: 154px; }

.user-mirror-badge {
  display: inline-flex;
  align-items: center;
  align-self: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--border));
  border-radius: 999px;
  color: color-mix(in srgb, var(--accent) 78%, white);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  font-size: 10px;
  white-space: nowrap;
}

.user-policy-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  color: var(--muted);
  background: rgba(127, 127, 127, .025);
  font-size: 10px;
}
.user-policy-bar svg { width: 14px; height: 14px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; }

.user-message-stream {
  min-height: 0 !important;
  max-height: none !important;
  padding: 26px clamp(18px, 5vw, 76px) 34px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  scroll-behavior: smooth;
}
.user-message-stream .message-row { width: 100%; max-width: 920px; margin-right: auto; margin-left: auto; }

.user-empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 100%;
  padding: 50px 20px;
  color: var(--muted);
  text-align: center;
}
.user-empty-state strong { color: var(--text); font-size: 16px; }
.user-empty-state span,
.user-empty-state p { max-width: 420px; font-size: 12px; line-height: 1.9; }
.user-empty-state p { margin: 0; }
.user-empty-mark {
  display: grid !important;
  place-items: center;
  width: 44px;
  height: 44px;
  max-width: none !important;
  margin-bottom: 4px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
  color: color-mix(in srgb, var(--accent) 80%, var(--text));
  font-size: 15px !important;
  font-weight: 800;
  line-height: 1;
}

/* The transcript keeps its own scrollbox; the wrapper only exists to hang the
   jump button over it without moving with the text. */
.user-stream-wrap { position: relative; display: grid; min-height: 0; }
.user-stream-wrap > .user-message-stream { min-height: 0; }

.user-jump {
  position: absolute;
  inset-inline-start: 50%;
  bottom: 16px;
  transform: translateX(50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  color: var(--text);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  backdrop-filter: blur(8px);
}
.user-jump:hover { background: color-mix(in srgb, var(--accent) 22%, var(--panel)); }
.user-jump svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.user-jump.hidden { display: none; }

/* Manager view only: the transcript opens on the last three turns, same as a
   fresh Codex session load, with this above the log to pull the rest in. */
.user-history-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - clamp(36px, 10vw, 152px));
  margin: 12px auto 0;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.user-history-more:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.user-history-more svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.user-history-more.hidden { display: none; }

/* A failed poll or a rejected message says so here, above the composer, and
   the conversation itself is left on screen. */
.user-error-strip {
  margin: 0;
  padding: 8px clamp(16px, 5vw, 72px);
  border-top: 1px solid color-mix(in srgb, #ef4444 40%, transparent);
  background: color-mix(in srgb, #ef4444 12%, transparent);
  color: color-mix(in srgb, #ef4444 55%, var(--text));
  font-size: 11px;
  text-align: center;
}
.user-error-strip.hidden { display: none; }

.user-typing .message-bubble { padding: 12px 16px !important; }
.typing-dots { display: flex; gap: 5px; }
.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots i:nth-child(2) { animation-delay: .18s; }
.typing-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes typing-bounce { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing-dots i { animation: none; } }

.user-composer-zone {
  padding: 14px clamp(16px, 5vw, 72px) 12px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 88%, transparent), var(--panel));
}

.user-composer {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  max-width: 920px;
  margin: 0 auto;
  padding: 9px 10px !important;
  border: 1px solid var(--border) !important;
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg) 48%, var(--panel)) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.user-composer:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.user-composer textarea {
  min-height: 44px;
  max-height: 150px;
  margin: 0;
  padding: 11px 12px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}
.user-composer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 92px;
  height: 44px;
  padding: 0 13px;
  border-radius: 13px;
}
.user-composer button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.user-composer-zone .live-hint { display: block; max-width: 920px; margin: 8px auto 0; padding: 0; color: var(--muted); font-size: 9px; text-align: center; }

.user-session-pane {
  grid-area: sessions;
  direction: rtl;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  padding: 14px 12px;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 60%, var(--panel));
}

.user-brand-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 5px 10px; }
.user-brand-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 10px;
  color: white;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #23243d));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 18%, transparent);
  font-size: 12px;
  font-weight: 800;
}
.user-brand-row > div { display: grid; flex: 1; gap: 1px; }
.user-brand-row strong { font-size: 13px; }
.user-brand-row small { color: var(--muted); font-size: 9px; }

.user-manager-accounts {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 0 0 11px;
  padding: 9px 10px;
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  text-align: right;
}
.user-manager-accounts > span:last-child { display: grid; gap: 2px; min-width: 0; }
.user-manager-accounts strong { font-size: 11px; }
.user-manager-accounts small { color: var(--muted); font-size: 9px; }
.user-manager-accounts-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 17%, var(--panel)); font-size: 16px; }
.user-manager-accounts:hover { border-color: color-mix(in srgb, var(--accent) 65%, var(--border)); background: color-mix(in srgb, var(--accent) 16%, transparent); }

.user-session-search { position: relative; display: flex; align-items: center; gap: 8px; height: 36px; margin: 3px 0 13px; padding: 0 10px; border: 1px solid var(--border); border-radius: 12px; background: rgba(127, 127, 127, .045); transition: border-color 160ms ease, background 160ms ease; }
.user-session-search:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: rgba(127, 127, 127, .065); }
.user-session-search svg { position: static; flex: 0 0 auto; width: 15px; height: 15px; transform: none; fill: none; stroke: var(--muted); stroke-width: 1.8; pointer-events: none; }
.user-session-search input { height: auto; margin: 0; padding: 0; border-radius: 0; background: transparent; font-size: 11px; }

.pane-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 4px 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.pane-title button, .user-close-sessions, .user-mobile-sessions {
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
}
.pane-title button { display: grid; }
.pane-title button:hover, .user-close-sessions:hover, .user-mobile-sessions:hover { color: var(--text); border-color: var(--border); background: rgba(127, 127, 127, .07); }
.pane-title svg, .user-close-sessions svg, .user-mobile-sessions svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
#userRefresh.refreshing svg { animation: user-refresh .7s linear infinite; }
@keyframes user-refresh { to { transform: rotate(360deg); } }

.user-sessions { display: grid; align-content: start; gap: 0; min-height: 0; margin: 0 -5px; overflow-x: hidden; overflow-y: auto; padding: 0 5px 8px; }
.user-session {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 15px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  margin: 2px 0;
  padding: 7px 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
  text-align: right;
  transition: 150ms ease;
}
.user-session:hover { border-color: transparent; background: rgba(127, 127, 127, .055); }
.user-session.picked { border-color: color-mix(in srgb, var(--accent) 18%, transparent); background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 14%, transparent), color-mix(in srgb, var(--accent-2) 3.5%, transparent)); }
.user-session.picked::before { position: absolute; top: 8px; right: -1px; width: 3px; height: calc(100% - 16px); content: ""; background: linear-gradient(var(--accent), var(--accent-2)); border-radius: 999px 0 0 999px; }
.user-session-icon { position: relative; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--muted); background: rgba(127, 127, 127, .06); }
.user-session-icon::before { content: ""; width: 13px; height: 12px; border: 1.5px solid currentColor; border-radius: 4px; opacity: .48; }
.user-session-icon .user-dot { position: absolute; right: 5px; bottom: 5px; width: 6px; height: 6px; border: 1px solid color-mix(in srgb, var(--panel) 80%, black); }
.user-session.picked .user-session-icon { color: color-mix(in srgb, var(--accent) 70%, var(--text)); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.user-session-copy { display: flex; flex-direction: column; min-width: 0; }
.user-session-name { overflow: hidden; color: var(--text); font-size: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.user-session-meta { display: flex; min-width: 0; gap: 5px; margin-top: 2px; color: var(--muted); font-size: 10px; }
.user-session-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-session-meta span + span::before { content: "·"; margin-left: 5px; }
.user-session-chevron { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; opacity: .3; }
.user-session.picked .user-session-chevron { opacity: .75; }
.user-session-empty { padding: 22px 12px; color: var(--muted); font-size: 11px; line-height: 1.9; text-align: center; }

.user-sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 11px 6px 1px; border-top: 1px solid var(--border); color: var(--muted); font-size: 9px; line-height: 1.8; }
.user-lock-icon { display: grid; flex: 0 0 24px; place-items: center; width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 8px; }
.user-sidebar-scrim, .user-mobile-sessions, .user-close-sessions { display: none; }

/* OpenCode uses the Codex workspace primitives above, with server-specific
   controls layered on top. */
.dash:has(#liveConsole:not(.hidden)) {
  max-width: 1680px;
  padding: clamp(16px, 2.5vw, 34px) clamp(12px, 2.5vw, 36px) 36px;
}
.live-console { display: block; height: auto; }
.live-app-shell .user-session-pane { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
.live-app-shell .live-servers { display: grid; flex-wrap: nowrap; gap: 4px; }
.live-server-row { display: grid; grid-template-columns: minmax(0, 1fr) 30px; align-items: center; gap: 2px; border-radius: 11px; }
.live-server-pick.user-session { grid-template-columns: 32px minmax(0, 1fr) 15px; padding: 7px 6px; }
.live-server-pick:disabled { cursor: not-allowed; opacity: .42; }
.live-server-rename { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; font-size: 13px; }
.live-server-rename:hover { color: var(--text); border-color: var(--border); background: rgba(127, 127, 127, .07); }
.live-dot.ready, .live-dot.running { background: #3ecf8e; box-shadow: 0 0 0 3px rgba(62, 207, 142, .12); }
.live-dot.starting { background: #e0a248; }
.live-dot.sleeping, .live-dot.unconfigured { background: #6b7488; }
.live-dot.error, .live-dot.offline { background: #e0645f; }
.live-dot.disabled { background: #4d5360; }
.user-presence.ready, .user-presence.running { background: #3ecf8e; box-shadow: 0 0 0 4px rgba(62, 207, 142, .1); }
.user-presence.starting { background: #e0a248; box-shadow: 0 0 0 4px rgba(224, 162, 72, .1); animation: pulse 1.2s ease-in-out infinite; }
.user-presence.sleeping, .user-presence.unconfigured { background: #6b7488; box-shadow: 0 0 0 4px rgba(107, 116, 136, .1); }
.user-presence.error, .user-presence.offline { background: #e0645f; box-shadow: 0 0 0 4px rgba(224, 100, 95, .1); }
.user-presence.disabled { background: #4d5360; box-shadow: 0 0 0 4px rgba(77, 83, 96, .1); }
#liveRefresh.refreshing svg { animation: user-refresh .7s linear infinite; }
.live-loader { width: 26px; height: 26px; border: 2px solid color-mix(in srgb, var(--accent) 20%, transparent); border-top-color: var(--accent); border-radius: 50%; animation: user-refresh .8s linear infinite; }
.live-history-actions { position: sticky; z-index: 2; top: 0; display: flex; justify-content: center; max-width: 920px; margin: 0 auto 18px; }
.live-history-actions button { padding: 7px 13px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: color-mix(in srgb, var(--panel) 90%, transparent); font-size: 10px; backdrop-filter: blur(12px); }
.live-history-actions button:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.turn-complete { display: grid; grid-template-columns: minmax(20px, 1fr) auto minmax(20px, 1fr); align-items: center; gap: 11px; width: 100%; max-width: 920px; margin: 5px auto 24px; color: #3ecf8e; font-size: 10px; }
.turn-complete span { height: 1px; background: linear-gradient(90deg, transparent, color-mix(in srgb, #3ecf8e 35%, transparent)); }
.turn-complete span:last-child { background: linear-gradient(90deg, color-mix(in srgb, #3ecf8e 35%, transparent), transparent); }
.turn-complete b { font-weight: 650; }
.md-table-wrap { width: 100%; margin: 14px 0; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.md-table-wrap table { width: 100%; border-collapse: collapse; min-width: 420px; font-size: 13px; }
.md-table-wrap th, .md-table-wrap td { padding: 9px 12px; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); text-align: right; vertical-align: top; }
.md-table-wrap th { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); font-weight: 700; }
.md-table-wrap tr:last-child td { border-bottom: 0; }
.md-table-wrap th:last-child, .md-table-wrap td:last-child { border-left: 0; }

/* Large settings workspace ------------------------------------------------ */
.settings { gap: 18px; }
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; border: 1px solid var(--border); border-radius: 20px; background: var(--panel); backdrop-filter: blur(20px); }
.settings-heading h2, .settings-heading p { margin: 0; }
.settings-heading p { color: var(--muted); margin-top: 5px; }
.settings-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-people { position: sticky; top: 18px; display: grid; gap: 7px; padding: 10px; max-height: 82vh; overflow: auto; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); }
.settings-people button { display: grid; gap: 2px; padding: 11px 12px; text-align: right; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 12px; }
.settings-people button small { color: var(--muted); }
.settings-people button:hover, .settings-people button.active { background: color-mix(in srgb, var(--accent) 15%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.setting-pw code { font-family: var(--font-mono, monospace); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 1px 5px; border-radius: 5px; direction: ltr; unicode-bidi: embed; }
.setting-pw.muted { opacity: .6; }
#settingsEditor { display: grid; gap: 14px; min-width: 0; }
.setting-user-title, .setting-card, .setting-metrics, .sticky-save { border: 1px solid var(--border); background: var(--panel); backdrop-filter: blur(18px); border-radius: 18px; }
.setting-user-title { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; }
.setting-user-title h2 { margin: 0; }.setting-user-title span { color: var(--muted); }
.role-pill { padding: 5px 10px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 999px; font-size: 12px; }
.setting-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.setting-metrics label { margin: 0; }.setting-metrics small { color: var(--muted); display: block; margin-top: 5px; }
.setting-card { padding: 18px; }.setting-card h3 { margin: 0 0 13px; font-size: 15px; }
.setting-checks, .model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.compact-checks { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.setting-check { display: flex; align-items: flex-start; gap: 9px; margin: 0; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: rgba(127,127,127,.055); cursor: pointer; }
.setting-check input { width: auto; margin-top: 4px; accent-color: var(--accent); }
.setting-check span { display: grid; gap: 3px; }.setting-check b { font-size: 13px; }.setting-check small { color: var(--muted); font-size: 11px; line-height: 1.6; }
.theme-grid { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; }
.theme-choice { display: grid; gap: 6px; margin: 0; padding: 8px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; }
.theme-choice input { position: absolute; opacity: 0; }.theme-choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
.theme-preview { height: 80px; border-radius: 9px; background-size: cover !important; }.theme-choice small { color: var(--muted); font-size: 10px; }
.text-settings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }.text-settings label { margin: 0; }.text-settings small { display: block; color: var(--muted); min-height: 38px; }.text-settings textarea { margin-top: 8px; resize: vertical; }
.sticky-save { position: sticky; bottom: 10px; z-index: 4; display: flex; align-items: center; gap: 12px; padding: 12px; box-shadow: 0 14px 35px rgba(0,0,0,.25); }
.sticky-save span { color: var(--muted); }
.secret-zone { padding: 16px; min-height: 76px; border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: 20px; background: color-mix(in srgb, var(--panel) 92%, transparent); }
.secret-launch { width: 100%; color: var(--muted); background: transparent; border: 0; }
.secret-gate { max-width: 560px; margin: 12px auto; text-align: center; }.secret-gate > div { display: flex; gap: 8px; }.secret-gate input { flex: 1; }.secret-gate small { display: block; color: #ff8b97; margin-top: 7px; }
.secret-editor { display: grid; gap: 12px; max-width: 920px; margin: 12px auto; }.secret-selectors { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }.secret-selectors label { margin: 0; }.secret-enabled { display: flex; gap: 8px; align-items: center; margin: 0; }.secret-enabled input { width: auto; }.secret-editor textarea { resize: vertical; }.secret-editor p { margin: 0; color: var(--muted); font-size: 12px; }

/* Per-theme identity lives at the end of this file, after the components. */

/* Profile and account controls ------------------------------------------- */
.profile-trigger { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 12px; color: var(--text); background: rgba(127,127,127,.07); border: 1px solid var(--border); border-radius: 12px; }
.profile-avatar, .account-avatar, .user-account-avatar { display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border)); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.profile-avatar { width: 29px; height: 29px; border-radius: 9px; }
.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(2,5,12,.72); backdrop-filter: blur(12px); }
.modal-backdrop[hidden] { display: none; }
.profile-modal { position: relative; width: min(520px, 100%); max-height: min(720px, calc(100dvh - 40px)); overflow: auto; padding: 24px; border: 1px solid var(--border); border-radius: 22px; background: color-mix(in srgb, var(--panel) 96%, #080c16); box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.modal-close { position: absolute; top: 14px; left: 14px; width: 36px; height: 36px; padding: 0; color: var(--muted); background: transparent; border: 1px solid var(--border); border-radius: 10px; }
.profile-heading { display: flex; align-items: center; gap: 14px; padding: 0 0 18px; }
.profile-heading h2, .profile-heading p { margin: 0; }
.profile-heading p { margin-top: 4px; color: var(--muted); }
.profile-avatar-large { display: grid; place-items: center; width: 62px; height: 62px; font-size: 30px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 18px; background: color-mix(in srgb, var(--accent) 16%, transparent); }
.profile-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 13px; background: rgba(127,127,127,.05); }
.profile-tabs button { color: var(--muted); background: transparent; border: 0; }
.profile-tabs button.active { color: var(--text); background: color-mix(in srgb, var(--accent) 17%, transparent); }
.profile-pane { display: none; gap: 13px; }
.profile-pane.active { display: grid; }
.password-field { display: grid; grid-template-columns: minmax(0,1fr) 42px; overflow: hidden; margin-top: 7px; border: 1px solid var(--border); border-radius: 10px; background: rgba(127,127,127,.06); }
.password-field input { min-width: 0; margin: 0; border: 0; border-radius: 0; background: transparent; }
.password-eye { width: 42px; padding: 0; color: var(--muted); background: transparent; border: 0; border-right: 1px solid var(--border); border-radius: 0; }
.field-hint { color: var(--muted); font-size: 11px; }
.form-status { min-height: 22px; margin: 0; color: var(--muted); }
.form-status.success { color: #55d9a5; }
.form-status.error { color: #ff8b97; }

/* The only destination for employees should be unmistakable. */
.cards .users-primary { grid-column: 1 / -1; min-height: 148px; padding: 28px; border-color: color-mix(in srgb, var(--accent) 58%, var(--border)); background: linear-gradient(125deg, color-mix(in srgb, var(--accent) 20%, var(--panel)), var(--panel)); box-shadow: 0 22px 60px color-mix(in srgb, var(--accent) 12%, transparent); }
.cards .users-primary b { font-size: clamp(20px, 2vw, 28px); }
.cards .users-primary p { max-width: 620px; font-size: 14px; }

/* Managers see one closed row per employee — never a session list — until the
   "+" is clicked. What opens is a read-only mirror; nothing here is editable. */
.user-account-group { display: grid; gap: 0; padding: 1px 0; }
.user-account-group + .user-account-group { border-top: 1px solid var(--border); }
.user-account-toggle {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 7px;
  color: var(--text);
  background: transparent;
  border-radius: 10px;
  text-align: right;
}
.user-account-toggle:hover { background: rgba(127, 127, 127, .055); }
.user-account-toggle:disabled { cursor: not-allowed; opacity: .5; }
.user-account-group.expanded > .user-account-toggle { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.user-account-copy { display: grid; min-width: 0; }
.user-account-copy b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-account-copy small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.user-account-plus {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: 8px;
  color: color-mix(in srgb, var(--accent) 78%, var(--text));
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}
.user-account-avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
.user-account-sessions { display: grid; gap: 3px; padding: 0 0 8px; }
.user-account-group:not(.expanded) > .user-account-sessions { display: none; }

/* Manager-only account administration. */
.account-admin { display: grid; gap: 15px; padding: 18px; border: 1px solid var(--border); border-radius: 20px; background: var(--panel); backdrop-filter: blur(18px); }
.account-admin-heading h2, .account-admin-heading p { margin: 0; }
.account-admin-heading p { margin-top: 5px; color: var(--muted); }
.account-grid { display: grid; gap: 8px; }
.account-row { display: grid; grid-template-columns: minmax(180px,1.1fr) minmax(135px,.65fr) minmax(210px,1fr) auto; align-items: end; gap: 12px; padding: 13px; border: 1px solid var(--border); border-radius: 15px; background: rgba(127,127,127,.045); }
.account-row > label { margin: 0; }
.account-identity { display: flex; align-items: center; gap: 10px; min-width: 0; align-self: center; }
.account-identity > span:last-child { display: grid; min-width: 0; }
.account-identity b, .account-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-identity small { color: var(--muted); }
.account-avatar { width: 42px; height: 42px; border-radius: 12px; }
.account-actions { display: flex; align-items: center; gap: 7px; min-height: 42px; }
.account-actions button { white-space: nowrap; }
.role-locked { padding: 8px 10px; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; white-space: nowrap; }
.account-note { grid-column: 1 / -1; min-height: 14px; color: var(--muted); }
.account-manager-modal { position: relative; width: min(980px, 100%); max-height: min(820px, calc(100dvh - 40px)); overflow: auto; padding: 24px; border: 1px solid var(--border); border-radius: 22px; background: color-mix(in srgb, var(--panel) 97%, #080c16); box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.account-manager-heading { padding: 0 2px 20px 48px; }
.account-manager-heading h2, .account-manager-heading p { margin: 0; }
.account-manager-heading p { margin-top: 6px; color: var(--muted); line-height: 1.8; }
.account-manager-modal .account-grid { gap: 10px; }
/* --- Themes ---------------------------------------------------------------
   Each user theme is a photograph set plus a palette. The backdrop below holds
   the photographs (two layers, so one dissolves into the next every 30s), and
   the blocks after it give every theme a texture of its own — the panel does
   not merely change colour when the theme changes. */

.theme-backdrop { position: fixed; z-index: -1; inset: 0; overflow: hidden; background: var(--bg); }
.theme-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  background-size: cover !important;
  background-position: center !important;
  transition: opacity 1.6s ease;
  animation: theme-drift 34s ease-in-out infinite alternate;
  will-change: opacity, transform;
}
.theme-layer.visible { opacity: 1; }
@keyframes theme-drift { from { transform: scale(1.02); } to { transform: scale(1.09); } }

@media (prefers-reduced-motion: reduce) {
  .theme-layer { animation: none; transition: opacity .4s linear; }
}

/* Shared: panels sit on the photograph, so they all get real glass. */
body[data-theme] .card, body[data-theme] .setting-card, body[data-theme] .account-admin,
body[data-theme] .secret-zone, body[data-theme] .user-app-shell { backdrop-filter: blur(16px) saturate(1.15); }
body[data-theme] .topbar { background: color-mix(in srgb, var(--panel) 72%, transparent); backdrop-filter: blur(18px); }
body[data-theme] .card { background: color-mix(in srgb, var(--panel) 62%, transparent); }
body[data-theme] .card:hover { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
body[data-theme] .ambient { background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%); }
/* The two purple marks of the default skin follow the theme accent as well. */
body[data-theme] .card-icon { color: color-mix(in srgb, var(--accent) 72%, var(--text)); background: color-mix(in srgb, var(--accent) 15%, transparent); }
body[data-theme] .brand-orb {
  color: color-mix(in srgb, var(--accent) 62%, var(--text));
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 24%, transparent), color-mix(in srgb, var(--accent-2) 12%, transparent));
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
}
body[data-theme] .profile-trigger, body[data-theme] .back, body[data-theme] button.ghost { color: var(--text); background: color-mix(in srgb, var(--panel) 55%, transparent); }
body[data-theme] button.ghost, body[data-theme] .who { color: var(--muted); }

/* دخترانه — rose glass, generous curves, a warm bloom over everything. */
body[data-theme="girly"] .card, body[data-theme="girly"] .setting-card,
body[data-theme="girly"] .user-app-shell, body[data-theme="girly"] .profile-modal { border-radius: 24px; }
body[data-theme="girly"] .card { box-shadow: 0 18px 40px rgba(60, 10, 40, .28); }
body[data-theme="girly"] .card:hover { transform: translateY(-3px); box-shadow: 0 22px 50px rgba(255, 111, 174, .28); }
body[data-theme="girly"] .brand strong {
  background: linear-gradient(90deg, #fff, #ffb9d8 55%, #ffd9b0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
body[data-theme="girly"] button:not(.ghost):not(.profile-trigger) { color: #3d0d27; box-shadow: 0 10px 24px rgba(255, 111, 174, .25); }
body[data-theme="girly"] .watermark { opacity: .09; filter: saturate(1.25) hue-rotate(-18deg); }
body[data-theme="girly"] .theme-layer.visible { filter: saturate(1.08); }

/* اسکلتی — a terminal behind glass: monospace, dashes, scanlines, phosphor. */
body[data-theme="skeleton"] { letter-spacing: .02em; }
body[data-theme="skeleton"] .card, body[data-theme="skeleton"] .setting-card,
body[data-theme="skeleton"] .user-workspace, body[data-theme="skeleton"] .account-admin,
body[data-theme="skeleton"] .user-app-shell { border-style: dashed; border-radius: 10px; }
body[data-theme="skeleton"] .brand strong, body[data-theme="skeleton"] .dash h1 { text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 65%, transparent); }
body[data-theme="skeleton"] .card em, body[data-theme="skeleton"] .who { text-transform: uppercase; font-size: 10.5px; }
body[data-theme="skeleton"] button:not(.ghost):not(.profile-trigger) { color: #04140a; border-radius: 6px; }
body[data-theme="skeleton"] .watermark { opacity: .05; filter: grayscale(1) brightness(1.7) sepia(1) hue-rotate(58deg) saturate(4); }
body[data-theme="skeleton"] .theme-layer.visible { filter: grayscale(.55) brightness(.85) sepia(.35) hue-rotate(58deg) saturate(1.5); }
/* CRT lines and a slow phosphor pulse, above the content but never in its way. */
body[data-theme="skeleton"]::before {
  content: ""; position: fixed; z-index: 60; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px);
  animation: crt-flicker 5.5s steps(1, end) infinite;
}
@keyframes crt-flicker { 0%, 92% { opacity: .55; } 94% { opacity: .3; } 96% { opacity: .7; } 100% { opacity: .55; } }

/* معمولی لایت — daylight: white cards, ink text, shadows instead of glow. */
body[data-theme="light"] .card, body[data-theme="light"] .setting-card,
body[data-theme="light"] .account-admin, body[data-theme="light"] .user-app-shell {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 12px 30px rgba(20, 28, 47, .10);
}
body[data-theme="light"] .card:hover { background: color-mix(in srgb, var(--accent) 8%, #fff); box-shadow: 0 16px 36px rgba(37, 99, 235, .16); }
body[data-theme="light"] button:not(.ghost):not(.profile-trigger) { color: #fff; }
body[data-theme="light"] button.ghost, body[data-theme="light"] .back { background: rgba(20, 28, 47, .05); }
body[data-theme="light"] input, body[data-theme="light"] textarea, body[data-theme="light"] select { color: var(--text); background: rgba(255, 255, 255, .78); }
body[data-theme="light"] .watermark { opacity: .04; filter: invert(1) grayscale(1); }
body[data-theme="light"] .ambient { opacity: .5; }

/* سوپر دارک — deep black, violet neon on the edges, a vignette that closes in. */
body[data-theme="super-dark"] .ambient { opacity: .5; }
body[data-theme="super-dark"] .card, body[data-theme="super-dark"] .setting-card,
body[data-theme="super-dark"] .user-app-shell { background: color-mix(in srgb, var(--panel) 88%, transparent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 24px 60px rgba(0, 0, 0, .55); }
body[data-theme="super-dark"] .card:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 24px 60px color-mix(in srgb, var(--accent) 22%, transparent); }
body[data-theme="super-dark"] .brand strong, body[data-theme="super-dark"] .dash h1 { text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 45%, transparent); }
body[data-theme="super-dark"] button:not(.ghost):not(.profile-trigger) { color: #0b0620; box-shadow: 0 8px 26px color-mix(in srgb, var(--accent) 32%, transparent); }
body[data-theme="super-dark"] .theme-layer.visible { filter: contrast(1.08) brightness(.9); }
body[data-theme="super-dark"]::before {
  content: ""; position: fixed; z-index: 0; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, transparent 48%, rgba(0, 0, 0, .62) 100%);
}

@media (max-width: 900px) {
  .user-app-shell { grid-template-areas: "chat"; grid-template-columns: 1fr; height: calc(100dvh - 116px); min-height: 600px; border-radius: 16px; }
  .user-session-pane {
    position: absolute;
    z-index: 20;
    inset: 0 0 0 auto;
    width: min(330px, 88vw);
    max-height: none;
    border-left: 1px solid var(--border);
    border-bottom: 0;
    box-shadow: -24px 0 60px rgba(0, 0, 0, .32);
    transform: translateX(105%);
    transition: transform .22s ease;
  }
  .user-app-shell.sidebar-open .user-session-pane { transform: translateX(0); }
  .user-sidebar-scrim { position: absolute; z-index: 19; inset: 0; display: block; opacity: 0; pointer-events: none; background: rgba(3, 6, 13, .67); transition: opacity .2s ease; }
  .user-app-shell.sidebar-open .user-sidebar-scrim { opacity: 1; pointer-events: auto; }
  .user-mobile-sessions, .user-close-sessions { display: grid; }
  .user-panel-toolbar { padding: 10px 12px; }
  .user-conversation-heading { margin-left: auto; }
  .user-picker-row { order: 3; width: 100%; }
  .user-picker-row label.compact { flex: 1; }
  .user-picker-row select, .user-panel-toolbar #userViewer { width: 100%; }
  .user-mirror-badge { display: none; }
  .user-message-stream { padding: 20px 12px 26px !important; }
  .user-composer-zone { padding: 10px; }
  .user-composer button { width: 48px; }
  .user-composer button span { display: none; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-people { position: static; grid-template-columns: repeat(2, 1fr); max-height: none; }
  .account-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .account-actions { justify-content: flex-end; }
  .theme-grid, .text-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .account-manager-modal { padding: 18px 12px 12px; }
  .account-manager-heading { padding: 4px 8px 16px 42px; }
  .setting-checks, .model-grid, .setting-metrics, .theme-grid, .text-settings, .secret-selectors { grid-template-columns: 1fr; }
  .settings-heading { align-items: flex-start; flex-direction: column; }
  .account-row { grid-template-columns: 1fr; }
  .account-actions { justify-content: stretch; }
  .account-actions button { flex: 1; }
  .topbar-right .profile-trigger > span:last-child { display: none; }
}

/* === OpenCode console: session colours + polish ===========================
   Two of the seven boxes are named for the job they run rather than their
   country — Netherlands is the Telegram session and WebDadeh the VPN panel —
   and they carry the same blue and red they have in the Claude panel. The
   colour is set once on #liveConsole and everything downstream reads --oc,
   so picking a session re-tints the whole console. */
#liveConsole { --oc: var(--accent); }
#liveConsole[data-accent="blue"] { --oc: #4d8dff; }
#liveConsole[data-accent="red"] { --oc: #ff5f6d; }
#liveConsole[data-accent="green"] { --oc: #3ecf8e; }

.live-server-row { --oc: var(--accent); }
.live-server-row.accent-blue { --oc: #4d8dff; }
.live-server-row.accent-red { --oc: #ff5f6d; }
.live-server-row.accent-green { --oc: #3ecf8e; }

/* The coloured rail sits on the right, because the list reads right-to-left. */
.live-server-row.accent-blue .live-server-pick,
.live-server-row.accent-red .live-server-pick,
.live-server-row.accent-green .live-server-pick {
  border-right: 3px solid color-mix(in srgb, var(--oc) 70%, transparent);
  background: linear-gradient(275deg, color-mix(in srgb, var(--oc) 13%, transparent), transparent 62%);
}
.live-server-row.accent-blue .user-session-name,
.live-server-row.accent-red .user-session-name,
.live-server-row.accent-green .user-session-name {
  color: color-mix(in srgb, var(--oc) 72%, var(--text));
  font-weight: 650;
}
.live-server-row.accent-blue .live-server-pick:hover,
.live-server-row.accent-red .live-server-pick:hover,
.live-server-row.accent-green .live-server-pick:hover {
  background: linear-gradient(275deg, color-mix(in srgb, var(--oc) 20%, transparent), transparent 68%);
}
.live-server-row.accent-blue .live-server-pick.picked,
.live-server-row.accent-red .live-server-pick.picked,
.live-server-row.accent-green .live-server-pick.picked {
  border-color: color-mix(in srgb, var(--oc) 55%, var(--border));
  border-right-color: var(--oc);
  background: linear-gradient(275deg, color-mix(in srgb, var(--oc) 26%, transparent), transparent 74%);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--oc) 16%, transparent);
}

/* --- Polish -------------------------------------------------------------- */
.live-app-shell {
  border-color: color-mix(in srgb, var(--oc, var(--accent)) 22%, var(--border));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .42),
              0 0 0 1px color-mix(in srgb, var(--oc, var(--accent)) 8%, transparent);
  transition: border-color .35s ease, box-shadow .35s ease;
}
#liveConsole .user-chat-pane {
  background:
    radial-gradient(circle at 50% -18%, color-mix(in srgb, var(--oc) 16%, transparent), transparent 42%),
    radial-gradient(circle at 88% 108%, color-mix(in srgb, var(--oc) 8%, transparent), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, .02), transparent 24%);
  transition: background .35s ease;
}
#liveConsole .user-panel-toolbar {
  position: relative;
  background: linear-gradient(180deg, color-mix(in srgb, var(--oc) 7%, transparent), transparent),
              color-mix(in srgb, var(--panel) 88%, transparent);
}
/* A hairline of the session colour under the toolbar, so the identity of the
   open session is readable without looking at the sidebar. */
#liveConsole .user-panel-toolbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--oc), transparent);
  opacity: .75;
}
#liveConsole .user-conversation-heading strong { letter-spacing: .2px; }
.live-server-badge {
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--oc) 30%, var(--border));
  border-radius: 999px;
  color: color-mix(in srgb, var(--oc) 70%, var(--muted));
  background: color-mix(in srgb, var(--oc) 10%, transparent);
  font-size: 10px;
  font-style: normal;
  white-space: nowrap;
}
#liveConsole .user-mirror-badge {
  border-color: color-mix(in srgb, var(--oc) 34%, var(--border));
  color: color-mix(in srgb, var(--oc) 76%, white);
  background: color-mix(in srgb, var(--oc) 10%, transparent);
}
#liveConsole .user-policy-bar { background: color-mix(in srgb, var(--oc) 5%, transparent); }
#liveConsole .user-composer:focus-within {
  border-color: color-mix(in srgb, var(--oc) 62%, var(--border)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--oc) 12%, transparent);
}
#liveConsole .user-composer button:not(:disabled) {
  background: linear-gradient(135deg, var(--oc), color-mix(in srgb, var(--oc) 45%, var(--accent-2)));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--oc) 24%, transparent);
}
#liveConsole .user-composer button:not(:disabled):hover { filter: brightness(1.08); }
#liveConsole .user-brand-mark {
  background: linear-gradient(135deg, var(--oc, var(--accent)), color-mix(in srgb, var(--oc, var(--accent)) 40%, var(--accent-2)));
}
#liveConsole .user-session-search:focus-within { border-color: color-mix(in srgb, var(--oc) 45%, var(--border)); }
#liveConsole .user-empty-mark {
  border-color: color-mix(in srgb, var(--oc) 32%, var(--border));
  color: color-mix(in srgb, var(--oc) 78%, white);
}

.live-server-pick { transition: transform .16s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.live-server-pick:not(:disabled):hover { transform: translateX(-2px); }
.live-server-pick.picked .user-session-chevron { opacity: 1; }
.live-server-row:hover .live-server-rename { color: var(--text); }

/* The status light keeps breathing while a server is answering, so a running
   job is visible from the sidebar without opening the session. */
.live-dot.running { animation: pulse 1.3s ease-in-out infinite; }
#liveConsole .live-servers { padding-left: 2px; scrollbar-width: thin; }

/* The flag is the session's face: it sits in the avatar chip with the status
   light as a corner badge, which leaves the name line free for the real name
   (Telegram, vpn) instead of a flag plus a country. */
.live-server-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--oc, var(--accent)) 28%, var(--border));
  border-radius: 11px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--oc, var(--accent)) 16%, transparent), transparent 70%);
}
.live-server-flag { font-size: 15px; line-height: 1; }
.live-server-mark .live-dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 9px;
  height: 9px;
  border: 2px solid color-mix(in srgb, var(--panel) 96%, black);
}
.live-server-row .user-session-meta { display: flex; gap: 6px; color: var(--muted); font-size: 10.5px; }
.live-server-row .user-session-meta span + span::before { content: "·"; margin-left: 6px; }
.live-server-row .user-session-name { font-size: 13px; }

#liveConsole .user-brand-row strong { letter-spacing: .3px; }
#liveConsole .user-session-pane {
  background: linear-gradient(200deg, color-mix(in srgb, var(--accent) 6%, transparent), transparent 38%),
              color-mix(in srgb, var(--panel) 92%, transparent);
}
#liveConsole .live-servers::-webkit-scrollbar { width: 6px; }
#liveConsole .live-servers::-webkit-scrollbar-thumb { border-radius: 999px; background: color-mix(in srgb, var(--accent) 22%, transparent); }
#liveConsole .user-message-stream::-webkit-scrollbar { width: 8px; }
#liveConsole .user-message-stream::-webkit-scrollbar-thumb { border-radius: 999px; background: color-mix(in srgb, var(--oc) 20%, transparent); }
#liveConsole .user-empty-state { animation: oc-rise .5s ease both; }
#liveConsole .message-row { animation: oc-rise .28s ease both; }
@keyframes oc-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
