:root {
    --bg: #eef2f7;
    --bg-alt: #f8fafc;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-solid: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #dbe3ee;
    --line-strong: #c7d2e0;
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.06);
    --blue: #2563eb;
    --blue-strong: #1d4ed8;
    --green: #16a34a;
    --red: #dc2626;
    --amber: #d97706;
    --cyan: #0891b2;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Segoe UI", "Trebuchet MS", Tahoma, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 28%),
        radial-gradient(circle at top right, rgba(8, 145, 178, 0.1), transparent 24%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

header {
    padding: 24px 16px 18px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98)),
        linear-gradient(135deg, var(--blue), var(--cyan));
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
}

header h1,
header h2 {
    margin: 0;
    font-size: 26px;
    line-height: 1.1;
    letter-spacing: 0;
}

header .small,
header .header-subtitle {
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.78);
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 22px auto 36px;
}

.page-head,
.page-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-head h2,
.page-head h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.1;
}

.page-head p,
.page-toolbar p {
    margin: 6px 0 0;
    color: var(--muted);
    max-width: 65ch;
}

.card {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card h2,
.card h3 {
    margin-top: 0;
    margin-bottom: 14px;
}

.menu {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 18px;
    padding: 12px;
    background: rgba(255,255,255,0.78);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.menu a {
    text-decoration: none;
    width: auto;
    white-space: nowrap;
    flex: 0 0 auto;
}

.btn,
button,
.menu a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.menu .btn,
.menu .red,
.menu .blue {
    box-shadow: var(--shadow-soft);
}

.btn:hover,
button:hover,
.menu a:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.btn,
button {
    background: #0f172a;
    color: #fff;
}

.btn:hover,
button:hover {
    background: #1e293b;
}

.btn.blue,
button.blue {
    background: var(--blue);
}

.btn.blue:hover,
button.blue:hover {
    background: var(--blue-strong);
}

.btn.green,
button.green,
.green {
    background: var(--green);
}

.btn.green:hover,
button.green:hover,
.green:hover {
    background: #15803d;
}

.btn.red,
button.red,
.red {
    background: var(--red);
}

.btn.red:hover,
button.red:hover,
.red:hover {
    background: #b91c1c;
}

.yellow {
    background: var(--amber);
}

.yellow:hover {
    background: #b45309;
}

.btn-small {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 10px;
    font-size: 12px;
}

.stats,
.grid {
    display: grid;
    gap: 14px;
}

.contact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 14px;
}

.contact-field {
    display: flex;
    flex-direction: column;
}

.contact-grid > div:last-child {
    grid-column: 1 / -1;
}

.stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.stat {
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(247,250,252,0.95));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow-soft);
}

.stat strong {
    display: block;
    margin-top: 10px;
    font-size: 30px;
    line-height: 1;
}

.stat .small {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

form.grid {
    align-items: end;
}

label {
    display: block;
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    padding: 12px 14px;
    font: inherit;
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(37, 99, 235, 0.65);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--blue);
}

input[type="file"] {
    padding: 10px;
}

.file-upload {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.9);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.88);
    cursor: pointer;
}

.file-upload input {
    padding: 0;
    border: 0;
    background: transparent;
}

.file-upload span {
    font-weight: 800;
    color: var(--blue);
}

.file-upload small {
    color: var(--muted);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 92px;
}

.password-field .toggle-password {
    position: absolute;
    top: 50%;
    right: 8px;
    width: auto;
    min-height: 32px;
    padding: 7px 10px;
    border-radius: 8px;
    transform: translateY(-50%);
    background: #eef4ff;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    box-shadow: none;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.8);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

th,
td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

tr:last-child td {
    border-bottom: 0;
}

tr:hover td {
    background: rgba(37, 99, 235, 0.04);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    border: 1px solid transparent;
}

.badge.aprovado,
.badge.aprovado {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
    border-color: rgba(22, 163, 74, 0.18);
}

.badge.pendente {
    background: rgba(217, 119, 6, 0.12);
    color: #92400e;
    border-color: rgba(217, 119, 6, 0.18);
}

.badge.recusado,
.badge.inativo {
    background: rgba(220, 38, 38, 0.12);
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.18);
}

.badge.compareceu {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
    border-color: rgba(22, 163, 74, 0.18);
}

.badge.faltou {
    background: rgba(220, 38, 38, 0.12);
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.18);
}

.pix-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
}

.pix-value {
    min-width: 0;
    word-break: break-word;
    color: var(--text);
    font-weight: 600;
}

.copy-mini {
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 12px;
    white-space: nowrap;
}

.alert,
.success,
.error {
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert {
    background: rgba(219, 234, 254, 0.9);
    color: #1d4ed8;
    border-color: rgba(96, 165, 250, 0.24);
}

.success {
    background: rgba(220, 252, 231, 0.92);
    color: #166534;
    border-color: rgba(74, 222, 128, 0.24);
}

.error {
    background: rgba(254, 226, 226, 0.92);
    color: #991b1b;
    border-color: rgba(248, 113, 113, 0.24);
}

.day {
    border: 1px solid var(--line);
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-soft);
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.schedule-card {
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    padding: 16px;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.schedule-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.09);
}

.schedule-card.approved {
    background: linear-gradient(180deg, rgba(220, 252, 231, 0.92), rgba(240, 253, 244, 0.86));
    border-color: rgba(22, 163, 74, 0.16);
}

.schedule-card.pending {
    background: linear-gradient(180deg, rgba(254, 243, 199, 0.95), rgba(255, 251, 235, 0.88));
    border-color: rgba(217, 119, 6, 0.18);
}

.schedule-card.recused,
.schedule-card.locked {
    background: linear-gradient(180deg, rgba(254, 226, 226, 0.95), rgba(255, 241, 242, 0.88));
    border-color: rgba(220, 38, 38, 0.16);
}

.schedule-card.available {
    background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(248,250,252,0.84));
}

.schedule-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.schedule-top strong {
    display: block;
    margin-bottom: 4px;
    font-size: 16px;
}

.schedule-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legend .badge {
    background: #fff;
}

.day strong {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 15px;
}

.resumo-dia {
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.76);
    margin-bottom: 12px;
}

.resumo-dia h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.resumo-grupo {
    margin: 12px 0;
}

.resumo-grupo h4 {
    margin: 0 0 8px;
    font-size: 15px;
    color: #334155;
}

.summary-person {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px 5px 6px;
    border-radius: 999px;
    border: 1px solid #bbf7d0;
    background: #dcfce7;
}

.summary-person .avatar-sm {
    width: 28px;
    height: 28px;
}

.summary-person .user-cell {
    gap: 7px;
}

.summary-person .user-cell small {
    display: none;
}

.small {
    font-size: 12px;
    color: var(--muted);
}

textarea {
    min-height: 220px;
    resize: vertical;
    line-height: 1.5;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.profile-thumb {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(37, 99, 235, 0.18);
    background: #e2e8f0;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-cell strong {
    display: block;
}

.user-cell small {
    display: block;
    color: var(--muted);
    margin-top: 2px;
}

.avatar-sm {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
    border: 2px solid rgba(37, 99, 235, 0.16);
    background: #e2e8f0;
}

.avatar-fallback {
    display: inline-grid;
    place-items: center;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 900;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.permission-row {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.85);
}

/* Login */
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 25%),
        radial-gradient(circle at bottom right, rgba(8, 145, 178, 0.12), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, #e8eef7 100%);
}

.login-box {
    width: min(440px, 100%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.login-title {
    margin: 0 0 6px;
    font-size: 30px;
}

.login-subtitle {
    margin: 0 0 22px;
    color: var(--muted);
}

.login-box form {
    display: grid;
    gap: 12px;
}

.login-box button {
    width: 100%;
}

.login-link {
    display: inline-flex;
    margin-top: 14px;
    color: var(--blue);
    font-weight: 700;
}

/* Responsive */
@media (max-width: 900px) {
    .stats,
    .grid,
    .schedule-grid {
        grid-template-columns: 1fr;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .page-head,
    .page-toolbar {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .container {
        width: min(100% - 20px, 1180px);
        margin-top: 16px;
    }

    header {
        padding: 20px 14px 16px;
    }

    header h1,
    header h2 {
        font-size: 22px;
    }

    .card {
        padding: 16px;
    }

    th,
    td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .btn,
    button,
    .menu a {
        width: 100%;
    }
}
