:root {
  --bg: #0e0f13;
  --panel: #171920;
  --panel-2: #1f222b;
  --line: #2a2e3a;
  --text: #eceef3;
  --muted: #8b90a0;
  --accent: #ffcc33;
  --accent-ink: #1a1400;
  --danger: #ff5c5c;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; text-decoration: none; font-weight: 600;
  white-space: nowrap;
}
.btn:hover { border-color: #3a3f4e; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

.input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); outline: none;
}
.input:focus { border-color: var(--accent); }
label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; margin-top: 12px; }
.muted { color: var(--muted); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 14px max(24px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; text-decoration: none; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.topbar .right { display: flex; align-items: center; gap: 12px; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.auth-card h1 { margin: 12px 0 4px; font-size: 26px; }
.tabs { display: flex; gap: 6px; background: var(--panel-2); padding: 4px; border-radius: 10px; margin-top: 20px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button.active { background: var(--bg); color: var(--text); }
.auth-card .btn { width: 100%; margin-top: 18px; }

/* ---------- Lista ---------- */
.container { max-width: 1000px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; }
.search { max-width: 280px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 10px; min-height: 170px;
}
.card h3 { margin: 0; font-size: 17px; word-break: break-word; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: break-word; }
.card .meta { font-size: 12px; color: var(--muted); }
.card .actions { display: flex; gap: 8px; }
.card .actions .btn { padding: 8px 12px; font-size: 14px; }
.card .actions .btn.primary { flex: 1; }
.empty { text-align: center; padding: 60px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* ---------- Editor ---------- */
.editor { max-width: 900px; margin: 0 auto; padding: 24px 24px 40px; display: flex; flex-direction: column; gap: 14px; min-height: calc(100vh - 62px); }
.editor .title { font-size: 24px; font-weight: 700; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 8px 2px; }
.editor .title:focus { border-color: var(--accent); }
.editor textarea {
  flex: 1; min-height: 60vh; resize: vertical; padding: 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); font-size: 18px; line-height: 1.6; outline: none;
}
.editor textarea:focus { border-color: #3a3f4e; }
.editor .bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.status { font-size: 13px; color: var(--muted); }

@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  .container, .editor { padding-left: 16px; padding-right: 16px; }
  .search { max-width: none; width: 100%; }
  .hide-sm { display: none; }
}
