/* ══════════════════════════════════════════════════════════
   HASHIRAMA — Base Styles (Theme-agnostic)
   Common structure, layout, components
   ══════════════════════════════════════════════════════════ */

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: #000;
  overflow: hidden;
}
input, textarea, button, select { font-family: inherit; }

/* ── UTILITY CLASSES ────────────────────────────────────── */
.hidden { display: none !important; }

/* ── KEYFRAMES ──────────────────────────────────────────── */
@keyframes pulseDot { 0%,100%{opacity:1} 50%{opacity:0.3} }
@keyframes blinkCursor { 0%,100%{opacity:1} 50%{opacity:0} }
@keyframes typingDot { 0%,80%,100%{transform:scale(0.5);opacity:0.3} 40%{transform:scale(1);opacity:1} }

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(170,120,25,0.2); border-radius: 2px; }
.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(170,120,25,0.2) transparent; }

/* ── RANGE INPUT ────────────────────────────────────────── */
input[type=range] {
  -webkit-appearance: none; width: 100%; height: 2px;
  background: rgba(170,120,25,0.12); outline: none; cursor: pointer;
  margin: 8px 0 4px; accent-color: var(--gold);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 6px rgba(200,158,28,0.5); cursor: pointer;
}

/* ══════════════════════════════════════════════════════════
   APP FRAME
   ══════════════════════════════════════════════════════════ */
.app {
  width: 100%; height: 100vh;
  display: flex; flex-direction: column;
  overflow: hidden; position: relative;
  background: var(--bg);
}

/* Non-desktop framing */
.app.viewport-tablet, .app.viewport-mobile {
  height: 812px;
  margin: 24px auto;
  box-shadow: 0 30px 100px rgba(0,0,0,0.9);
  border: 1px solid var(--border);
}
.app.viewport-tablet { width: 768px; max-width: 100%; }
.app.viewport-mobile { width: 390px; max-width: 100%; }

/* ── BACKGROUND LAYERS ──────────────────────────────────── */
.bg-layer {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
}

/* ── STATUE GHOST ───────────────────────────────────────── */
.statue-ghost {
  position: absolute; bottom: -6%; left: 50%; transform: translateX(-50%);
  width: 460px; height: 90%; pointer-events: none; z-index: 0; opacity: 0.4;
}
.statue-base {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 240px; height: 17%;
  clip-path: polygon(0% 30%, 8% 0%, 92% 0%, 100% 30%, 100% 100%, 0% 100%);
}
.statue-body {
  position: absolute; bottom: 15%; left: 50%; transform: translateX(-50%);
  width: 230px; height: 50%;
  clip-path: polygon(25% 0%, 75% 0%, 90% 15%, 95% 40%, 90% 70%, 84% 85%, 74% 95%, 50% 100%, 26% 95%, 16% 85%, 10% 70%, 5% 40%, 10% 15%);
}
.statue-neck {
  position: absolute; bottom: 62%; left: 50%; transform: translateX(-50%);
  width: 40px; height: 5%;
}
.statue-head {
  position: absolute; bottom: 66%; left: 50%; transform: translateX(-50%);
  width: 95px; height: 13%;
  clip-path: polygon(24% 0%, 76% 0%, 91% 22%, 93% 60%, 80% 88%, 64% 100%, 36% 100%, 20% 88%, 7% 60%, 9% 22%);
}
.statue-crown {
  position: absolute; bottom: 78%; left: 50%; transform: translateX(-50%);
  width: 112px; height: 7%;
  clip-path: polygon(0% 100%, 0% 52%, 14% 0%, 28% 62%, 50% 0%, 72% 62%, 86% 0%, 100% 52%, 100% 100%);
}
.statue-crown-glow {
  position: absolute; bottom: 79%; left: 50%; transform: translateX(-50%);
  width: 170px; height: 38px;
}
.statue-eyes {
  position: absolute; bottom: 75%; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px;
}
.statue-eye {
  width: 6px; height: 4px; border-radius: 50%;
}
.statue-floor-glow {
  position: absolute; bottom: -2%; left: 50%; transform: translateX(-50%);
  width: 700px; height: 220px;
}

/* Hide statue on non-desktop */
.viewport-tablet .statue-ghost,
.viewport-mobile .statue-ghost { display: none; }

/* ══════════════════════════════════════════════════════════
   NAVBAR
   ══════════════════════════════════════════════════════════ */
.navbar {
  position: relative; z-index: 100; height: 54px; flex-shrink: 0;
  background: rgba(3,2,6,0.97);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  box-shadow: 0 1px 0 rgba(170,120,25,0.06), 0 4px 20px rgba(0,0,0,0.4);
}
.navbar-left, .navbar-right { display: flex; align-items: center; gap: 12px; }
.navbar-btn {
  width: 32px; height: 32px; flex-shrink: 0;
  border: 1px solid var(--border-dim); background: transparent;
  cursor: pointer; color: var(--text-dim); font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.navbar-btn:hover { border-color: var(--border); color: var(--gold); }

/* Claude Toggle Switch */
.claude-toggle {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
.claude-toggle input { display: none; }
.claude-toggle-slider {
  position: relative; width: 42px; height: 22px;
  background: var(--border-dim); border-radius: 11px;
  transition: background 0.3s;
}
.claude-toggle-slider::before {
  content: ''; position: absolute; width: 18px; height: 18px;
  left: 2px; top: 2px; background: var(--text-dim);
  border-radius: 50%; transition: all 0.3s;
}
.claude-toggle input:checked + .claude-toggle-slider {
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}
.claude-toggle input:checked + .claude-toggle-slider::before {
  transform: translateX(20px); background: #fff;
}
.claude-toggle-label {
  font-family: var(--font-display); font-size: 10px;
  color: var(--text-dim); letter-spacing: 1px;
}
.claude-toggle input:checked ~ .claude-toggle-label {
  color: var(--gold);
}

.navbar-brand {
  font-family: var(--font-display); font-size: 13px;
  letter-spacing: 7px; color: var(--gold);
  text-shadow: 0 0 20px var(--gold-glow); white-space: nowrap;
}
.navbar-sep { width: 1px; height: 18px; background: var(--border); }
.navbar-subtitle {
  font-family: var(--font-body); font-style: italic;
  font-size: 10px; color: var(--text-faint); letter-spacing: 1.5px;
}
.navbar-status {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border: 1px solid var(--border-dim);
  background: var(--gold-faint);
}
.status-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
  box-shadow: 0 0 5px var(--success);
  animation: pulseDot 2.5s ease-in-out infinite;
}
.status-label {
  font-family: var(--font-mono); font-size: 13px;
  letter-spacing: 1.5px; color: var(--text-faint);
}
.navbar-avatar {
  width: 30px; height: 30px;
  border: 1px solid var(--border); background: var(--gold-faint);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 10px;
  letter-spacing: 1px; color: var(--gold); cursor: pointer;
}

/* Mobile navbar */
.viewport-mobile .navbar-sep,
.viewport-mobile .navbar-subtitle,
.viewport-mobile .status-label { display: none; }

/* Options toggle button - visible only on mobile/tablet */
.viewport-desktop .options-toggle { display: none !important; }
.viewport-tablet .options-toggle,
.viewport-mobile .options-toggle { display: flex !important; }

/* Claude toggle - ensure it's visible and responsive on all viewports */
.viewport-mobile .claude-toggle {
  gap: 6px;
}
.viewport-mobile .claude-toggle-label {
  font-size: 9px;
}
.viewport-mobile .claude-toggle-slider {
  width: 38px;
  height: 20px;
}
.viewport-mobile .claude-toggle-slider::before {
  width: 16px;
  height: 16px;
}

/* ══════════════════════════════════════════════════════════
   LAYOUT BODY
   ══════════════════════════════════════════════════════════ */
.layout-body {
  position: relative; z-index: 1;
  flex: 1; display: flex; overflow: hidden; min-height: 0;
}

/* ── SIDEBAR OVERLAY ────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: absolute; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 40;
  backdrop-filter: blur(3px);
}
.sidebar-overlay.visible { display: block; }

/* ══════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════ */
.sidebar {
  width: 272px; min-width: 272px; flex-shrink: 0;
  background: var(--surface2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width 0.26s cubic-bezier(.4,0,.2,1), min-width 0.26s cubic-bezier(.4,0,.2,1);
}
.sidebar.closed { width: 0; min-width: 0; }

/* Mobile sidebar */
.viewport-tablet .sidebar,
.viewport-mobile .sidebar {
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 50;
  box-shadow: 4px 0 40px rgba(0,0,0,0.8);
  width: calc(100vw - 40px); min-width: calc(100vw - 40px);
}
.viewport-tablet .sidebar.closed,
.viewport-mobile .sidebar.closed { width: 0; min-width: 0; }
.viewport-mobile .sidebar { width: calc(100% - 40px); min-width: calc(100% - 40px); }

.sidebar-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-dim);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.sidebar-label {
  font-family: var(--font-mono); font-size: 13px;
  letter-spacing: 2.5px; color: var(--gold); opacity: 0.42;
  text-transform: uppercase;
}
.sidebar-new-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--border-dim); background: transparent;
  cursor: pointer; color: var(--gold); opacity: 0.5;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
  transition: opacity 0.2s;
}
.sidebar-new-btn:hover { opacity: 1; }

.sidebar-search {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-dim);
  flex-shrink: 0;
}
.search-input {
  width: 100%;
  background: rgba(170,120,25,0.03);
  border: 1px solid rgba(170,120,25,0.09);
  padding: 6px 10px;
  color: rgba(255,215,90,0.6);
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 1px; outline: none;
}
.search-input:focus { border-color: rgba(170,120,25,0.25); }

.sidebar-new-conv-btn {
  display: block; width: calc(100% - 28px); margin: 8px 14px;
  padding: 7px 12px;
  background: rgba(170,120,25,0.08); border: 1px solid var(--border);
  color: var(--gold); font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 1px; cursor: pointer; text-align: left;
  transition: background 0.2s, border-color 0.2s;
}
.sidebar-new-conv-btn:hover {
  background: rgba(170,120,25,0.18); border-color: var(--gold);
}

.sidebar-convs { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(170,120,25,0.2) transparent; }

.conv-group-label {
  padding: 10px 16px 4px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 2.5px; color: var(--gold); opacity: 0.27;
  text-transform: uppercase;
}
.conv-item {
  padding: 10px 16px; cursor: pointer;
  border-bottom: 1px solid rgba(170,120,25,0.04);
  border-left: 2px solid transparent;
  transition: background 0.12s;
}
.conv-item:hover { background: rgba(170,120,25,0.04); }
.conv-item.active {
  border-left-color: rgba(170,120,25,0.45);
  background: rgba(170,120,25,0.07);
  padding-left: 14px;
}
.conv-title {
  font-family: var(--font-body); font-size: 13px;
  color: var(--text-dim); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;
}
.conv-item.active .conv-title { color: var(--text); }
.conv-preview {
  font-family: var(--font-body); font-style: italic;
  font-size: 10px; color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.conv-footer {
  display: flex; justify-content: space-between; align-items: center;
}
.conv-time {
  font-family: var(--font-mono); font-size: 13px; color: var(--text-faint);
}
.conv-badge {
  background: rgba(170,120,25,0.22);
  border: 1px solid var(--border-dim);
  color: var(--gold);
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 5px;
}

/* Sidebar status widget */
.sidebar-status {
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-status-header {
  padding: 10px 16px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer;
  border-bottom: 1px solid var(--border-dim);
}
.sidebar-status-body {
  padding: 12px 16px 16px;
}
.sidebar-status-body.hidden { display: none; }

/* ══════════════════════════════════════════════════════════
   MAIN CHAT
   ══════════════════════════════════════════════════════════ */
.chat-main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; position: relative; min-width: 0;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 28px;
  display: flex; flex-direction: column; gap: 16px;
  scrollbar-width: thin; scrollbar-color: rgba(170,120,25,0.2) transparent;
}
.viewport-mobile .chat-messages { padding: 16px 14px; }

/* Session marker */
.session-marker {
  display: flex; align-items: center; gap: 14px; padding: 4px 0;
}
.marker-line { flex: 1; height: 1px; background: var(--border-dim); }
.marker-text {
  font-family: var(--font-mono); font-size: 13px;
  letter-spacing: 2px; color: var(--text-faint);
  text-transform: uppercase; white-space: nowrap;
}

/* ── MESSAGES ───────────────────────────────────────────── */
.msg {
  display: flex; gap: 11px; align-items: flex-start; max-width: 700px;
}
.msg.user { margin-left: auto; flex-direction: row-reverse; }
.msg-avatar {
  width: 28px; height: 28px; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--gold-faint);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 10px;
  color: var(--gold); letter-spacing: 0.5px;
}
.msg-content { max-width: calc(100% - 40px); }
.msg-bubble {
  padding: 11px 16px;
  font-family: var(--font-body); font-size: 14px; line-height: 1.72;
  border: 1px solid; white-space: pre-wrap;
}
.msg.ai .msg-bubble {
  background: rgba(170,120,25,0.04);
  border-color: rgba(170,120,25,0.09);
  color: rgba(255,255,255,0.95);
}
.msg.user .msg-bubble {
  font-size: 16px;
  background: rgba(200,158,28,0.07);
  border-color: rgba(200,158,28,0.18);
  color: rgba(255,255,255,0.95);
}
.msg-meta {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-faint); margin-top: 4px;
}
.msg.user .msg-meta { text-align: right; }

/* Markdown styles in messages */
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
  font-family: var(--font-display);
  color: var(--gold);
  margin: 12px 0 8px 0;
  font-weight: 700;
}
.msg-bubble h1 { font-size: 18px; letter-spacing: 1px; }
.msg-bubble h2 { font-size: 16px; letter-spacing: 0.8px; }
.msg-bubble h3 { font-size: 15px; letter-spacing: 0.6px; }

.msg-bubble code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(170, 120, 25, 0.2);
  padding: 2px 6px;
  border-radius: 3px;
  color: rgba(255, 220, 50, 1);
}

.msg-bubble pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(170, 120, 25, 0.25);
  border-left: 3px solid var(--gold);
  padding: 10px 12px;
  margin: 8px 0;
  overflow-x: auto;
  border-radius: 4px;
}

.msg-bubble pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
}

.msg-bubble a {
  color: var(--gold);
  text-decoration: underline;
  transition: opacity 0.2s;
}
.msg-bubble a:hover {
  opacity: 0.8;
}

.msg-bubble ul {
  margin: 8px 0;
  padding-left: 20px;
  list-style-type: none;
}

.msg-bubble li {
  position: relative;
  margin: 4px 0;
}

.msg-bubble li::before {
  content: "▸";
  position: absolute;
  left: -16px;
  color: var(--gold);
  font-size: 10px;
}

.msg-bubble strong {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
}

.msg-bubble em {
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
}

.msg-bubble p {
  margin: 0;
  padding: 0;
}

.msg-bubble p + p {
  margin-top: 8px;
}

/* Tables */
.msg-bubble .table-wrap {
  overflow-x: auto;
  margin: 10px 0;
  -webkit-overflow-scrolling: touch;
}

.msg-bubble table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  font-family: var(--font-mono);
}

.msg-bubble th {
  background: rgba(170, 120, 25, 0.12);
  border: 1px solid rgba(170, 120, 25, 0.25);
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gold);
}

.msg-bubble td {
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 5px 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}

.msg-bubble tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

/* Blockquotes */
.msg-bubble blockquote {
  border-left: 3px solid var(--gold);
  padding: 6px 12px;
  margin: 8px 0;
  font-style: italic;
  background: rgba(170, 120, 25, 0.06);
  color: rgba(255, 255, 255, 0.85);
}

/* Ordered lists */
.msg-bubble ol {
  margin: 8px 0;
  padding-left: 24px;
  list-style-type: decimal;
}

.msg-bubble ol li {
  margin: 4px 0;
}

.msg-bubble ol li::before {
  content: none;
}

/* Strikethrough */
.msg-bubble del {
  text-decoration: line-through;
  opacity: 0.6;
}

/* Horizontal rules */
.msg-bubble hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 12px 0;
  opacity: 0.5;
}

/* Artifact preview button in messages */
.artifact-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 12px;
  background: rgba(170, 120, 25, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}
.artifact-preview-btn:hover {
  background: rgba(170, 120, 25, 0.25);
  box-shadow: 0 0 10px rgba(170, 120, 25, 0.3);
}

/* Typing cursor */
.typing-cursor {
  display: inline-block; width: 2px; height: 13px;
  background: var(--gold); margin-left: 2px; vertical-align: middle;
  animation: blinkCursor 0.8s steps(1) infinite;
}

/* Typing indicator */
.typing-indicator {
  display: flex; gap: 11px; align-items: flex-start;
}
.typing-dots {
  display: flex; align-items: center; gap: 4px;
  padding: 12px 16px;
  background: rgba(170,120,25,0.04);
  border: 1px solid rgba(170,120,25,0.09);
}
.typing-dot {
  width: 5px; height: 5px;
  background: rgba(200,158,28,0.45); border-radius: 50%;
}
.typing-dot:nth-child(1) { animation: typingDot 1.2s ease-in-out 0s infinite; }
.typing-dot:nth-child(2) { animation: typingDot 1.2s ease-in-out 0.2s infinite; }
.typing-dot:nth-child(3) { animation: typingDot 1.2s ease-in-out 0.4s infinite; }

/* ── INPUT AREA ─────────────────────────────────────────── */
.chat-input-area {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border-dim);
  background: rgba(3,2,6,0.96); flex-shrink: 0;
}
.viewport-mobile .chat-input-area { padding: 10px 12px 12px; }

.input-box {
  position: relative; display: flex; align-items: flex-end; gap: 10px;
  background: var(--gold-faint);
  border: 1px solid var(--border);
  padding: 10px 14px;
}

/* Ornaments */
.ornament {
  position: absolute; width: 10px; height: 10px;
  border-color: var(--gold-dim); border-style: solid;
}
.ornament.tl { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.ornament.tr { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.ornament.bl { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.ornament.br { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.input-box textarea {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: var(--font-body); font-size: 14px;
  color: var(--gold); resize: none;
  max-height: 100px; line-height: 1.5; scrollbar-width: none;
}
.input-box textarea::-webkit-scrollbar { display: none; }
.input-box textarea::placeholder { color: var(--text-faint); }

.input-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.attach-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; color: var(--gold); font-size: 18px; font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; border-radius: 6px;
}
.attach-btn:hover { background: var(--gold-faint); color: var(--gold); }

.send-btn {
  height: 30px; padding: 0 16px;
  border: 1px solid var(--gold-dim);
  background: var(--gold-faint);
  cursor: pointer;
  font-family: var(--font-display); font-size: 10px;
  letter-spacing: 2px; color: var(--gold);
  transition: all 0.2s; white-space: nowrap;
}
.send-btn:hover { background: var(--gold-glow); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.viewport-mobile .attach-btn { display: none; }
.viewport-mobile .send-btn { padding: 0 12px; }

/* ── FILE PREVIEW BAR ──────────────────────────────────────── */
.file-preview-bar {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 6px 10px; margin-bottom: 4px;
}
.file-preview-bar.hidden { display: none; }
.file-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px 4px 6px;
  background: var(--gold-faint);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-dim);
  max-width: 220px;
}
.file-chip-icon { font-size: 13px; flex-shrink: 0; }
.file-chip-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-chip-size {
  font-size: 9px; color: var(--text-faint); flex-shrink: 0;
}
.file-chip-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-faint); font-size: 14px; padding: 0 2px;
  line-height: 1; transition: color 0.15s;
}
.file-chip-remove:hover { color: var(--danger); }

.input-meta {
  display: flex; justify-content: space-between;
  margin-top: 7px; padding: 0 2px;
}
.input-meta-left { display: flex; gap: 16px; }
.input-meta-left span, .input-meta-right {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-faint); letter-spacing: 0.5px;
}
.input-meta-left em {
  color: var(--gold); opacity: 0.6; font-style: normal;
}
.viewport-mobile .input-meta { display: none; }

/* ══════════════════════════════════════════════════════════
   RIGHT PANEL
   ══════════════════════════════════════════════════════════ */
.right-panel {
  width: 256px; min-width: 256px; flex-shrink: 0;
  background: var(--surface2);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.right-panel-scroll {
  flex: 1; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(170,120,25,0.2) transparent;
}
.viewport-tablet .right-panel,
.viewport-mobile .right-panel { display: none; }

/* ── ARTIFACT PANEL ─────────────────────────────────────── */
.artifact-panel {
  position: fixed;
  top: 60px;
  right: 20px;
  width: 600px;
  height: calc(100vh - 80px);
  background: var(--surface);
  border: 2px solid var(--gold);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.artifact-panel.hidden {
  transform: translateX(120%);
  opacity: 0;
  pointer-events: none;
}
.artifact-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(170, 120, 25, 0.08);
  border-bottom: 1px solid var(--border);
}
.artifact-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.artifact-icon {
  font-size: 16px;
}
.artifact-name {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.artifact-actions {
  display: flex;
  gap: 8px;
}
.artifact-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-dim);
  background: transparent;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.artifact-btn:hover {
  background: rgba(170, 120, 25, 0.1);
  border-color: var(--gold);
  color: var(--gold);
}
.artifact-body {
  flex: 1;
  background: #fff;
  overflow: hidden;
  position: relative;
}
.artifact-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Responsive artifact panel */
.viewport-tablet .artifact-panel {
  width: calc(100vw - 40px);
  right: 20px;
  left: 20px;
}
.viewport-mobile .artifact-panel {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  top: 0;
  right: 0;
  left: 0;
  border-radius: 0;
}

/* ── ACCORDION ──────────────────────────────────────────── */
.acc-section { border-bottom: 1px solid var(--border-dim); flex-shrink: 0; }
.acc-header {
  padding: 11px 16px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer;
}
.acc-header span:first-child {
  font-family: var(--font-mono); font-size: 13px;
  letter-spacing: 2.5px; color: var(--gold); opacity: 0.42;
  text-transform: uppercase;
}
.acc-arrow {
  color: var(--gold); opacity: 0.35; font-size: 10px;
  transition: transform 0.2s; display: inline-block;
}
.acc-arrow.open { transform: rotate(180deg); }
.acc-body { padding: 0 16px 14px; }
.acc-body.hidden { display: none; }

/* ── USAGE BAR ──────────────────────────────────────────── */
.usage-bar { margin-bottom: 10px; }
.usage-bar-header {
  display: flex; justify-content: space-between; margin-bottom: 5px;
}
.usage-bar-label {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-faint); letter-spacing: 0.5px;
}
.usage-bar-value {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--gold); opacity: 0.75;
}
.usage-bar-track { height: 2px; background: rgba(170,120,25,0.1); }
.usage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-dim));
  transition: width 0.4s;
}

/* ── STAT ROW ───────────────────────────────────────────── */
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(170,120,25,0.04);
}
.stat-key {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-faint); letter-spacing: 1px; text-transform: uppercase;
}
.stat-val {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--gold); opacity: 0.75;
}
.stat-val.success { color: var(--success); }

/* ── DIVIDER ────────────────────────────────────────────── */
.gold-divider {
  height: 1px; margin: 10px 0 8px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

/* ── MODEL CARD ─────────────────────────────────────────── */
.model-card {
  border: 1px solid var(--border-dim);
  background: var(--gold-faint);
  padding: 10px 12px; margin-bottom: 10px;
}
.model-card-name {
  font-family: var(--font-display); font-size: 10px;
  letter-spacing: 3px; color: var(--gold); margin-bottom: 3px;
}
.model-card-desc {
  font-family: var(--font-body); font-style: italic;
  font-size: 10px; color: var(--text-faint);
}

/* ── SYSTEM PROMPT ──────────────────────────────────────── */
.system-prompt-text {
  font-family: var(--font-body); font-style: italic;
  font-size: 10px; color: var(--text-faint); line-height: 1.65;
  border-left: 2px solid rgba(170,120,25,0.22);
  padding-left: 10px; margin-bottom: 10px;
}
.modify-btn {
  width: 100%; background: transparent;
  border: 1px solid var(--border-dim);
  padding: 6px 0;
  font-family: var(--font-display); font-size: 10px;
  letter-spacing: 2px; color: var(--gold); opacity: 0.5;
  cursor: pointer; text-transform: uppercase;
  transition: opacity 0.2s;
}
.modify-btn:hover { opacity: 1; }

/* ── CONTEXT TAGS ───────────────────────────────────────── */
.tags-wrap { display: flex; flex-wrap: wrap; gap: 5px; }
.context-tag {
  font-family: var(--font-mono); font-size: 13px;
  letter-spacing: 1px; padding: 2px 8px;
  border: 1px solid var(--border-dim);
  color: var(--text-faint); background: transparent;
  cursor: pointer; transition: all 0.15s;
}
.context-tag.active {
  border-color: rgba(170,120,25,0.32);
  color: var(--gold);
  background: var(--gold-faint);
}

/* ── VPS GRID ───────────────────────────────────────────── */
.vps-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; margin-bottom: 10px;
}
.vps-card {
  background: var(--gold-faint);
  border: 1px solid var(--border-dim);
  padding: 8px 10px; text-align: center;
}
.vps-card-val {
  display: block;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--gold); margin-bottom: 2px;
}
.vps-card-val.ok { color: var(--success); }
.vps-card-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 1px; color: var(--text-faint); text-transform: uppercase;
}

/* ── SHORTCUT ROW ───────────────────────────────────────── */
.shortcut-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(170,120,25,0.03);
}
.shortcut-action {
  font-family: var(--font-body); font-size: 13px; color: var(--text-faint);
}
.shortcut-key {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--gold); opacity: 0.5;
  border: 1px solid var(--border-dim);
  padding: 1px 6px; background: var(--gold-faint);
}

/* ══════════════════════════════════════════════════════════
   LOGIN MODAL
   ══════════════════════════════════════════════════════════ */
.login-modal {
  position: fixed; inset: 0; z-index: 9000;
  display: grid; place-items: center;
  background: rgba(3,2,6,0.85);
  backdrop-filter: blur(6px);
}
.login-modal.hidden { display: none; }
.login-card {
  width: min(440px, 92vw);
  padding: 28px;
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
}
.login-title {
  font-family: var(--font-display); font-size: 13px;
  letter-spacing: 4px; color: var(--gold);
  margin-bottom: 6px; text-transform: uppercase;
}
.login-subtitle {
  font-family: var(--font-body); font-style: italic;
  font-size: 10px; color: var(--text-faint);
  margin: 0 0 20px;
}
.login-hint {
  font-family: var(--font-body); font-style: italic;
  font-size: 10px; color: var(--text-faint);
  margin: 10px 0 0;
  text-align: center;
}
.login-form { display: grid; gap: 10px; }
.login-input {
  border: 1px solid var(--border);
  background: var(--gold-faint);
  color: var(--gold);
  padding: 10px 14px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 1px; outline: none;
}
.login-input:focus { border-color: var(--gold-dim); }
.login-input::placeholder { color: var(--text-faint); }
.login-submit {
  padding: 10px;
  border: 1px solid var(--gold-dim);
  background: var(--gold-faint);
  font-family: var(--font-display); font-size: 10px;
  letter-spacing: 3px; color: var(--gold);
  cursor: pointer; text-transform: uppercase;
  transition: all 0.2s;
}
.login-submit:hover { background: rgba(170,120,25,0.2); }
.login-submit.admin {
  background: transparent;
  border-color: var(--border-dim);
  font-size: 10px; opacity: 0.6;
}
.login-submit.admin:hover { opacity: 1; }
.login-divider {
  height: 1px; margin: 20px 0;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}
.admin-panel { margin-top: 12px; }
.admin-title {
  font-family: var(--font-mono); font-size: 13px;
  letter-spacing: 2px; color: var(--gold); opacity: 0.5;
  text-transform: uppercase;
}
/* ── ADMIN DASHBOARD ────────────────────────────────────── */
.admin-dashboard-card {
  width: 90vw;
  max-width: 900px;
  max-height: 85vh;
  background: var(--surface);
  border: 2px solid var(--gold);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(170, 120, 25, 0.08);
  border-bottom: 1px solid var(--border);
}

.admin-dashboard-title {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.admin-close-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-dim);
  background: transparent;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 14px;
  transition: all 0.2s;
}

.admin-close-btn:hover {
  background: rgba(170, 120, 25, 0.1);
  border-color: var(--gold);
  color: var(--gold);
}

.admin-dashboard-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-dim);
}

.admin-tab {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-tab:hover {
  background: rgba(170, 120, 25, 0.1);
  border-color: var(--border-dim);
}

.admin-tab.active {
  background: rgba(170, 120, 25, 0.15);
  border-color: var(--gold);
  color: var(--gold);
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

.admin-user-grid {
  display: grid;
  gap: 12px;
}

.admin-user-card {
  background: rgba(170, 120, 25, 0.03);
  border: 1px solid var(--border-dim);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.admin-user-card:hover {
  background: rgba(170, 120, 25, 0.06);
  border-color: var(--gold);
}

.admin-user-info {
  flex: 1;
}

.admin-user-name {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text);
  margin-bottom: 4px;
}

.admin-user-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
  display: flex;
  gap: 12px;
}

.admin-user-actions {
  display: flex;
  gap: 6px;
}

.admin-action-btn {
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-action-btn:hover {
  background: rgba(170, 120, 25, 0.15);
  border-color: var(--gold);
  color: var(--gold);
}

.admin-action-btn.danger:hover {
  background: rgba(192, 57, 43, 0.15);
  border-color: #c0392b;
  color: #c0392b;
}

.admin-badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 8px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 2px;
  margin-left: 8px;
}

.admin-badge.disabled {
  background: rgba(192, 57, 43, 0.2);
  color: #c0392b;
  border: 1px solid #c0392b;
}

.admin-badge.expired {
  background: rgba(243, 156, 18, 0.2);
  color: #f39c12;
  border: 1px solid #f39c12;
}

.admin-profiles {
  white-space: pre-wrap;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-dim); margin-top: 6px;
}

/* ══════════════════════════════════════════════════════════
   VIEWPORT SWITCHER
   ══════════════════════════════════════════════════════════ */
