:root {
    --bg: #03110d;
    --bg-2: #071814;
    --panel: rgba(13, 32, 26, .82);
    --panel-2: rgba(16, 44, 35, .9);
    --line: rgba(79, 153, 119, .28);
    --line-strong: rgba(91, 215, 151, .42);
    --text: #f6f8f4;
    --muted: #aebbb5;
    --green: #1f7a55;
    --green-light: #38d993;
    --orange: #ff7a12;
    --orange-2: #ff9c2a;
    --danger: #e15b5b;
    --shadow: 0 20px 55px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 78% 8%, rgba(56, 217, 147, .09), transparent 30%),
        radial-gradient(circle at 16% 92%, rgba(255, 122, 18, .08), transparent 28%),
        linear-gradient(135deg, #03110d, #061812 48%, #020b09);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .34;
    background-image:
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 54px 54px;
}
a { color: inherit; text-decoration: none; }
code { color: #ffd27a; }
.muted { color: var(--muted); }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 292px;
    padding: 30px 24px 18px;
    background: linear-gradient(180deg, rgba(2, 18, 14, .98), rgba(3, 18, 14, .92));
    border-right: 1px solid var(--line);
    overflow-y: auto;
    z-index: 4;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 32px;
    font-weight: 900;
    margin-bottom: 30px;
    letter-spacing: 0;
}
.brand i {
    color: var(--green-light);
    font-size: 24px;
    margin-right: 2px;
}
.brand span, .login-card span { color: var(--orange); }
.sidebar nav { display: grid; gap: 7px; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 8px;
    color: var(--muted);
    border: 1px solid transparent;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.sidebar nav a i {
    width: 22px;
    text-align: center;
    font-size: 17px;
}
.sidebar nav a:hover,
.sidebar nav a.active {
    background: linear-gradient(135deg, rgba(31, 122, 85, .9), rgba(28, 106, 78, .45));
    border-color: rgba(56, 217, 147, .38);
    color: var(--text);
    box-shadow: inset 0 0 24px rgba(56, 217, 147, .1);
}

.main {
    position: relative;
    margin-left: 292px;
    min-height: 100vh;
    padding: 0 42px 32px;
}
.topbar {
    min-height: 112px;
    margin: 0 -42px 32px;
    padding: 26px 42px;
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(ellipse at 48% 0%, rgba(255,255,255,.05), transparent 33%),
        linear-gradient(135deg, rgba(5, 20, 16, .88), rgba(4, 15, 13, .65));
}
.topbar::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 292px;
    height: 112px;
    pointer-events: none;
    opacity: .16;
    background:
        repeating-radial-gradient(ellipse at 54% 12%, transparent 0 18px, rgba(255,255,255,.45) 19px, transparent 20px);
}
.topbar, .page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.topbar strong { display: block; font-size: 24px; }
.topbar small, .page-head p { display: block; color: var(--muted); margin-top: 4px; }
.user {
    display: flex;
    gap: 14px;
    align-items: center;
    color: var(--muted);
    position: relative;
    z-index: 1;
}
.user span strong { color: var(--text); font-size: 16px; }
.user span small { color: var(--green-light); font-size: 13px; }
.avatar {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--green-light);
    background: radial-gradient(circle at 50% 35%, rgba(56, 217, 147, .28), rgba(31, 122, 85, .35));
}

.page-head { margin-bottom: 24px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(32px, 4vw, 46px); line-height: 1.05; }
h2 { font-size: 18px; margin-bottom: 12px; }

.cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(170px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.card, .panel {
    background:
        linear-gradient(145deg, rgba(18, 45, 37, .88), rgba(9, 28, 23, .78));
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.card {
    min-height: 164px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 70% 20%, rgba(56, 217, 147, .08), transparent 34%);
    pointer-events: none;
}
.card-icon,
.round-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--green-light);
    background: rgba(31, 122, 85, .24);
    border: 1px solid rgba(56, 217, 147, .1);
}
.card small { color: var(--muted); position: absolute; top: 46px; left: 92px; right: 18px; }
.card strong { display: block; font-size: 44px; margin-top: 22px; color: var(--orange); line-height: 1; }
.metric-line {
    display: block;
    width: 52%;
    height: 4px;
    margin-top: 18px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--green-light), rgba(56, 217, 147, .1));
}
.panel { padding: 24px; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1.18fr;
    gap: 18px;
}
.api-panel p { color: var(--muted); line-height: 1.55; margin-bottom: 18px; }
.code-box, .doc-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(5, 19, 15, .55);
    padding: 18px;
}
.code-box {
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 18px;
}
.code-box code { line-height: 1.7; }
.doc-card {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 14px;
}
.doc-card > i:first-child { color: var(--green-light); font-size: 28px; }
.doc-card small { color: var(--muted); display: block; margin-top: 4px; }
.dot {
    width: 9px;
    height: 9px;
    display: inline-block;
    border-radius: 50%;
    background: var(--green-light);
    box-shadow: 0 0 18px rgba(56, 217, 147, .9);
    margin-right: 10px;
}
.activity-row {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(79, 153, 119, .16);
}
.activity-row strong { display: block; font-size: 14px; }
.activity-row small { color: var(--muted); }
.activity-row em {
    font-style: normal;
    font-size: 12px;
    color: var(--green-light);
    background: rgba(56, 217, 147, .1);
    padding: 4px 8px;
    border-radius: 8px;
}
.activity-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #06110d;
}
.activity-icon.green { background: var(--green-light); }
.activity-icon.blue { background: #4f9cff; }
.activity-icon.orange { background: var(--orange); }
.activity-icon.purple { background: #9b6ce3; }
.activity-icon.yellow { background: #f5c400; }
.donut {
    width: 172px;
    height: 172px;
    margin: 12px auto 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at center, #071512 0 52%, transparent 53%),
        conic-gradient(var(--green-light) 0 43%, var(--orange) 43% 70%, #8d68d8 70% 85%, #4f9cff 85% 100%);
}
.donut strong { font-size: 34px; }
.donut small { display: block; color: var(--muted); font-size: 12px; margin-top: -54px; }
.legend { display: grid; gap: 10px; }
.legend span {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    border-bottom: 1px solid rgba(79, 153, 119, .12);
    padding-bottom: 7px;
}
.legend i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-light);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(13, 32, 26, .65);
    color: var(--green-light);
    cursor: pointer;
    font-weight: 700;
}
.button.primary {
    background: linear-gradient(135deg, var(--orange), #f06700);
    border-color: rgba(255, 166, 64, .65);
    color: #fff;
    box-shadow: 0 10px 30px rgba(255, 122, 18, .22);
}
.button.google {
    width: 100%;
    color: var(--text);
    background: rgba(255, 255, 255, .08);
}
.button.ghost { background: transparent; color: var(--text); }
.button.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.button.danger { border-color: var(--danger); color: #ffd2d2; }

.admin-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 5px;
    margin: -8px 0 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
}
.admin-tabs a {
    min-height: 38px;
    padding: 0 16px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    font-weight: 800;
}
.admin-tabs a.active {
    background: rgba(56, 217, 147, .12);
    color: var(--green-light);
    box-shadow: inset 0 0 0 1px rgba(56, 217, 147, .22);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
}
.filters input[type="search"] { flex: 1 1 240px; }
.filters select { flex: 1 1 160px; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    background: rgba(4, 17, 13, .78);
    color: var(--text);
    border-radius: 10px;
    padding: 12px 13px;
    font: inherit;
}
input:focus, textarea:focus, select:focus {
    outline: 2px solid rgba(56, 217, 147, .22);
    border-color: var(--line-strong);
}
input[type="checkbox"] { width: auto; min-width: 20px; height: 20px; }
textarea { resize: vertical; }
.code-textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    min-height: 320px;
    line-height: 1.5;
    tab-size: 2;
}
label span { display: block; color: var(--muted); margin-bottom: 7px; }
.field-hint { display: block; color: var(--muted); margin-top: 6px; font-size: 12px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; }
.preview {
    display: block;
    max-width: 220px;
    max-height: 160px;
    margin-top: 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 10px; border-bottom: 1px solid rgba(79, 153, 119, .16); text-align: left; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
td { color: #e7eee9; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { display: inline; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; color: var(--muted); }
.detail-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 20px;
}
.detail-info p { color: var(--muted); line-height: 1.6; }
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.section-title h2 { display: flex; align-items: center; gap: 10px; }
.text-preview {
    margin: 0;
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
    color: var(--muted);
}
.json-preview {
    max-height: 460px;
    overflow-wrap: anywhere;
}
.full-text-preview {
    max-height: 70vh;
}
.preview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.preview-grid div {
    background: rgba(4, 17, 13, .64);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
}
.preview-grid small { display: block; color: var(--muted); margin-bottom: 5px; }
.preview-grid strong { font-size: 15px; overflow-wrap: anywhere; }
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    color: var(--muted);
}
.badge.ok { border-color: var(--green-light); color: #bdf5d8; }
.badge.warn { border-color: var(--orange); color: #ffd7b5; }
.json-details { margin: 0 0 16px; }
.json-details summary { cursor: pointer; color: var(--muted); margin-bottom: 10px; }
.import-subsection { margin: 18px 0; padding-top: 18px; border-top: 1px solid var(--line); }
.import-progress[hidden] { display: none; }
.job-progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(4, 17, 13, .64);
    margin-bottom: 12px;
}
.job-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--green), var(--green-light));
    transition: width .25s ease;
}
.progress-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 22px;
    color: var(--muted);
}
.progress-list li {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(4, 17, 13, .44);
}
.progress-list li.ok { color: #bdf5d8; border-color: var(--green-light); }
.progress-list li.error { color: #ffd2d2; border-color: var(--danger); }

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    background: var(--panel-2);
}
.alert.success { border-color: var(--green-light); }
.alert.error { border-color: var(--danger); color: #ffd2d2; }

.footer {
    color: rgba(174, 187, 181, .55);
    text-align: center;
    margin-top: 34px;
    padding-top: 20px;
    border-top: 1px solid rgba(79, 153, 119, .12);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}
.login-card {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 30px;
    display: grid;
    gap: 16px;
    box-shadow: var(--shadow);
}
.login-card h1 { font-size: 36px; }
.login-card p { color: var(--muted); }

@media (max-width: 1280px) {
    .cards { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .import-panel { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
    .sidebar {
        position: static;
        width: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .main { margin-left: 0; padding: 0 18px 24px; }
    .topbar { margin: 0 -18px 24px; padding: 22px 18px; min-height: auto; }
    .topbar::before { display: none; }
    .cards, .detail-grid, .preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .detail-info { grid-template-columns: 1fr; }
    .topbar, .page-head { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
    .brand { font-size: 28px; }
    .cards, .detail-grid, .preview-grid, .sidebar nav { grid-template-columns: 1fr; }
    .filters { flex-direction: column; align-items: stretch; }
    .page-head .actions, .user { width: 100%; }
    .page-head .actions .button { flex: 1 1 100%; }
    .button { width: 100%; }
    .card small { position: static; display: block; margin-top: 12px; }
    .activity-row { grid-template-columns: 36px 1fr; }
    .activity-row em { grid-column: 2; justify-self: start; }
}

/* Tema claro inspirado no painel de referência. Mantém a estrutura responsiva acima. */
:root {
    --bg: #f7faf8;
    --bg-2: #ffffff;
    --panel: #ffffff;
    --panel-2: #f2f7f4;
    --line: #dde7e1;
    --line-strong: #b8d8c8;
    --text: #111827;
    --muted: #5f6975;
    --green: #20895d;
    --green-light: #2ba977;
    --orange: #ff6b16;
    --orange-2: #ff9345;
    --danger: #dc4949;
    --shadow: 0 16px 42px rgba(17, 24, 39, .08);
}

body {
    background:
        radial-gradient(circle at 82% 0%, rgba(43, 169, 119, .08), transparent 28%),
        linear-gradient(180deg, #ffffff, #f7faf8 72%);
    color: var(--text);
}

body::before {
    opacity: .18;
    background-image:
        linear-gradient(rgba(32, 137, 93, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(32, 137, 93, .035) 1px, transparent 1px);
}

code { color: #0f6b49; }

.sidebar {
    background: rgba(255, 255, 255, .92);
    border-right-color: var(--line);
    box-shadow: 10px 0 32px rgba(17, 24, 39, .04);
}

.brand { color: #111827; }
.brand i { color: var(--green); }

.sidebar nav a {
    color: #4b5563;
    border-radius: 10px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: linear-gradient(135deg, rgba(43, 169, 119, .14), rgba(43, 169, 119, .06));
    border-color: transparent;
    color: var(--green);
    box-shadow: none;
}

.topbar {
    background: rgba(255, 255, 255, .9);
    border-bottom-color: var(--line);
}

.topbar::before { display: none; }
.user span strong { color: var(--text); }
.user span small { color: var(--green); }

.avatar {
    color: var(--green);
    background: #eaf6ef;
}

.card,
.panel,
.login-card {
    background: rgba(255, 255, 255, .92);
    border-color: var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.card::after { display: none; }

.card-icon,
.round-icon {
    color: var(--green);
    background: #eaf6ef;
    border-color: #d7eadf;
}

.card strong { color: var(--orange); }

.metric-line {
    background: linear-gradient(90deg, var(--green-light), rgba(43, 169, 119, .12));
}

.code-box,
.doc-card,
.preview-grid div {
    background: #f6fbf8;
    border-color: var(--line);
}

.button {
    background: #f6fbf8;
    border-color: #cce4d7;
    color: var(--green);
}

.button.primary {
    background: linear-gradient(135deg, var(--orange), #ff5d0a);
    border-color: var(--orange);
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(255, 107, 22, .2);
}

.button.google {
    color: var(--text);
    background: #ffffff;
}

.button.ghost { color: var(--text); }

input,
textarea,
select {
    background: #ffffff;
    border-color: var(--line);
    color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(43, 169, 119, .12);
    border-color: var(--line-strong);
}

td { color: #27313f; }
.badge.ok { color: var(--green); }
.badge.warn { color: #d95b00; }
.alert { background: #f8fbf9; }
.alert.error { color: #a92f2f; }
.footer { color: #9aa3ad; border-top-color: var(--line); }
