:root {
  color-scheme: dark;
  --bg: #071019;
  --bg-strong: #0b1420;
  --panel: rgba(11, 18, 29, 0.82);
  --panel-strong: rgba(15, 24, 39, 0.94);
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(131, 157, 192, 0.18);
  --border-strong: rgba(244, 181, 90, 0.34);
  --text: #f0f5ff;
  --muted: #95a8c3;
  --accent: #f4b55a;
  --accent-2: #5cd4ff;
  --accent-3: #ff6f61;
  --danger: #ff8585;
  --success: #b7f961;
  --shadow: 0 28px 60px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 14px 28px rgba(0, 0, 0, 0.18);
  --glow: 0 0 0 1px rgba(244, 181, 90, 0.18), 0 22px 54px rgba(0, 0, 0, 0.32);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --font-ui: "Sora", system-ui, sans-serif;
  --font-display: "Syne", var(--font-ui);
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 111, 97, 0.2), transparent 24%),
    radial-gradient(circle at 84% 16%, rgba(92, 212, 255, 0.15), transparent 22%),
    radial-gradient(circle at 52% 108%, rgba(244, 181, 90, 0.12), transparent 36%),
    linear-gradient(180deg, #05080d 0%, #09111b 48%, #060a11 100%);
  background-attachment: fixed;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(transparent 0 48%, rgba(255, 255, 255, 0.035) 49%, transparent 50%);
  background-size: 46px 46px, 46px 46px, 100% 6px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.88), transparent 92%);
  opacity: 0.24;
}

body::after {
  background:
    radial-gradient(circle at 24% 76%, rgba(244, 181, 90, 0.08), transparent 20%),
    radial-gradient(circle at 74% 64%, rgba(92, 212, 255, 0.08), transparent 22%),
    radial-gradient(circle at 58% 28%, rgba(255, 79, 156, 0.08), transparent 18%);
  animation: drift 16s ease-in-out infinite alternate;
  opacity: 0.8;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(0, -10px, 0) scale(1.02);
  }
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.panel {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.008)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.panel::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(92, 212, 255, 0.54), rgba(244, 181, 90, 0.54), transparent);
  opacity: 0.72;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.08) 44%, transparent 62%);
  transform: translateX(-140%);
  transition: transform 780ms ease;
  pointer-events: none;
}

.panel:hover::after {
  transform: translateX(136%);
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lead,
.helper-text,
.muted-copy {
  color: var(--muted);
}

.lead {
  margin: 0;
  line-height: 1.7;
}

.helper-text {
  margin: 0;
  line-height: 1.6;
  font-size: 0.94rem;
}

.site-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.35rem;
  background: rgba(7, 12, 20, 0.72);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.brand-lockup {
  display: inline-grid;
  gap: 0.12rem;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-subline {
  color: var(--muted);
  font-size: 0.82rem;
}

.topbar-tools,
.workspace-topbar-right,
.metric-strip,
.auth-actions,
.toggle-group,
.stage-footer,
.drawer-actions,
.stack-actions,
.asset-actions,
.section-head-wrap {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.workspace-topbar-right {
  align-items: center;
  justify-content: flex-end;
}

.metric-strip {
  align-items: center;
}

.metric-chip,
.mini-summary,
.metric-card {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.8rem;
  padding: 0 1rem;
}

.metric-chip strong {
  font-size: 0.96rem;
}

.metric-chip span {
  color: var(--muted);
  font-size: 0.82rem;
}

.mini-summary {
  display: inline-grid;
  justify-items: end;
  gap: 0.1rem;
  padding: 0.65rem 0.9rem;
}

.mini-summary span,
.mini-summary small {
  display: block;
}

.mini-summary span {
  font-weight: 700;
}

.mini-summary small {
  color: var(--muted);
}

.button,
.button-secondary,
.mini-btn,
.toggle-chip,
.drawer-tab,
.profile-trigger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.button,
.button-secondary,
.mini-btn,
.toggle-chip,
.drawer-tab {
  position: relative;
  overflow: hidden;
}

.button::after,
.button-secondary::after,
.mini-btn::after,
.toggle-chip::after,
.drawer-tab::after {
  content: "";
  position: absolute;
  inset: auto -32% 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.82), transparent);
  opacity: 0;
  transform: translateX(-24%);
  transition: opacity 180ms ease, transform 220ms ease;
}

.button::before,
.button-secondary::before,
.mini-btn::before,
.toggle-chip::before,
.drawer-tab::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.12) 44%, transparent 60%);
  transform: translateX(-136%);
  transition: transform 560ms ease;
  pointer-events: none;
}

.button:hover::after,
.button-secondary:hover::after,
.mini-btn:hover::after,
.toggle-chip:hover::after,
.drawer-tab:hover::after {
  opacity: 1;
  transform: translateX(18%);
}

.button:hover::before,
.button-secondary:hover::before,
.mini-btn:hover::before,
.toggle-chip:hover::before,
.drawer-tab:hover::before {
  transform: translateX(132%);
}

.button:hover,
.button-secondary:hover,
.mini-btn:hover,
.toggle-chip:hover,
.drawer-tab:hover,
.profile-trigger:hover {
  transform: translateY(-2px) rotate(-0.45deg);
  box-shadow: var(--glow);
}

.mini-btn:hover,
.toggle-chip:hover,
.drawer-tab:hover,
.profile-trigger:hover {
  transform: none;
}

.button {
  min-height: 3.25rem;
  padding: 0 1.3rem;
  background: linear-gradient(135deg, #f4b55a 0%, #ff8a5d 100%);
  color: #11161d;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.button-secondary,
.mini-btn,
.toggle-chip,
.drawer-tab,
.profile-trigger {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
  border-color: var(--border);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.button-secondary {
  min-height: 3.05rem;
  padding: 0 1.12rem;
}

.mini-btn {
  min-height: 2.7rem;
  padding: 0.12rem 0.98rem;
  font-size: 0.9rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.15;
}

.mini-btn.danger,
.danger {
  border-color: rgba(255, 133, 133, 0.24);
  color: #ffd4d4;
}

.toggle-chip,
.drawer-tab {
  min-height: 2.7rem;
  padding: 0 1rem;
  color: var(--muted);
}

.toggle-chip.is-active,
.drawer-tab.is-active {
  color: #101722;
  border-color: transparent;
  background: linear-gradient(135deg, rgba(214, 255, 0, 0.92), rgba(255, 243, 154, 0.96) 52%, rgba(255, 114, 53, 0.94));
  box-shadow: inset 0 0 0 1px rgba(5, 8, 13, 0.08), 0 10px 20px rgba(0, 0, 0, 0.16);
}

.toggle-chip.is-active:hover,
.drawer-tab.is-active:hover,
.button:hover {
  color: #101722;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 3rem;
  padding: 0.38rem 0.42rem 0.38rem 0.5rem;
}

.profile-trigger-copy {
  display: inline-grid;
  text-align: left;
  gap: 0.12rem;
}

.profile-trigger-copy strong {
  font-size: 0.92rem;
}

.profile-trigger-copy small {
  color: var(--muted);
  font-size: 0.76rem;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  object-fit: cover;
}

.avatar-small {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.field {
  display: grid;
  gap: 0.65rem;
}

.field span {
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.04em;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0;
  background: rgba(5, 11, 18, 0.72);
  color: var(--text);
  padding: 0.95rem 1rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(92, 212, 255, 0.34);
  box-shadow: 0 0 0 4px rgba(92, 212, 255, 0.08);
}

.field textarea {
  min-height: 260px;
  resize: vertical;
}

.compact-field input,
.compact-field textarea {
  padding-block: 0.82rem;
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.7rem;
}

.status-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(10, 16, 26, 0.94);
  box-shadow: var(--shadow);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.status-toast[data-tone="success"] {
  border-color: rgba(183, 249, 97, 0.28);
}

.status-toast[data-tone="error"] {
  border-color: rgba(255, 133, 133, 0.36);
}

.auth-shell {
  min-height: calc(100vh - 86px);
  display: grid;
  place-items: center;
  padding: 1.6rem;
}

.auth-card {
  width: min(36rem, 100%);
  padding: 2rem;
}

.auth-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4vw, 3.45rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.auth-lead {
  max-width: 36rem;
  margin-top: 0.35rem;
}

.auth-hint {
  margin-top: 1rem;
}

.auth-form {
  display: grid;
  gap: 0.95rem;
  margin-top: 1rem;
}

.pending-card {
  margin-top: 1rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  display: grid;
  gap: 0.9rem;
}

.pending-card h2 {
  margin: 0;
  font-size: 1.18rem;
}

.pending-copy {
  display: grid;
  gap: 0.35rem;
}

.workspace-main {
  width: min(1400px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2.6rem;
  display: grid;
  gap: 1rem;
}

.primary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 1rem;
}

.upload-stage,
.recent-stage,
.library-stage,
.drawer,
.modal {
  padding: 1.35rem;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.compact-head {
  align-items: center;
}

.section-head h1,
.section-head h2,
.section-head h3,
.drawer-profile h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

.section-head h1 {
  font-size: clamp(1.65rem, 2vw, 2.1rem);
}

.section-head h2,
.drawer-profile h2 {
  font-size: 1.3rem;
}

.drop-zone {
  display: grid;
  justify-items: center;
  gap: 0.95rem;
  min-height: 220px;
  padding: 1.6rem 1.2rem;
  border: 1px dashed rgba(244, 181, 90, 0.34);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(244, 181, 90, 0.12), transparent 28%),
    rgba(8, 14, 22, 0.56);
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}

.drop-zone.is-dragover {
  border-color: rgba(92, 212, 255, 0.52);
  transform: translateY(-2px);
}

.drop-copy {
  display: grid;
  gap: 0.45rem;
  justify-items: center;
  text-align: center;
}

.drop-copy strong {
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.upload-local-preview,
.text-live-preview {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(4, 9, 15, 0.52);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.upload-local-preview {
  min-height: 220px;
  margin-top: 0.9rem;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.preview-placeholder {
  padding: 1.1rem;
  color: var(--muted);
  text-align: center;
}

.local-image-preview,
.local-video-preview {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.local-audio-preview {
  width: min(520px, calc(100% - 2rem));
}

.local-pdf-preview {
  display: block;
  width: 100%;
  min-height: 460px;
  border: 0;
  background: #0a111a;
}

.local-text-preview,
.text-live-preview,
.asset-text-preview,
.config-value {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
}

.local-text-preview {
  width: 100%;
  max-height: 360px;
  padding: 1.1rem;
  overflow: auto;
}

.text-live-preview {
  max-height: 320px;
  padding: 1rem;
  overflow: auto;
}

.name-field {
  margin-top: 0.9rem;
}

.text-stage-grid,
.split-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
}

.text-stage-pane,
.split-preview-pane {
  display: grid;
  gap: 0.6rem;
  min-width: 0;
}

.text-stage-pane > span,
.split-preview-label {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.text-rendered-preview,
.split-preview-rendered,
.split-preview-source,
.generic-file-preview {
  min-height: 0;
  border: 1px solid var(--border);
  background: rgba(6, 11, 18, 0.68);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.text-rendered-preview,
.split-preview-rendered {
  max-height: 240px;
  padding: 0.9rem 1rem;
  overflow: auto;
}

.split-preview-source {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.markdown-preview {
  color: var(--text);
  line-height: 1.7;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4 {
  margin: 0.1rem 0 0.75rem;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

.markdown-preview p,
.markdown-preview ul,
.markdown-preview ol,
.markdown-preview blockquote {
  margin: 0 0 0.9rem;
}

.markdown-preview ul,
.markdown-preview ol {
  padding-left: 1.2rem;
}

.markdown-preview code {
  font-family: var(--font-mono);
  font-size: 0.94em;
  padding: 0.14rem 0.34rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
}

.markdown-preview pre {
  margin: 0 0 0.9rem;
  padding: 1rem;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
}

.markdown-preview blockquote {
  padding: 0.8rem 0.95rem;
  border-left: 3px solid var(--accent-2);
  background: rgba(255, 255, 255, 0.03);
}

.markdown-preview a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 181, 90, 0.38);
  pointer-events: auto;
}

.markdown-preview a:hover {
  color: #fff39a;
}

.generic-file-preview {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.55rem;
  padding: 1.2rem;
  text-align: center;
}

.generic-file-preview strong,
.generic-file-preview span {
  overflow-wrap: anywhere;
}

.stage-footer {
  align-items: flex-start;
  margin-top: 1rem;
}

.stage-footer .button {
  flex: 0 0 auto;
}

.result-card {
  min-width: min(28rem, 100%);
  padding: 1rem 1.1rem;
  border: 1px solid rgba(244, 181, 90, 0.24);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.result-card strong {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.5;
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.result-line {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}

.result-label {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.recent-grid,
.asset-grid,
.drawer-list,
.integration-grid,
.admin-form {
  display: grid;
  gap: 0.9rem;
}

.recent-grid {
  grid-template-columns: 1fr;
}

.recent-card,
.asset-card,
.activity-item,
.admin-item,
.integration-card,
.drawer-section,
.metric-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.recent-card,
.asset-card,
.activity-item,
.admin-item,
.integration-card,
.drawer-section {
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.recent-card:hover,
.asset-card:hover,
.activity-item:hover,
.admin-item:hover,
.integration-card:hover,
.drawer-section:hover {
  transform: translateY(-4px) rotate(-0.35deg);
  border-color: transparent;
  box-shadow: var(--glow);
}

.activity-item:hover,
.admin-item:hover,
.drawer-section:hover {
  transform: none;
}

.recent-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.75rem;
}

.recent-thumb {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(244, 181, 90, 0.12), rgba(92, 212, 255, 0.08)),
    rgba(8, 13, 20, 0.88);
  display: grid;
  place-items: center;
}

.recent-thumb img,
.recent-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-thumb .asset-text-preview {
  height: 100%;
  max-height: 100%;
  padding: 0.45rem;
  overflow: hidden;
  font-size: 0.62rem;
}

.recent-thumb .asset-icon {
  font-size: 0.72rem;
}

.recent-copy {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.recent-copy h3,
.asset-title-row h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.32;
  letter-spacing: -0.02em;
}

.recent-copy p,
.activity-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.recent-copy h3,
.config-value,
.asset-title-row h3 {
  overflow-wrap: anywhere;
}

.asset-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.asset-card {
  overflow: hidden;
}

.asset-preview {
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(244, 181, 90, 0.1), rgba(92, 212, 255, 0.08)),
    rgba(9, 14, 22, 0.92);
}

.asset-preview img,
.asset-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-text-preview {
  width: 100%;
  max-height: 220px;
  padding: 0.9rem;
  overflow: auto;
  font-size: 0.82rem;
}

.asset-preview .asset-text-preview {
  height: 100%;
  max-height: 100%;
  margin: 0;
  line-height: 1.5;
}

.asset-icon {
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.14em;
  font-size: 0.88rem;
}

.asset-body {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.asset-title-row {
  display: grid;
  gap: 0.25rem;
}

.asset-meta,
.activity-meta,
.muted-line,
.recent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.drawer-actions,
.asset-actions {
  align-items: center;
}

.drawer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.drawer-actions .mini-btn {
  width: 100%;
  white-space: normal;
  text-align: center;
  justify-content: center;
  padding: 0.5rem 0.98rem;
}

.asset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.asset-actions .mini-btn,
.drawer-actions .mini-btn {
  min-height: 2.55rem;
}

.empty-state {
  padding: 1.2rem;
  border: 1px dashed var(--border);
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(4, 8, 13, 0.6);
  backdrop-filter: blur(10px);
}

.overlay-drawer {
  display: flex;
  justify-content: flex-end;
  padding: 1rem;
}

.overlay-modal {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.drawer {
  width: min(34rem, 100%);
  height: calc(100vh - 2rem);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 1rem;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.drawer-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.drawer-tab {
  min-width: 0;
  white-space: normal;
  text-align: center;
  padding: 0.45rem 0.9rem;
}

.drawer-panel {
  min-height: 0;
  display: grid;
  align-content: flex-start;
  gap: 1rem;
  overflow: auto;
  padding-right: 0.1rem;
}

#drawerPanelAccount {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.drawer-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.metric-card {
  padding: 0.95rem;
  border-radius: 18px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.28rem;
}

.metric-card strong {
  display: block;
  font-size: 1.04rem;
}

.drawer-section {
  padding: 1rem;
}

.account-access-section {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.activity-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.activity-item,
.admin-item {
  padding: 0.95rem;
}

.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.integration-grid {
  grid-template-columns: 1fr;
}

.integration-card {
  padding: 1rem;
}

.integration-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.integration-head h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.config-stack {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.95rem;
}

.chatterino-stack {
  margin-top: 1rem;
}

.config-row {
  display: grid;
  gap: 0.3rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.14);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  transition: transform 170ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.config-row:hover {
  transform: translateY(-2px);
  border-color: transparent;
  box-shadow: var(--glow);
}

.config-row.is-emphasized {
  border-color: rgba(214, 255, 0, 0.22);
  background:
    linear-gradient(135deg, rgba(214, 255, 0, 0.08), rgba(255, 114, 53, 0.06)),
    rgba(0, 0, 0, 0.18);
}

.config-row.is-emphasized .config-key {
  color: var(--accent);
}

.config-row.is-emphasized .config-value,
.config-row.is-emphasized .mini-btn {
  color: var(--text);
}

.config-row.is-emphasized .mini-btn {
  border-color: rgba(16, 23, 34, 0.12);
  background: rgba(255, 255, 255, 0.28);
}


.token-note {
  margin-top: 0;
}

#activityList {
  min-height: 0;
  overflow: auto;
  padding-right: 0.15rem;
}

.activity-section .section-head {
  margin-bottom: 0.8rem;
}

.activity-section .eyebrow {
  margin-bottom: 0.35rem;
}

.activity-section h3 {
  margin: 0;
  line-height: 1.1;
}

.config-key {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.config-copy {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.modal {
  width: min(34rem, 100%);
}

.search-field {
  width: min(22rem, 100%);
}

@media (max-width: 1120px) {
  .primary-layout {
    grid-template-columns: 1fr;
  }

  .recent-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .text-stage-grid,
  .split-preview {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .workspace-main {
    width: calc(100vw - 1rem);
  }

  .drawer {
    width: min(100%, 38rem);
  }

  .drawer-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-topbar,
  .workspace-topbar-right,
  .topbar-tools,
  .metric-strip,
  .auth-actions,
  .section-head,
  .drawer-header,
  .integration-head,
  .activity-head {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-shell,
  .workspace-main,
  .overlay-drawer,
  .overlay-modal {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .auth-card,
  .upload-stage,
  .recent-stage,
  .library-stage,
  .drawer,
  .modal {
    padding: 1rem;
  }

  .profile-trigger {
    width: 100%;
    justify-content: flex-start;
  }

  .metric-chip {
    justify-content: center;
  }

  .drawer-tabs {
    grid-template-columns: 1fr;
  }

  .drawer-actions {
    grid-template-columns: 1fr;
  }

  .inline-field {
    grid-template-columns: 1fr;
  }

  .search-field {
    width: 100%;
  }

  .recent-card {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .recent-thumb {
    width: 60px;
    height: 60px;
  }
}
