:root {
  --bg: #0e1013;
  --bg-2: #15181d;
  --panel: #1a1e24;
  --line: #2a3039;
  --text: #e6e9ee;
  --muted: #8b95a5;
  --accent: #6fe3a1;
  --accent-2: #ffb547;
  --danger: #ff6b6b;
  --radius: 10px;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --pixel: 'Silkscreen', var(--mono);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font: 16px/1.6 var(--sans);
  background-image:
    radial-gradient(circle at 15% -10%, rgba(111, 227, 161, .08), transparent 40%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .88em; background: var(--bg-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.15rem; letter-spacing: .02em; }
.muted { color: var(--muted); }

/* ── topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; padding: 12px 24px;
  background: rgba(14, 16, 19, .9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--pixel); font-size: 1.1rem; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark { color: var(--bg); background: var(--accent); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; font-size: .8rem; }
.search { flex: 1; max-width: 460px; }
.search input { width: 100%; }
.user-area { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.who img, .who b { width: 28px; height: 28px; border-radius: 50%; }
.who b { display: grid; place-items: center; background: var(--accent-2); color: var(--bg); }
.who em { font-style: normal; font-family: var(--mono); font-size: .7rem; color: var(--accent-2); border: 1px solid var(--accent-2); border-radius: 4px; padding: 0 4px; margin-left: 4px; }

/* ── layout ── */
.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 28px 24px 60px; flex: 1; }
section { margin-top: 36px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.count { font-family: var(--mono); font-size: .8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 0 8px; margin-left: 6px; }
.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; text-align: center; padding: 18px 24px; }

.hero { padding: 24px 0 4px; }
.hero h1 { font-family: var(--pixel); font-size: clamp(2rem, 6vw, 3.4rem); margin: 0; color: var(--accent); text-shadow: 0 0 22px rgba(111, 227, 161, .35); }
.hero p { margin: 6px 0 0; color: var(--muted); font-size: 1.05rem; }
.demo-note { display: inline-block; margin-top: 14px !important; padding: 8px 12px; border: 1px dashed var(--accent-2); border-radius: 8px; color: var(--accent-2) !important; font-size: .88rem !important; }

/* ── botones / inputs ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: 600 .9rem var(--sans); padding: 8px 14px; border-radius: 8px;
  background: var(--accent); color: #0b1a12; border: 1px solid var(--accent);
  transition: transform .08s, filter .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); }
.btn.danger.ghost { color: var(--danger); }
.btn.danger.ghost:hover { border-color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: .8rem; }
.btn.google { width: 100%; justify-content: center; background: #fff; color: #222; border-color: #fff; }

input, textarea {
  font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; width: 100%;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111, 227, 161, .15); }
textarea { font-family: var(--mono); font-size: .9rem; line-height: 1.55; resize: vertical; min-height: 280px; }
label { display: block; font-size: .82rem; color: var(--muted); font-weight: 500; }
label input { margin-top: 4px; }

/* ── tarjetas ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 14px; }
.card {
  display: flex; gap: 12px; padding: 14px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.card-icon { font-size: 1.6rem; line-height: 1; }
.card-body { display: flex; flex-direction: column; min-width: 0; }
.card-body small { color: var(--muted); font-size: .8rem; line-height: 1.4; margin-top: 4px; }

.recent { list-style: none; padding: 0; margin: 12px 0 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.recent li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--panel); }
.recent li:first-child { border-top: 0; }
.recent .muted { font-family: var(--mono); font-size: .78rem; }

/* ── página ── */
.crumbs { font-family: var(--mono); font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs i { font-style: normal; opacity: .5; }
.crumbs span { color: var(--text); }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-top: 18px; flex-wrap: wrap; }
.page-icon { font-size: 2.6rem; line-height: 1; }
.page-head h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.2rem); }
.meta { margin: 4px 0 0; color: var(--muted); font-size: .85rem; }
.actions { margin-left: auto; display: flex; gap: 8px; }
.tag { font-family: var(--mono); font-size: .72rem; color: var(--accent-2); border: 1px solid var(--accent-2); border-radius: 4px; padding: 0 5px; }

.prose { margin-top: 24px; padding: 22px 26px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-top: 1.6em; }
.prose img { max-width: 100%; border-radius: 6px; }
.prose pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; }
.prose pre code { border: 0; padding: 0; background: none; }
.prose blockquote { margin: 1em 0; padding: 4px 14px; border-left: 3px solid var(--accent-2); color: var(--muted); }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.prose th { background: var(--bg-2); }

.files ul, .files-edit ul { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.files li, .files-edit li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; flex-wrap: wrap; }
.files-edit li.muted { background: none; border-style: dashed; }
.file-icon { font-size: 1.2rem; }
.file-name { flex: 1; min-width: 140px; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.file-name small { color: var(--muted); font-family: var(--mono); font-size: .72rem; }
progress { width: 120px; accent-color: var(--accent); }

/* ── editor ── */
.editor { margin-top: 18px; display: grid; gap: 14px; }
.row { display: flex; gap: 12px; }
.f-icon { width: 90px; flex: none; }
.f-icon input { text-align: center; font-size: 1.2rem; padding: 6px; }
.f-title { flex: 1; }
.f-title input { font-size: 1.1rem; font-weight: 600; }
.tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tab { font: 600 .82rem var(--sans); background: none; color: var(--muted); border: 1px solid transparent; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.tab.on { color: var(--text); border-color: var(--line); background: var(--panel); }
.hint { margin-left: auto; font-size: .75rem; color: var(--muted); display: flex; gap: 4px; flex-wrap: wrap; }
.preview { margin-top: 0; min-height: 280px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; }
legend { padding: 0 6px; font-weight: 600; font-size: .9rem; }
.upload-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; font-size: .85rem; }
.link-row { margin-top: 10px; flex-wrap: wrap; }
.link-row input:first-child { flex: 2; min-width: 220px; }
.link-row input:nth-child(2) { flex: 1; min-width: 140px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .9rem; }
.check input { width: auto; margin: 0; accent-color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ── auth ── */
.auth { max-width: 380px; margin: 40px auto; display: grid; gap: 14px; }
.auth h1 { margin: 0; font-family: var(--pixel); color: var(--accent); }
.auth form { display: grid; gap: 10px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ── estados ── */
.empty { text-align: center; padding: 60px 0; }
.loading { display: flex; justify-content: center; gap: 8px; padding: 80px 0; }
.loading span { width: 10px; height: 10px; background: var(--accent); animation: blink 1s infinite steps(2); }
.loading span:nth-child(2) { animation-delay: .2s; }
.loading span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .15; } }

.toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 50; }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--accent); font-size: .9rem; max-width: 340px; box-shadow: 0 8px 24px rgba(0,0,0,.4); transition: opacity .4s, transform .4s; }
.toast.err { border-color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (max-width: 680px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .who span { display: none; }
  .container { padding: 20px 16px 48px; }
  .actions { margin-left: 0; width: 100%; }
  .prose { padding: 16px; }
  .hint { display: none; }
}
