:root {
    --bg: #0b1224;
    --bg-soft: rgba(255, 255, 255, 0.04);
    --card: #0f1a32;
    --surface: #101a2f;
    --text: #e6ecf8;
    --muted: #a5b3ce;
    --accent: #00c689;
    --accent-2: #f5a524;
    --danger: #ff6b6b;
    --warning: #ffd166;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    --radius: 14px;
    font-family: "Inter", "Space Grotesk", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(circle at 20% 20%, rgba(0, 198, 137, 0.12), transparent 24%),
                radial-gradient(circle at 80% 0%, rgba(245, 165, 36, 0.12), transparent 24%),
                radial-gradient(circle at 40% 80%, rgba(0, 198, 137, 0.08), transparent 25%),
                var(--bg);
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-2);
}

.app-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 22px 42px;
}

.app-card {
    background: linear-gradient(150deg, var(--card), var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px 26px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.app-title {
    font-size: 24px;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-pill {
    background: var(--bg-soft);
    color: var(--muted);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
}

.flash-list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    display: grid;
    gap: 8px;
}

.flash-item {
    background: rgba(0, 198, 137, 0.12);
    border: 1px solid rgba(0, 198, 137, 0.35);
    color: var(--text);
    padding: 12px 14px;
    border-radius: 12px;
}

.layout-grid {
    display: grid;
    gap: 16px;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.hero h2 {
    margin: 0;
    font-size: 20px;
    letter-spacing: -0.02em;
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 11px 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    color: #0c111b;
    background: var(--accent);
    box-shadow: 0 10px 28px rgba(0, 198, 137, 0.35);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn.secondary {
    background: var(--bg-soft);
    color: var(--text);
    box-shadow: none;
}

.btn.danger {
    background: var(--danger);
    color: #0c111b;
    box-shadow: 0 10px 28px rgba(255, 107, 107, 0.35);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.stat-card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: grid;
    gap: 6px;
}

.stat-title {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
}

.stat-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.table-card {
    margin-top: 6px;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
    font-size: 14px;
}

.table thead {
    background: rgba(255, 255, 255, 0.04);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 12px;
}

.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.chip.success {
    background: rgba(0, 198, 137, 0.14);
    color: #66f0c1;
}

.chip.warn {
    background: rgba(245, 165, 36, 0.14);
    color: #ffd27a;
}

.chip.danger {
    background: rgba(255, 107, 107, 0.14);
    color: #ff9f9f;
}

.chip.neutral {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.pill {
    display: inline-block;
    padding: 6px 8px;
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 12px;
}

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.select {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text);
    min-width: 160px;
}

.pagination {
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 16px;
    justify-content: center;
    margin: 0;
}

.page-item .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--border);
}

.page-item.active .page-link {
    background: var(--accent);
    color: #0c111b;
    border: none;
    box-shadow: 0 10px 24px rgba(0, 198, 137, 0.25);
}

.auth-card {
    max-width: 460px;
    margin: 0 auto;
    padding: 28px;
    border-radius: var(--radius);
    background: linear-gradient(150deg, var(--card), var(--surface));
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: grid;
    gap: 12px;
}

.auth-card img {
    max-width: 160px;
    margin: 0 auto;
    display: block;
}

.form-group {
    display: grid;
    gap: 6px;
}

label {
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
}

input[type="text"],
input[type="password"],
select {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    color: var(--text);
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
    outline: 1px solid var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 198, 137, 0.25);
}

.table td.actions {
    display: flex;
    gap: 10px;
}

.tag {
    padding: 6px 8px;
    border-radius: 8px;
    background: var(--bg-soft);
    font-size: 12px;
    color: var(--text);
}

.date-badge {
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
}

.bg-danger {
    background: rgba(255, 107, 107, 0.14) !important;
}

.bg-warn {
    background: rgba(245, 165, 36, 0.14) !important;
}

select option {
    background: var(--bg);
    color: var(--text);
}

/* ── Inputs faltantes no dark theme ─────────────────────────── */
input[type="date"],
input[type="number"],
input[type="file"],
textarea {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    width: 100%;
}

input[type="date"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: 1px solid var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 198, 137, 0.25);
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.5;
    cursor: pointer;
}

input[type="file"] {
    padding: 10px 12px;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background: var(--accent);
    color: #0c111b;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    margin-right: 10px;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ── Help text ───────────────────────────────────────────────── */
.help-text {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

/* ── Flash messages com tipos ───────────────────────────────── */
.flash-item.error {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.35);
}

.flash-item.warn {
    background: rgba(245, 165, 36, 0.12);
    border-color: rgba(245, 165, 36, 0.35);
}

.flash-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: flash-in 0.25s ease;
}

.flash-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

@keyframes flash-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Mobile: tabela com scroll horizontal ───────────────────── */
.table-card {
    overflow-x: auto;
}

@media (max-width: 768px) {
    .table { min-width: 700px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .cta-row { flex-direction: column; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .app-shell { padding: 16px 12px 32px; }
}

/* ── Fade-in nos cards ──────────────────────────────────────── */
.app-card {
    animation: card-in 0.3s ease;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading no submit ──────────────────────────────────────── */
.btn.loading {
    opacity: 0.65;
    pointer-events: none;
    position: relative;
}

.btn.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Estado vazio ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}

.empty-state-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* ── Focus visível nos botões ───────────────────────────────── */
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── Drop Zone ──────────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 24px 16px;
    background: var(--bg-soft);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 110px;
    justify-content: center;
}
.drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(0, 198, 137, 0.08);
}
.drop-zone-prompt {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.drop-zone-prompt svg {
    opacity: 0.5;
}
.drop-zone-prompt span {
    pointer-events: all;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
}
.drop-zone-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
}
.drop-file-item {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    width: 76px;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.drop-file-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.drop-file-item .drop-file-name {
    font-size: 10px;
    color: var(--muted);
    padding: 6px;
    text-align: center;
    word-break: break-all;
    line-height: 1.3;
}
.drop-file-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

/* ── Inputs com largura padrão ──────────────────────────────── */
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"] {
    width: 100%;
}
