:root {
    --bg: #f5f6f8;
    --card: #fff;
    --text: #1d2330;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --danger: #dc2626;
    --ok: #16a34a;
    --warn: #d97706;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

code { font-size: 13px; background: #f1f3f6; padding: 1px 5px; border-radius: 4px; }

.top {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 12px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}
.top nav { display: flex; gap: 6px; }
.top nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
}
.top nav a.active, .top nav a:hover { background: #eef2ff; color: var(--primary); }
.brand { font-size: 17px; }
.balance { margin-left: auto; }
.err { color: var(--danger); }

main { max-width: 1100px; margin: 20px auto; padding: 0 16px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 18px;
}
.card h2 { margin: 0 0 10px; font-size: 17px; }
.muted { color: var(--muted); font-size: 14px; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
form.inline { display: inline; margin: 0; }

input, select {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    min-width: 0;
}
label.check { display: flex; gap: 6px; align-items: center; }

button {
    padding: 8px 14px;
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    cursor: pointer;
}
button.secondary { background: #e0e7ff; color: var(--primary); }
button.small { padding: 4px 10px; font-size: 13px; background: #eef2ff; color: var(--primary); }
button.danger { background: #fee2e2; color: var(--danger); }
button.link { background: none; color: var(--muted); padding: 0; }
button.star {
    background: none;
    color: #c4c7cf;
    font-size: 22px;
    padding: 0 4px;
    line-height: 1;
}
button.star.on { color: #f5b301; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
th a.sort { color: inherit; text-decoration: none; white-space: nowrap; }
th a.sort:hover, th a.sort.active { color: var(--primary); }
td.actions { white-space: nowrap; }
.nowrap { white-space: nowrap; }
img.logo { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; display: block; }

.credit-form { display: grid; gap: 6px; }
.credit-form label { font-size: 13px; font-weight: 650; }
.credit-form input { width: 140px; font-size: 16px; }
.prefix { font-weight: 650; color: var(--muted); }
.small-text { font-size: 13px; margin: 0; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters .search { width: min(300px, 70vw); }
.select-filter { display: flex; gap: 6px; align-items: center; font-size: 14px; font-weight: 650; color: var(--muted); }
.select-filter select { min-width: 140px; }
.check-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 650;
    color: var(--muted);
    cursor: pointer;
}
.check-filter input { accent-color: var(--primary); }
a.clear { color: var(--muted); font-size: 14px; }

td.name { font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; font-weight: 500; }
.site-link { font-size: 12px; color: var(--primary); text-decoration: none; }
.site-link::before { content: "↗ "; }
.site-link:hover { text-decoration: underline; }
.badge { font-size: 11px; font-weight: 650; padding: 2px 7px; border-radius: 999px; background: #eef2f7; color: var(--muted); }
.badge.partner { background: #eff6ff; color: #1e40af; }

.badge.edited { background: #fef3c7; color: #92400e; }
.edit-link { font-size: 12px; color: var(--muted); }
.edit-link:hover { color: var(--primary); }
.edit-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.edit-head h2 { margin: 0; }
.edit-head p { margin: 2px 0 0; }
img.logo.big { width: 56px; height: 56px; border-radius: 12px; }
.card h3 { font-size: 14px; margin: 18px 0 4px; }
table.device-edit input.wide { width: 100%; min-width: 260px; }
.device-icon { height: 16px; width: auto; vertical-align: middle; margin-right: 4px; }
.api-value { font-size: 13px; }

.brands { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.brand-link { display: inline-flex; border-radius: 4px; }
.brands img {
    height: 18px;
    width: auto;
    max-width: 72px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 2px 4px;
}
.brand-link:hover img { border-color: var(--primary); }

th.num, td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.credits { font-weight: 650; color: #c2410c; }
td.money { font-weight: 650; color: var(--ok); }

button.switch {
    position: relative;
    width: 40px;
    height: 22px;
    padding: 0;
    border-radius: 999px;
    background: #cbd2dc;
    transition: background 0.15s;
}
button.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s;
}
button.switch.on { background: var(--ok); }
button.switch.on::after { transform: translateX(18px); }

tr.disabled-row td:not(:nth-child(2)) { opacity: 0.45; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #f1f3f6; }
.tag.ok, .tag.ativado { background: #dcfce7; color: var(--ok); }
.tag.off, .tag.incorreto { background: #fee2e2; color: var(--danger); }
.tag.solicitado, .tag.pendente, .tag.migrando { background: #fef3c7; color: var(--warn); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: #dcfce7; color: #14532d; }
.flash.error { background: #fee2e2; color: #7f1d1d; }

.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 14px; }
.pager a { color: var(--primary); text-decoration: none; }

body.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: min(360px, 92vw); display: grid; gap: 12px; }
.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }

main.install { max-width: 720px; }
main.install h1 { font-size: 22px; margin: 10px 0 18px; }
.install-form label:not(.check) { display: grid; gap: 4px; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.install-form label.check { margin: 6px 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.steps li { margin-bottom: 12px; }
input.copy { display: block; width: 100%; margin-top: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
a.button {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
}
