:root {
  --oi-bg: rgba(255, 255, 255, 0.85);
  --oi-card: rgba(255, 255, 255, 0.78);
  --oi-border: rgba(17, 24, 39, 0.10);
  --oi-shadow: 0 14px 32px rgba(17, 24, 39, 0.10);
  --oi-text: #0f172a;
  --oi-muted: rgba(15, 23, 42, 0.68);
  --oi-accent: #2563eb;
  --oi-accent-2: #7c3aed;
  --oi-danger: #ef4444;
  --oi-radius: 16px;
}

[data-theme="dark"] {
  --oi-bg: rgba(15, 17, 21, 0.92);
  --oi-card: rgba(22, 26, 33, 0.74);
  --oi-border: rgba(148, 163, 184, 0.16);
  --oi-shadow: 0 14px 38px rgba(0, 0, 0, 0.45);
  --oi-text: #e5e7eb;
  --oi-muted: rgba(226, 232, 240, 0.65);
  --oi-accent: #60a5fa;
  --oi-accent-2: #a78bfa;
  --oi-danger: #f87171;
}

html, body {
  height: 100%;
}

body.onlyideas-body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--oi-text);
}

.oi-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.oi-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr minmax(0, 2fr) 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background:
    linear-gradient(135deg, rgba(37,99,235,0.10), rgba(124,58,237,0.08)),
    var(--oi-bg);
  border-bottom: 1px solid var(--oi-border);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
}

.oi-back {
  justify-self: start;
  text-decoration: none;
  color: var(--oi-text);
  font-weight: 650;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--oi-border);
  background: rgba(255,255,255,0.55);
}
[data-theme="dark"] .oi-back { background: rgba(0,0,0,0.28); }
.oi-back:hover { border-color: rgba(37,99,235,0.35); }
.oi-back::before { content: "← "; opacity: 0.7; }

.oi-title-wrap {
  justify-self: center;
  text-align: center;
  line-height: 1.05;
}
.oi-title {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 15px;
}
.oi-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--oi-muted);
}

.oi-actions {
  justify-self: end;
  display: flex;
  gap: 10px;
  align-items: center;
}
.oi-user {
  font-size: 13px;
  color: var(--oi-muted);
  font-weight: 650;
}
.oi-login {
  text-decoration: none;
  color: var(--oi-text);
  font-weight: 650;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--oi-border);
  background: rgba(255,255,255,0.55);
}
[data-theme="dark"] .oi-login { background: rgba(0,0,0,0.28); }
.oi-login:hover { border-color: rgba(37,99,235,0.35); }

.oi-container {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 18px 14px 28px;
  box-sizing: border-box;
}

.oi-hero {
  margin: 6px 0 14px;
}
.oi-hero-card {
  border: 1px solid var(--oi-border);
  border-radius: var(--oi-radius);
  padding: 16px 16px 14px;
  background:
    radial-gradient(900px 380px at 10% 0%, rgba(37,99,235,0.10) 0%, rgba(255,255,255,0) 55%),
    radial-gradient(900px 380px at 90% 0%, rgba(124,58,237,0.10) 0%, rgba(255,255,255,0) 55%),
    var(--oi-card);
  box-shadow: var(--oi-shadow);
}
.oi-hero-kicker {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--oi-muted);
}
.oi-hero-title {
  margin: 10px 0 8px;
  font-size: 22px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.oi-hero-desc {
  margin: 0;
  color: var(--oi-muted);
  font-size: 14px;
  line-height: 1.45;
}

.oi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.oi-card {
  border: 1px solid var(--oi-border);
  border-radius: var(--oi-radius);
  background: var(--oi-card);
  box-shadow: var(--oi-shadow);
  padding: 14px;
}

.oi-card-wide { margin-top: 14px; }

.oi-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.oi-card-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.oi-card-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--oi-muted);
}
.oi-pill {
  flex: none;
  font-size: 12px;
  font-weight: 750;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(37,99,235,0.22);
  background: rgba(37,99,235,0.10);
  color: var(--oi-text);
}
.oi-pill-muted {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.10);
}

.oi-dropzone {
  border: 2px dashed rgba(37,99,235,0.35);
  background: rgba(37,99,235,0.06);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
[data-theme="dark"] .oi-dropzone { background: rgba(96,165,250,0.07); border-color: rgba(96,165,250,0.38); }
.oi-dropzone:hover { border-color: rgba(37,99,235,0.55); transform: translateY(-1px); }
.oi-dropzone.oi-dragover {
  border-color: rgba(124,58,237,0.65);
  background: rgba(124,58,237,0.09);
  transform: translateY(-2px);
}

.oi-file-input { display: none; }

.oi-dropzone-inner {
  display: flex;
  gap: 12px;
  align-items: center;
}
.oi-drop-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, rgba(37,99,235,0.95), rgba(124,58,237,0.95));
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22);
}
.oi-drop-title { font-weight: 850; font-size: 14px; }
.oi-drop-sub { margin-top: 4px; font-size: 12px; color: var(--oi-muted); }

.oi-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.oi-row.oi-row-wrap {
  flex-wrap: wrap;
  align-items: flex-end;
}

.oi-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.oi-label {
  font-size: 12px;
  font-weight: 750;
  color: var(--oi-muted);
}

.oi-select {
  border-radius: 12px;
  border: 1px solid var(--oi-border);
  background: rgba(255,255,255,0.62);
  color: var(--oi-text);
  padding: 10px 10px;
  font-weight: 750;
  outline: none;
}
[data-theme="dark"] .oi-select { background: rgba(0,0,0,0.24); }
.oi-select:focus { border-color: rgba(37,99,235,0.45); box-shadow: 0 0 0 4px rgba(37,99,235,0.12); }

.oi-divider {
  height: 1px;
  background: rgba(148,163,184,0.22);
  margin: 14px 0 12px;
}

.oi-card-subhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.oi-card-title-sm {
  font-size: 13px;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.oi-mmd {
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.45;
}

.oi-file-meta { font-size: 13px; color: var(--oi-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.oi-btn {
  border: 1px solid var(--oi-border);
  background: rgba(255,255,255,0.55);
  color: var(--oi-text);
  font-weight: 750;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, opacity 120ms ease;
}
[data-theme="dark"] .oi-btn { background: rgba(0,0,0,0.28); }
.oi-btn:hover { border-color: rgba(37,99,235,0.35); transform: translateY(-1px); }
.oi-btn:active { transform: translateY(0px); }
.oi-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.oi-btn-primary {
  border-color: rgba(37,99,235,0.30);
  background: linear-gradient(135deg, rgba(37,99,235,0.95), rgba(124,58,237,0.92));
  color: #ffffff;
}
.oi-btn-primary:hover { border-color: rgba(37,99,235,0.50); }

/* Ensure button/link colors are not overridden by global theme link rules */
.oi-shell a { text-decoration: none; }
.oi-shell a.oi-back,
.oi-shell a.oi-login,
.oi-shell a.oi-btn { color: var(--oi-text) !important; }
.oi-shell a.oi-btn-primary { color: #ffffff !important; }

/* Navigation overlay (gives instant click feedback on heavy pages) */
.oi-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.30);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}
.oi-nav-overlay.active { display: flex; }
.oi-nav-overlay-card {
  width: min(420px, calc(100% - 36px));
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,0.22);
  background: rgba(255,255,255,0.78);
  box-shadow: var(--oi-shadow);
  padding: 16px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
[data-theme="dark"] .oi-nav-overlay-card { background: rgba(0,0,0,0.30); border-color: rgba(148,163,184,0.18); }
.oi-nav-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(148,163,184,0.55);
  border-top-color: rgba(37,99,235,0.95);
  animation: oiNavSpin 0.9s linear infinite;
  flex: none;
}
@keyframes oiNavSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.oi-nav-overlay-text {
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--oi-text);
}

.oi-textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 14px;
  border: 1px solid var(--oi-border);
  padding: 12px 12px;
  background: rgba(255,255,255,0.62);
  color: var(--oi-text);
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  resize: vertical;
  min-height: 110px;
}
[data-theme="dark"] .oi-textarea { background: rgba(0,0,0,0.24); }
.oi-textarea:focus { border-color: rgba(37,99,235,0.45); box-shadow: 0 0 0 4px rgba(37,99,235,0.12); }

.oi-muted { font-size: 12px; color: var(--oi-muted); }

.oi-status {
  margin-top: 10px;
  font-size: 13px;
  color: var(--oi-muted);
  min-height: 18px;
}
.oi-status.oi-error { color: var(--oi-danger); }
.oi-status.oi-ok { color: var(--oi-accent); }

.oi-empty {
  border-radius: 14px;
  border: 1px dashed rgba(148,163,184,0.35);
  background: rgba(148,163,184,0.06);
  padding: 16px;
  text-align: center;
}
[data-theme="dark"] .oi-empty { background: rgba(148,163,184,0.08); border-color: rgba(148,163,184,0.25); }
.oi-empty-title { font-weight: 850; }
.oi-empty-sub { margin-top: 6px; font-size: 13px; color: var(--oi-muted); }

.oi-recent-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.oi-recent-item {
  border-radius: 14px;
  border: 1px solid var(--oi-border);
  background: rgba(255,255,255,0.55);
  padding: 12px;
}
[data-theme="dark"] .oi-recent-item { background: rgba(0,0,0,0.22); }

.oi-recent-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.oi-recent-head.oi-recent-head-stretch { align-items: stretch; }

.oi-recent-title {
  font-weight: 850;
  letter-spacing: -0.01em;
  font-size: 14px;
  line-height: 1.25;
}

.oi-recent-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--oi-muted);
  line-height: 1.35;
}
.oi-recent-sub a {
  color: var(--oi-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.oi-recent-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.oi-recent-actions.oi-recent-actions-col {
  flex-direction: column;
  align-items: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
}

.oi-btn.oi-btn-small {
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 11px;
}

.oi-pre {
  margin: 10px 0 0;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.22);
  background: rgba(148,163,184,0.07);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.45;
  max-height: 380px;
  overflow: auto;
}
[data-theme="dark"] .oi-pre { background: rgba(148,163,184,0.09); border-color: rgba(148,163,184,0.18); }

.oi-recent-details summary {
  cursor: pointer;
  user-select: none;
  font-weight: 750;
  color: var(--oi-text);
  margin-top: 10px;
}
.oi-recent-details summary::marker { color: rgba(37,99,235,0.65); }

.oi-history-item > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.oi-history-item > summary::-webkit-details-marker { display: none; }
.oi-history-item[open] > summary { margin-bottom: 10px; }
.oi-history-body { display: flex; flex-direction: column; gap: 10px; }

.oi-rendered {
  font-size: 14px;
  line-height: 1.6;
  color: var(--oi-text);
}

.oi-rendered > :first-child { margin-top: 0; }
.oi-rendered h1, .oi-rendered h2, .oi-rendered h3 {
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.oi-rendered h1 { font-size: 22px; }
.oi-rendered h2 { font-size: 18px; }
.oi-rendered h3 { font-size: 16px; }
.oi-rendered p { margin: 10px 0; }

.oi-rendered img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--oi-border);
  background: rgba(148,163,184,0.06);
}
[data-theme="dark"] .oi-rendered img { background: rgba(148,163,184,0.08); }

.oi-rendered table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  border: 1px solid var(--oi-border);
  border-radius: 14px;
  background: rgba(255,255,255,0.35);
}
[data-theme="dark"] .oi-rendered table { background: rgba(0,0,0,0.18); }
.oi-rendered th, .oi-rendered td {
  border: 1px solid rgba(148,163,184,0.22);
  padding: 8px 10px;
  vertical-align: top;
}
.oi-rendered th { font-weight: 850; background: rgba(148,163,184,0.08); }
[data-theme="dark"] .oi-rendered th { background: rgba(148,163,184,0.10); }

.oi-rendered pre, .oi-rendered code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.oi-rendered pre {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,0.22);
  background: rgba(148,163,184,0.07);
  overflow: auto;
}
[data-theme="dark"] .oi-rendered pre { background: rgba(148,163,184,0.09); border-color: rgba(148,163,184,0.18); }
.oi-rendered .tex-source { direction: ltr; unicode-bidi: isolate; }
.oi-rendered .tex-inline { white-space: normal; overflow-wrap: anywhere; }
.oi-rendered pre.tex-display {
  max-width: 100%;
  border-left: 3px solid var(--oi-accent);
  white-space: pre-wrap;
}

@media (min-width: 880px) {
  .oi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .oi-card-wide { grid-column: 1 / -1; }
  .oi-topbar { padding: 12px 18px; }
  .oi-container { padding: 22px 18px 32px; }
  .oi-hero-title { font-size: 26px; }
}
