@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
    --font: 'DM Sans', system-ui, 'Segoe UI', Roboto, Ubuntu, sans-serif;
    --bg: #eef1f8;
    --bg-accent: linear-gradient(165deg, #f2f5fc 0%, #e8ecf6 45%, #e4e9f5 100%);
    --surface: #ffffff;
    --surface-muted: #f8f9fd;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: rgba(148, 163, 184, 0.35);
    --border-strong: rgba(148, 163, 184, 0.55);
    --accent: #4f6ae8;
    --accent-hover: #4158d9;
    --accent-soft: rgba(79, 106, 232, 0.14);
    --accent-ring: rgba(79, 106, 232, 0.45);
    --danger: #dc4466;
    --danger-soft: rgba(220, 68, 102, 0.12);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 36px rgba(15, 23, 42, 0.09);
    --ease: cubic-bezier(0.33, 1, 0.68, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg-accent);
    background-attachment: fixed;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.18s var(--ease);
}

a:hover {
    color: var(--accent-hover);
}

/* ——— Top bar ——— */
.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.85rem 1.35rem;
    background: linear-gradient(135deg, #1a2744 0%, #141d33 50%, #121b30 100%);
    color: #f1f5f9;
    box-shadow: var(--shadow-md);
}

.topbar strong {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.nav-main {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.35rem;
    align-items: center;
}

.nav-main a {
    color: rgba(241, 245, 249, 0.88);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.nav-main a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.logout-form {
    margin: 0;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.15rem;
}

.shell {
    padding-bottom: 3rem;
    padding-top: 1.35rem;
}

/* ——— Tipografia páginas ——— */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.45rem;
}

.page-head h1 {
    margin: 0;
    font-size: clamp(1.35rem, 2.8vw, 1.65rem);
    font-weight: 600;
    letter-spacing: -0.035em;
    color: var(--text);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
}

main h2 {
    margin: 1.65rem 0 0.85rem;
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

.muted {
    color: var(--text-muted);
}

.small {
    font-size: 0.875rem;
}

/* ——— Cartões ——— */
.card,
.hero {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.55rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.card-inline {
    margin-bottom: 1.1rem;
}

.chart-wrap {
    margin-top: 1.5rem;
}

.filter-card {
    margin-bottom: 1.55rem;
}

.filter-card h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* ——— Botões ——— */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.52rem 1.05rem;
    background: var(--accent);
    color: #fff !important;
    text-decoration: none !important;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    box-shadow: 0 2px 8px rgba(79, 106, 232, 0.28);
    transition:
        transform 0.18s var(--ease),
        box-shadow 0.18s var(--ease),
        background 0.18s var(--ease);
}

.btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 14px rgba(79, 106, 232, 0.35);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #64748b;
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.22);
}

.btn-secondary:hover {
    background: #56657a;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.28);
}

.btn-danger {
    background: var(--danger);
    box-shadow: 0 2px 8px rgba(220, 68, 102, 0.28);
}

.btn-danger:hover {
    background: #c73d5d;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: none;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: none;
}

.btn-sm {
    padding: 0.32rem 0.62rem;
    font-size: 0.82rem;
}

.btn-block {
    width: 100%;
}

/* ——— Campos de formulário (global): inputs, selects, textareas ——— */
textarea {
    resize: vertical;
    min-height: 4rem;
}

input:not([type='checkbox']):not([type='radio']):not([type='submit']):not([type='button']):not([type='image']):not([type='range']):not([type='file']),
select,
textarea {
    font-family: inherit;
    font-size: 0.96rem;
    color: var(--text);
    width: 100%;
    max-width: 100%;
    padding: 0.62rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background-color: var(--surface-muted);
    background-clip: padding-box;
    transition:
        border-color 0.2s var(--ease),
        box-shadow 0.2s var(--ease),
        background-color 0.2s var(--ease);
}

select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.45rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.72rem center;
    background-size: 14px;
}

select:hover,
input:hover:not(:disabled),
textarea:hover:not(:disabled) {
    border-color: rgba(148, 163, 184, 0.75);
    background-color: #fff;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    background-color: #fff;
    box-shadow: 0 0 0 4px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

label {
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text-muted);
    letter-spacing: -0.01em;
}

/* Formulários em stack */
.stack label,
.stack .check-row {
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    margin-bottom: 1rem;
}

.check-row {
    flex-direction: row !important;
    align-items: center;
    gap: 0.65rem !important;
    padding: 0.55rem 0.65rem;
    margin-bottom: 0.5rem !important;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background 0.18s var(--ease);
}

.check-row:hover {
    background: var(--surface-muted);
}

.stack input[type='checkbox'] {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--accent);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 1.15rem;
}

.narrow {
    max-width: 520px;
}

/* Toolbar / filtros (ex.: lista de alunos, turmas) */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 1.15rem;
    align-items: flex-end;
}

.toolbar label {
    flex: 1 1 180px;
    min-width: 0;
}

.toolbar button.btn {
    flex-shrink: 0;
}

/* ——— Tabelas ——— */
.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

.table th,
.table td {
    padding: 0.78rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.table tbody tr {
    transition: background 0.15s var(--ease);
}

.table tbody tr:hover {
    background: rgba(248, 250, 252, 0.85);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table th {
    background: linear-gradient(180deg, #fafbfd 0%, #f4f6fb 100%);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.cell-actions {
    white-space: nowrap;
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
    align-items: center;
}

form.inline {
    display: inline;
}

/* ——— Alertas ——— */
.alert {
    padding: 0.85rem 1.05rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(220, 252, 231, 0.85);
    color: #14532d;
    border-color: rgba(134, 239, 172, 0.45);
}

.alert-danger {
    background: rgba(254, 226, 226, 0.85);
    color: #7f1d1d;
    border-color: rgba(252, 165, 165, 0.45);
}

.alert-warning {
    background: rgba(254, 249, 195, 0.78);
    color: #713f12;
    border-color: rgba(253, 224, 71, 0.35);
}

.alert-info {
    background: rgba(224, 242, 254, 0.85);
    color: #0c4a6e;
    border-color: rgba(125, 211, 252, 0.45);
}

/* ——— Badges ——— */
.badge {
    display: inline-block;
    padding: 0.22rem 0.58rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-ok {
    background: rgba(187, 247, 208, 0.65);
    color: #14532d;
}

.badge-bad {
    background: rgba(254, 202, 202, 0.65);
    color: #7f1d1d;
}

.badge-muted {
    background: rgba(226, 232, 240, 0.85);
    color: #475569;
}

.badge-status-pendente {
    background: rgba(254, 249, 195, 0.85);
    color: #713f12;
}

.badge-status-pago {
    background: rgba(187, 247, 208, 0.65);
    color: #14532d;
}

.badge-status-atrasado {
    background: rgba(254, 202, 202, 0.65);
    color: #7f1d1d;
}

/* ——— Métricas dashboard ——— */
.grid-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.65rem;
}

.grid-metrics.small .metric {
    padding: 0.85rem 1.05rem;
}

.metric {
    background: var(--surface);
    padding: 1.15rem 1.35rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.metric span {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metric strong {
    font-size: 1.42rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.55rem 1.15rem;
    background: var(--surface);
    padding: 1.35rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.detail-grid dt {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.detail-grid dd {
    margin: 0;
}

.link-list,
.pill-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.link-list li {
    margin-bottom: 0.42rem;
}

.pill-list li {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    margin: 0.38rem 0.38rem 0 0;
    padding: 0.42rem 0.85rem;
    background: var(--surface);
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.88rem;
    box-shadow: var(--shadow-sm);
}

/* ——— Login ——— */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    padding: 2rem 2rem 2.15rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.auth-card h1 {
    margin-top: 0;
    margin-bottom: 0.35rem;
    font-size: 1.42rem;
    font-weight: 700;
    letter-spacing: -0.035em;
}

.hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 1.15rem;
    line-height: 1.45;
}

/* ——— Foco visível (acessibilidade) ——— */
*:focus-visible {
    outline: 2px solid var(--accent-ring);
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
}

.btn:focus-visible {
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .page-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .nav-main {
        width: 100%;
    }
}
