* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #f5f6fa;
    color: #222;
}

a { color: #3788d8; text-decoration: none; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 10px 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.topbar-left { display: flex; align-items: center; gap: 28px; }

.topbar-nav { display: flex; align-items: center; gap: 4px; }
.topbar-nav a {
    color: #555;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 20px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.topbar-nav a:hover { background: #f0f4fa; color: #3788d8; }
.topbar-nav a.active { background: #3788d8; color: #fff; }

.brand { display: flex; align-items: center; }
.brand img { display: block; }
.brand-text { font-size: 18px; font-weight: 700; color: #222; }
.auth-logo { align-self: center; margin-bottom: 4px; }
.auth-brand .brand-text { color: #fff; font-size: 20px; font-weight: 700; }

.topbar-right { display: flex; gap: 14px; align-items: center; }
.user-name {
    color: #444;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px;
    background: #f0f2f5;
    border-radius: 20px;
}
.btn-logout {
    font-size: 13px;
    font-weight: 600;
    color: #c0392b;
    padding: 6px 14px;
    border: 1px solid #f0d3d0;
    border-radius: 20px;
}
.btn-logout:hover { background: #fdf0ef; }

.content { padding: 24px 32px; max-width: 1000px; margin: 0 auto; }

/* Auth pages */
.auth-page {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    overflow: hidden;
    background: linear-gradient(135deg, #020a1a 0%, #06265c 45%, #00afef 100%);
}
.auth-page::before {
    content: '';
    position: absolute;
    top: -12%;
    right: -8%;
    width: 55vw;
    height: 55vw;
    max-width: 640px;
    max-height: 640px;
    background: radial-gradient(circle, rgba(0,175,239,0.55) 0%, rgba(0,175,239,0) 70%);
    pointer-events: none;
}
.auth-page::after {
    content: '';
    position: absolute;
    bottom: -18%;
    left: -10%;
    width: 45vw;
    height: 45vw;
    max-width: 520px;
    max-height: 520px;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
}
.auth-brand {
    position: absolute;
    top: 32px;
    left: 40px;
    z-index: 2;
}
.auth-brand img { display: block; width: 130px; filter: brightness(0) invert(1); }
.auth-form {
    position: relative;
    z-index: 1;
    background: #fff;
    padding: 40px 36px;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(2,10,26,0.35);
    width: 360px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.auth-eyebrow { margin: 0; color: #00afef; font-weight: 700; font-size: 15px; }
.auth-form h1 { margin: 0 0 4px; font-size: 24px; color: #10233f; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #555; text-align: left; font-weight: 600; }
.auth-form input {
    padding: 11px 14px;
    border: 1px solid #dde3ec;
    border-radius: 8px;
    font-size: 14px;
    background: #f8fafc;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-form input:focus {
    outline: none;
    border-color: #00afef;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,175,239,0.15);
}
.auth-form .btn-primary {
    background: linear-gradient(135deg, #00afef, #0077c2);
    border-color: transparent;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 700;
}
.auth-form .btn-primary:hover { background: linear-gradient(135deg, #0099d6, #00629e); }
.switch { font-size: 13px; text-align: center; color: #666; }

@media (max-width: 480px) {
    .auth-brand { top: 20px; left: 20px; }
    .auth-brand img { width: 100px; }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    color: #333;
    cursor: pointer;
    font-size: 14px;
}
.btn-primary { background: #3788d8; color: #fff; border-color: #3788d8; }
.btn-primary:hover { background: #2f70b3; }
.btn-success { background: #2e7d32; color: #fff; border-color: #2e7d32; }
.btn-success:hover { background: #256428; }

.error { color: #c0392b; font-size: 13px; }
.success { color: #2e7d32; font-size: 13px; }

/* Dashboard tiles */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 20px;
}
.tile {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.tile:hover { border-color: #3788d8; box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.tile-title { font-size: 18px; font-weight: 700; color: #222; }
.tile-desc { font-size: 13px; color: #777; }

@media (max-width: 700px) {
    .content { padding: 14px; }
    .topbar { padding: 8px 14px; flex-wrap: wrap; gap: 10px; }
    .topbar-nav { flex-basis: 100%; overflow-x: auto; padding-bottom: 2px; }
    .topbar-nav a { white-space: nowrap; padding: 7px 12px; font-size: 13px; }
    .brand img { width: 84px; }
}

/* Tables (Vales) */
.table-wrap { overflow-x: auto; margin-top: 16px; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.data-table th, .data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}
.data-table th { background: #f5f6fa; font-weight: 700; color: #444; }
.data-table tr:last-child td { border-bottom: none; }
.data-table form { display: inline; }
.data-table tr.row-inactive { opacity: 0.55; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}
.badge-blue { background: #e3f0fc; color: #1565c0; }
.badge-green { background: #e5f4ea; color: #2e7d32; }
.badge-purple { background: #f0e6fb; color: #6a1b9a; }
.badge-grey { background: #eee; color: #666; margin-left: 8px; }

/* Employee photo / avatar */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dce6f5;
    color: #3788d8;
    font-weight: 700;
    font-size: 15px;
}
.avatar-lg { width: 72px; height: 72px; font-size: 26px; margin-bottom: 12px; }

/* Search form */
.search-form { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.search-form input[type="text"] {
    flex: 1;
    max-width: 360px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}
.filter-form select,
.filter-form input[type="date"] {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}
.filter-form label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #444; }

@media (max-width: 700px) {
    .search-form input[type="text"] { max-width: none; flex-basis: 100%; }
}

/* Simple list (Configurações) */
.simple-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; max-width: 480px; }
.simple-list-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 10px 14px;
}
.simple-list-row input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}

/* Inline forms (Novo funcionário / Lançar vale / Novo tipo) */
.inline-form {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: 12px;
}
.inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #444; }
.inline-form input, .inline-form select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}

@media (max-width: 700px) {
    .inline-form { flex-direction: column; align-items: stretch; }
}

/* Standalone create pages (Novo funcionário) */
.stacked-form {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 420px;
    margin-top: 16px;
}
.stacked-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #444; }
.stacked-form input,
.stacked-form select,
.stacked-form textarea {
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.stacked-form textarea { resize: vertical; }

/* Observações (Funcionário) */
.modal-box textarea {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    width: 100%;
}

/* Clickable rows that open a details/notes popup (Vales, Funcionários) */
.link-btn {
    background: none;
    border: none;
    padding: 0;
    color: #3788d8;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-align: left;
}
.link-btn:hover { color: #2f70b3; }

/* Employee autocomplete (Lançar vale) */
.autocomplete-wrap { position: relative; }
.autocomplete-wrap input[type="text"] { width: 240px; }
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 20;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.autocomplete-item { padding: 8px 10px; cursor: pointer; font-size: 14px; }
.autocomplete-item:hover { background: #f0f4fa; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}
.modal-box {
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.modal-logo { display: block; width: 60%; margin: 0 0 14px; }
.modal-box h3 { margin: 0 0 12px; font-size: 16px; padding-right: 24px; }
.modal-box p { margin: 0; font-size: 14px; color: #333; white-space: pre-wrap; }
.modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #888;
    cursor: pointer;
}
.modal-close:hover { color: #333; }

.employee-details p { margin: 0 0 8px; font-size: 14px; color: #333; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-box form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #444; margin-bottom: 10px; }
.modal-box form input[type="text"] { padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; width: 100%; }
