/* Páginas fora do editor: login, projetos, biblioteca (mesmo tema escuro do editor). */
:root {
  --bg: #12161c; --panel: #1a1f27; --panel-2: #222935; --line: #2f3846; --text: #e6e9ee; --muted: #8b95a5;
  --green: #22b14c; --blue: #2f7fd1; --red: #d24b4b; --radius: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
button { cursor: pointer; }
button:hover { border-color: #4a5668; }
button.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
button.danger, button.mini.danger { background: var(--red); border-color: var(--red); color: #fff; }
button.ghost { background: transparent; }
button.mini { padding: 3px 8px; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #2f7fd155; border-color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); margin-left: 6px; font-weight: 500; }
.tag.role-dono { background: #1f6f3f; border-color: #1f6f3f; }
.tag.role-editor { background: #24527a; border-color: #24527a; }
.tag.role-leitor { background: #6b4a12; border-color: #6b4a12; }

/* login */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, #1d2a22, var(--bg) 60%); }
.auth-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px #0008; }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand img { width: 40px; height: 40px; }
.auth-brand h1 { margin: 0; font-size: 26px; }
.auth-tabs { display: flex; gap: 4px; margin: 18px 0 14px; background: var(--panel-2); border-radius: 8px; padding: 3px; }
.auth-tabs button { flex: 1; border: none; background: transparent; }
.auth-tabs button.active { background: var(--panel); box-shadow: 0 1px 4px #0006; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.auth-card button.primary { margin-top: 6px; padding: 9px; }
.msg { margin: 12px 0 0; padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.msg.error { background: #8a2a2a55; color: #f3b0b0; }
.msg.ok { background: #1f6f3f55; color: #9fe5b3; }

/* topo */
.page-top { display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; }
.brand img { width: 26px; height: 26px; }
.page-top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.page-top nav a { text-decoration: none; padding: 6px 12px; border-radius: 6px; color: var(--muted); }
.page-top nav a.active, .page-top nav a:hover { background: var(--panel-2); color: var(--text); }

.page { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head h2 { margin: 0 8px 0 0; }
.page-head input { width: min(280px, 100%); }
section h3 { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin: 26px 0 10px; }

/* cartões */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.card:hover { border-color: #4a5668; transform: translateY(-1px); }
.card.obj { cursor: default; }
.thumb { aspect-ratio: 16 / 10; background: linear-gradient(160deg, #26303d, #171c23); display: grid; place-items: center; overflow: hidden; }
.cards.objs .thumb { aspect-ratio: 1 / 1; background: radial-gradient(circle at 50% 40%, #3a4555, #1a2029); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.cards.objs .thumb img { object-fit: contain; padding: 8px; }
.thumb-empty { font-size: 42px; color: #4a5668; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-title { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 600; color: #9fe5b3; }
.obj-icon { width: 20px; height: 20px; object-fit: contain; display: inline-grid; place-items: center; font-size: 16px; }
.obj-icon.big { width: 48px; height: 48px; font-size: 36px; }

/* diálogos */
.dlg-back { position: fixed; inset: 0; background: #0009; display: grid; place-items: center; z-index: 50; padding: 16px; }
.dlg { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.dlg h3 { margin: 0; }
.dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.dlg textarea { min-height: 70px; resize: vertical; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.grid3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; }
.icon-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-row input[type=file] { max-width: 210px; font-size: 12px; }
.icon-preview { width: 56px; height: 56px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; }
.error-text { color: #f3b0b0; font-size: 12px; min-height: 1em; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px #0008; z-index: 60; }
.toast.error { border-color: var(--red); }
@media (max-width: 520px) { .grid3 { grid-template-columns: 1fr; } .page-top { gap: 10px; padding: 10px 16px; } }
