@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    color-scheme: dark;
    --bg: #0a0a0a;
    --bg-glow: rgba(46, 204, 113, 0.12);
    --accent: #2ecc71;
    --accent-bright: #39ff14;
    --accent-dark: rgba(0, 60, 30, 0.75);
    --nav-bg: #2ecc71;
    --nav-btn: #27ae60;
    --nav-btn-hover: #229954;
    --nav-btn-active: #1e8449;
    --nav-btn-text: #000000;
    --radius-nav-btn: 14px;
    --card: #141414;
    --card-border: #2e2e2e;
    --text: #ffffff;
    --text-muted: #9ca3af;
    --text-on-accent: #0a0a0a;
    --input-bg: #0d0d0d;
    --input-border: #3a3a3a;
    --cyan: #22d3ee;
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.15);
    --success-soft: rgba(46, 204, 113, 0.15);
    --radius-lg: 1.25rem;
    --radius-pill: 9999px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font);
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--bg);
    background-image: radial-gradient(ellipse 80% 50% at 50% -10%, var(--bg-glow), transparent 70%);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-bright);
}

/* Layout */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    padding: 1.5rem 1rem 0;
    text-align: center;
}

.site-logo {
    margin: 0 0 1.25rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    text-shadow: 0 0 40px rgba(46, 204, 113, 0.35);
}

.main-nav-wrap {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    background: var(--nav-bg);
    border-radius: var(--radius-lg);
    padding: 1.02rem;
}

.main-nav .nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1.02rem 1.25rem;
    border-radius: var(--radius-nav-btn);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--nav-btn-text);
    background: var(--nav-btn);
    border: none;
    box-shadow: none;
    cursor: pointer;
    text-decoration: none;
    text-transform: capitalize;
    transition: background 0.15s;
    white-space: nowrap;
}

.main-nav a.nav-pill,
.main-nav a.nav-pill:hover,
.main-nav button.nav-pill:hover {
    color: var(--nav-btn-text);
    text-decoration: none;
}

.main-nav .nav-pill:hover {
    background: var(--nav-btn-hover);
    color: var(--nav-btn-text);
}

.main-nav .nav-pill--active,
.main-nav .nav-pill--active:hover {
    background: var(--nav-btn-active);
    color: var(--nav-btn-text);
}

.main-nav .nav-pill--balance,
.main-nav .nav-pill--balance:hover {
    background: var(--bg);
    color: var(--text);
    cursor: default;
    font-weight: 600;
    text-transform: none;
}

.main-nav-form {
    display: inline-flex;
    margin: 0;
}

.app-main {
    flex: 1;
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
    width: 100%;
}

/* Rodape — usuario e sair */
.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    background: transparent;
    padding: 1.25rem 1rem 1.5rem;
    margin-top: auto;
}

.site-footer-user {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.site-footer-user-icon {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    color: #9b9b9b;
}

.site-footer-email {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #ffffff;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 1.75rem;
    border-radius: var(--radius-pill);
    background: #9b9b9b;
    color: #000000;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: filter 0.15s;
}

.btn-logout:hover {
    filter: brightness(1.1);
    color: #000000;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1.25rem;
}

.text-muted {
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

.section-header {
    background: var(--accent);
    color: var(--text-on-accent);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.4;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: 0;
}

.card--sectioned {
    padding: 0;
    overflow: hidden;
}

.card--sectioned > :not(.section-header) {
    padding: 1rem 1.25rem;
}

/* Forms */
.input-field,
.select-field {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    padding: 0.625rem 0.75rem;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9375rem;
}

.input-field::placeholder {
    color: var(--text-muted);
}

textarea.input-field {
    resize: vertical;
    min-height: 4.5rem;
    line-height: 1.45;
}

.input-field:focus,
.select-field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.25);
}

.select-field {
    cursor: pointer;
}

label.block > span,
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    filter: brightness(1.08);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
}

.btn-secondary {
    background: var(--accent-dark);
    color: var(--text);
    border: 1px solid var(--card-border);
}

.btn-danger {
    background: var(--danger);
    color: var(--text);
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--danger);
    color: #ffffff;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}

.btn-delete:hover {
    filter: brightness(1.12);
}

.btn-delete:active {
    transform: scale(0.95);
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--card);
    border: 1px solid var(--card-border);
    color: var(--text);
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background: var(--success-soft);
    color: var(--accent);
    border: 1px solid rgba(46, 204, 113, 0.35);
}

.alert-error {
    background: var(--danger-soft);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    text-align: left;
    vertical-align: top;
    padding: 0.65rem 0.5rem;
}

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--card-border);
}

.data-table tr {
    border-bottom: 1px solid var(--card-border);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Modals */
#newOrderModal:not(.hidden),
#profileModal:not(.hidden) {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-panel {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    color: var(--text);
}

.modal-close {
    color: var(--text-muted);
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.modal-close:hover {
    color: var(--text);
}

/* Auth pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 28rem;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-card h1 {
    margin: 0 0 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 0 30px rgba(46, 204, 113, 0.3);
}

.auth-card .btn {
    width: 100%;
}

/* Radio / checkbox accent */
input[type='radio'],
input[type='checkbox'] {
    accent-color: var(--cyan);
}

.card ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.card ul li + li {
    margin-top: 0.35rem;
}

/* Utilities used with Tailwind grid helpers */
.grid-cards {
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    .grid-cards-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-cards-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-cards-profiles {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .grid-cards-profiles {
        grid-template-columns: repeat(3, 1fr);
    }
}

.profiles-filter {
    width: fit-content;
    max-width: 100%;
}

.profile-card__title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--card-border);
}

.profile-stats {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
}

.profile-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.profile-stat dt {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
}

.profile-stat dd {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.profile-stat__value--over {
    color: var(--danger);
}

.profile-stat__value--low {
    color: #f59e0b;
}

.profile-stat__pct {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 0.35rem;
}

.profile-stat--goal dd {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-goal-progress {
    width: 100%;
    height: 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    overflow: hidden;
}

.profile-goal-progress__bar {
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--accent);
    transition: width 0.25s ease;
}

.profile-goal-progress--low .profile-goal-progress__bar {
    background: #f59e0b;
}

.profile-goal-progress--over .profile-goal-progress__bar {
    background: var(--danger);
    width: 100% !important;
}

.profile-budget-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.profile-budget-input {
    flex: 1 1 8rem;
    min-width: 0;
    max-width: 10rem;
}

.profile-service-codes {
    width: 100%;
}

.profile-card-form__submit {
    margin-top: 0.75rem;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8125rem;
}
