:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --border: #e6e8ec;
    --text: #16181d;
    --muted: #6b7280;
    --brand: #4f46e5;
    --brand-2: #7c3aed;
    --ok: #059669;
    --err: #dc2626;
    --radius: 14px;
    --shadow: 0 6px 20px rgba(20, 20, 40, .06);
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0e14;
        --surface: #141924;
        --border: #232a37;
        --text: #e7e9ee;
        --muted: #9aa3b2;
        --shadow: 0 6px 24px rgba(0, 0, 0, .35);
    }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

/* ── Boot / erros ─────────────────────────────────────────────── */
.boot { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; color: var(--muted); }
.boot-ico { font-size: 3rem; animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: #ffefef; color: #8a1c1c; padding: .8rem 1.2rem; z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,.1);
}
#blazor-error-ui .reload, #blazor-error-ui .dismiss { text-decoration: underline; cursor: pointer; margin-left: .6rem; }

/* ── Shell ────────────────────────────────────────────────────── */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .8rem clamp(1rem, 4vw, 3rem);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.15rem; }
.brand-ico { font-size: 1.3rem; }
.brand-name span { color: var(--brand); }
.topnav { display: flex; align-items: center; gap: clamp(.5rem, 2vw, 1.4rem); font-weight: 600; font-size: .92rem; }
.topnav a { color: var(--muted); }
.topnav a:hover { color: var(--text); }
.topnav .gh { color: var(--brand); }

.content { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: clamp(1.2rem, 4vw, 2.6rem); }

/* ── Hero ─────────────────────────────────────────────────────── */
.hero { text-align: center; padding: clamp(1.5rem, 6vw, 3.5rem) 0 2rem; }
.hero h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); font-weight: 900; margin: 0 0 .6rem; letter-spacing: -.02em; }
.hero h1 span { background: linear-gradient(90deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { max-width: 640px; margin: 0 auto; color: var(--muted); font-size: clamp(1rem, 2.5vw, 1.15rem); }
.badges { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: 1.4rem; }
.badge { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .35rem .8rem; font-size: .82rem; font-weight: 600; color: var(--muted); }

/* ── Categorias / cards ───────────────────────────────────────── */
.cat { margin-top: 2.4rem; scroll-margin-top: 80px; }
.cat h2 { display: flex; align-items: center; gap: .5rem; font-size: 1.3rem; font-weight: 800; margin: 0 0 1rem; }
.cat-ico { font-size: 1.3rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.card {
    display: flex; gap: .8rem; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem; box-shadow: var(--shadow);
    transition: transform .12s ease, border-color .12s ease;
    border-left: 3px solid var(--accent, var(--brand));
}
.card:hover { transform: translateY(-3px); border-color: var(--accent, var(--brand)); }
.card-ico { font-size: 1.6rem; line-height: 1; }
.card-name { font-weight: 700; margin-bottom: .15rem; }
.card-desc { font-size: .85rem; color: var(--muted); }

/* ── Página de ferramenta ─────────────────────────────────────── */
.tool { max-width: 620px; margin: 0 auto; }
.back { color: var(--muted); font-weight: 600; font-size: .9rem; }
.back:hover { color: var(--text); }
.tool-head { display: flex; gap: 1rem; align-items: center; margin: 1rem 0 1.4rem; }
.tool-ico { font-size: 2.4rem; }
.tool-head h1 { font-size: 1.6rem; margin: 0; }
.tool-head p { margin: .2rem 0 0; color: var(--muted); font-size: .95rem; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); }

.drop {
    display: flex; flex-direction: column; align-items: center; gap: .35rem;
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 2rem 1rem; text-align: center; cursor: pointer;
    transition: border-color .12s ease, background .12s ease;
}
.drop:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, transparent); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-ico { font-size: 1.8rem; }
.drop-main { font-weight: 700; }
.drop-sub { font-size: .8rem; color: var(--muted); }

.files { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-direction: column; gap: .35rem; }
.files li { display: flex; justify-content: space-between; gap: 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .7rem; font-size: .88rem; }
.files em { color: var(--muted); font-style: normal; }

.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-top: 1.2rem; }
.opt { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; }
.opt-label { font-weight: 600; }
.opt select, .opt input { padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: .9rem; }
.opt small { color: var(--muted); font-size: .76rem; }

.go {
    width: 100%; margin-top: 1.4rem; padding: .85rem 1rem;
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff;
    border: 0; border-radius: 10px; font-size: 1rem; font-weight: 700; cursor: pointer;
    transition: opacity .12s ease, transform .12s ease;
}
.go:hover:not(:disabled) { transform: translateY(-1px); }
.go:disabled { opacity: .55; cursor: not-allowed; }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }

.msg { margin: 1rem 0 0; padding: .7rem .9rem; border-radius: 10px; font-size: .9rem; font-weight: 600; }
.msg.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.msg.err { background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); }

.privacy { text-align: center; color: var(--muted); font-size: .82rem; margin-top: 1.2rem; }
.tool-missing { text-align: center; padding: 4rem 1rem; color: var(--muted); }

/* ── Footer ───────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); padding: 1.6rem; text-align: center; color: var(--muted); font-size: .85rem; }
.footer strong { color: var(--text); }
